From bde21f861ff90f3f04323d140d244902cb9b520b Mon Sep 17 00:00:00 2001 From: Aaditya Bagga Date: Fri, 29 May 2015 21:42:54 +0700 Subject: system/openrc: Added (dependency-based init system). Signed-off-by: Willy Sudiarto Raharjo --- system/openrc/README | 6 ++ system/openrc/README.Slackware | 8 +++ system/openrc/doinst.sh | 24 ++++++++ system/openrc/openrc.SlackBuild | 119 ++++++++++++++++++++++++++++++++++++++++ system/openrc/openrc.info | 10 ++++ system/openrc/openrc.logrotate | 7 +++ system/openrc/slack-desc | 19 +++++++ 7 files changed, 193 insertions(+) create mode 100644 system/openrc/README create mode 100644 system/openrc/README.Slackware create mode 100644 system/openrc/doinst.sh create mode 100644 system/openrc/openrc.SlackBuild create mode 100644 system/openrc/openrc.info create mode 100644 system/openrc/openrc.logrotate create mode 100644 system/openrc/slack-desc (limited to 'system') diff --git a/system/openrc/README b/system/openrc/README new file mode 100644 index 0000000000..595317b16b --- /dev/null +++ b/system/openrc/README @@ -0,0 +1,6 @@ +OpenRC is a dependency based init system that works with the system provided +init program, normally /sbin/init (sysvinit in Slackware). + +For installation instructions see README.Slackware. + +For more information see http://docs.slackware.com/howtos:general_admin:openrc diff --git a/system/openrc/README.Slackware b/system/openrc/README.Slackware new file mode 100644 index 0000000000..2b9c375a10 --- /dev/null +++ b/system/openrc/README.Slackware @@ -0,0 +1,8 @@ +Before installing OpenRC, the /etc/init.d folder would need to be moved out, ie: +# mv /etc/init.d /etc/init.d.bak + +After installing, /etc/inittab would need to be replaced. The old one can be backed up: +# cp /etc/inittab /etc/inittab.sysvinit +# mv /etc/inittab.new /etc/inittab + +Services for OpenRC can be found in the openrc-services package. diff --git a/system/openrc/doinst.sh b/system/openrc/doinst.sh new file mode 100644 index 0000000000..b2fca4b27e --- /dev/null +++ b/system/openrc/doinst.sh @@ -0,0 +1,24 @@ + +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +BACKUP=(etc/inittab + etc/rc.conf + etc/conf.d/{bootmisc,consolefont,devfs,dmesg,fsck,hostname,hwclock,keymaps} + etc/conf.d/{killprocs,localmount,modules,netmount,network,staticroute} + etc/conf.d/{tmpfiles,urandom} + etc/logrotate.d/openrc) +for file in "${BACKUP[@]}"; do + config ${file}.new +done + diff --git a/system/openrc/openrc.SlackBuild b/system/openrc/openrc.SlackBuild new file mode 100644 index 0000000000..2872b84c8c --- /dev/null +++ b/system/openrc/openrc.SlackBuild @@ -0,0 +1,119 @@ +#!/bin/sh + +# Slackware build script for openrc +# Based upon https://aur.archlinux.org/packages/openrc/ + +# Copyright 2015 Aaditya Bagga +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=openrc +VERSION=${VERSION:-0.16.3} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +[ -e "$CWD/$PRGNAM-$VERSION.tar.gz" ] && tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +[ -e "$CWD/$VERSION.tar.gz" ] && tar xvf $CWD/$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +MAKEARGS+=(PREFIX=/usr) +MAKEARGS+=(LIBNAME=lib${LIBDIRSUFFIX}) +MAKEARGS+=(LIBDIR=/usr/lib${LIBDIRSUFFIX}) +MAKEARGS+=(LIBEXECDIR=/usr/libexec/rc) +MAKEARGS+=(SYSCONFDIR=/etc) +MAKEARGS+=(SBINDIR=/sbin) +MAKEARGS+=(MANDIR=/usr/man) +MAKEARGS+=(DOCDIR=/usr/doc/$PRGNAM-$VERSION) +MAKEARGS+=(MKTERMCAP=ncurses) +MAKEARGS+=(BRANDING='Slackware Linux') + +make "${MAKEARGS[@]}" + +make install "${MAKEARGS[@]}" DESTDIR=$PKG + +# Install inittab and logrotate files +install -m 644 support/sysvinit/inittab "$PKG"/etc/inittab.new +install -Dm 0644 "$CWD/$PRGNAM.logrotate" "$PKG/etc/logrotate.d/${PRGNAM}.new" + +# Correct sysctl +sed -e 's|--system|-p|' -i "$PKG/etc/init.d/sysctl" + +# Backup rc.conf +mv "$PKG/etc/rc.conf" "$PKG/etc/rc.conf.new" + +# Backup config files +for file in "$PKG"/etc/conf.d/*; do + mv "${file}" "${file}.new" +done + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a ChangeLog NEWS.md README.md README.newnet TODO $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/doinst.sh >> $PKG/install/doinst.sh +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/openrc/openrc.info b/system/openrc/openrc.info new file mode 100644 index 0000000000..30b96ce212 --- /dev/null +++ b/system/openrc/openrc.info @@ -0,0 +1,10 @@ +PRGNAM="openrc" +VERSION="0.16.3" +HOMEPAGE="https://wiki.gentoo.org/wiki/Project:OpenRC" +DOWNLOAD="https://github.com/OpenRC/openrc/archive/0.16.3.tar.gz" +MD5SUM="75e5ef9c7e5e8ecfaae57742f0b4faea" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="%README%" +MAINTAINER="Aaditya Bagga" +EMAIL="aaditya_gnulinux@zoho.com" diff --git a/system/openrc/openrc.logrotate b/system/openrc/openrc.logrotate new file mode 100644 index 0000000000..a168f2361b --- /dev/null +++ b/system/openrc/openrc.logrotate @@ -0,0 +1,7 @@ +/var/log/rc.log { + compress + rotate 4 + weekly + missingok + notifempty +} diff --git a/system/openrc/slack-desc b/system/openrc/slack-desc new file mode 100644 index 0000000000..45db70a752 --- /dev/null +++ b/system/openrc/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +openrc: openrc (dependency-based init system) +openrc: +openrc: OpenRC is a dependency-based init system that works +openrc: with the system-provided init program, normally /sbin/init. +openrc: +openrc: OpenRC provides a number of features, such as hardware initiated +openrc: initscript run and cgroups support, without requiring large layout +openrc: changes to accommodate different designs and dependencies. +openrc: +openrc: Homepage: https://wiki.gentoo.org/wiki/Project:OpenRC +openrc: -- cgit v1.2.3