From d28d2287b138ede0591d9facd5dbe7ca4f329f83 Mon Sep 17 00:00:00 2001 From: davidovski Date: Tue, 29 Mar 2022 23:37:34 +0100 Subject: added sysvinit and openrc --- repo/system/bootscripts.xibuild | 18 +---- repo/system/openrc.xibuild | 129 ++++++++++++++++++++++++++++++++++ repo/system/s6-linux-init.xibuild | 26 ------- repo/system/s6-linux-utils.xibuild | 20 ------ repo/system/s6-portable-utils.xibuild | 23 ------ repo/system/s6-rc.xibuild | 25 ------- repo/system/s6.xibuild | 24 ------- repo/system/sysvinit.xibuild | 25 +++++++ 8 files changed, 157 insertions(+), 133 deletions(-) create mode 100644 repo/system/openrc.xibuild delete mode 100644 repo/system/s6-linux-init.xibuild delete mode 100644 repo/system/s6-linux-utils.xibuild delete mode 100644 repo/system/s6-portable-utils.xibuild delete mode 100644 repo/system/s6-rc.xibuild delete mode 100644 repo/system/s6.xibuild create mode 100644 repo/system/sysvinit.xibuild (limited to 'repo/system') diff --git a/repo/system/bootscripts.xibuild b/repo/system/bootscripts.xibuild index f133786..6fe5e6f 100644 --- a/repo/system/bootscripts.xibuild +++ b/repo/system/bootscripts.xibuild @@ -1,23 +1,11 @@ #!/bin/sh -MAKEDEPS="make s6-linux-init s6-rc utmps" -DEPS="sh eudev s6 s6-rc s6-linux-utils s6-portable-utils s6-linux-init" +MAKEDEPS="make " +DEPS="sh eudev" SOURCE=https://xi.davidovski.xyz/git/bootscripts.git DESC="Bootscripts to initiate the system on boot" package () { - make DESTDIR=$PKG_DEST bootscripts - - # Compile a basic database for boot - s6-rc-compile $PKG_DEST/etc/s6/db/basic $PKG_DEST/etc/s6/sv - ln -s /etc/s6/db/basic $PKG_DEST/etc/s6/db/current - - # initialize s6 init base. - s6-linux-init-maker -1 -t 2 -L \ - -f $PKG_DEST/etc/s6/skel \ - -p "/usr/bin:/usr/sbin:/bin:/sbin" \ - -D default \ - -G "/sbin/agetty -L -8 tty1 115200" \ - -c $PKG_DEST/etc/s6/base -u root -U utmp $PKG_DEST/etc/s6/base + make DESTDIR=$PKG_DEST install } diff --git a/repo/system/openrc.xibuild b/repo/system/openrc.xibuild new file mode 100644 index 0000000..d7c061b --- /dev/null +++ b/repo/system/openrc.xibuild @@ -0,0 +1,129 @@ +#!/bin/sh + +MAKEDEPS="make " +DEPS="ifupdown-ng sbase musl" + +PKG_VER=0.44.10 +SOURCE=https://github.com/OpenRC/openrc/archive/refs/tags/$PKG_VER.zip +ADDITIONAL=" + 0001-call-sbin-mkmntdirs-in-localmount-OpenRC-service.patch + 0002-fsck-don-t-add-C0-to-busybox-fsck.patch + 0003-rc-pull-in-sysinit-and-boot-as-stacked-levels-when-n.patch + 0004-make-consolefont-service-compatible-with-busyboxs-se.patch + 0005-Support-early-loading-of-keymap-if-kbd-is-installed.patch + 0006-Add-support-for-starting-services-in-a-specified-VRF.patch + 0007-Clean-up-staticroute-config-remove-irrelevant-parts-.patch + 0008-bootmisc-switch-wipe_tmp-setting-to-no-by-default.patch + 0009-fix-bootmisc-mv-error.patch + 0010-noexec-devfs.patch + seedrng.patch + openrc.logrotate + hostname.initd + hwdrivers.initd + modules.initd + modloop.initd + networking.initd + modloop.confd + sysfsconf.initd + firstboot.initd + sysctl.initd + machine-id.initd + test-networking.sh + " + +DESC="Dependency based init system that works with sysvinit" + +# build borrowed from alpine linux +prepare () { + apply_patches + sed -i -e '/^sed/d' pkgconfig/Makefile + find ./ -name "Makefile" | xargs sed -i 's/ln -snf/ln -sf/g' +} + +build () { + export MKZSHCOMP=yes + export MKBASHCOMP=yes + make LIBDIR=/lib LIBEXECDIR=/lib/rc +} + +check () { + make check +} + +package () { + make LIBEXECDIR=/lib/rc DESTDIR="$PKG_DEST/" install + + rm -f "$PKG_DEST"/sbin/openrc-init "$PKG_DEST"/sbin/openrc-shutdown + + # we cannot have anything turned on by default + rm -f "$PKG_DEST"/etc/runlevels/*/* + + # we still use our ifup/ifdown based net config + rm -f "$PKG_DEST"/etc/conf.d/network "$PKG_DEST"/etc/init.d/network + + # our hostname init script reads hostname from /etc/hostname + rm -f "$PKG_DEST"/etc/conf.d/hostname + + # we override some of the scripts + for i in *.initd; do + j=${i##*/} + install -Dm755 $i "$PKG_DEST"/etc/init.d/${j%.initd} + done + + # we override some of the conf.d files + for i in *.confd; do + j=${i##*/} + install -Dm644 $i "$PKG_DEST"/etc/conf.d/${j%.confd} + done + + # additional documentation considered useful + mkdir -p "$PKG_DEST"/usr/share/doc/openrc/ + install -m644 ChangeLog ./*.md "$PKG_DEST"/usr/share/doc/openrc/ + + # we use a virtual keymaps services to allow users to set their + # keymaps either with the OpenRC loadkeys service provided by + # the kbd aport or with the loadkmap service provided by the + # busybox-initscripts aport. + rm -f "$PKG_DEST/etc/init.d/keymaps" \ + "$PKG_DEST/etc/conf.d/keymaps" + + install -Dm644 openrc.logrotate $PKG_DEST/etc/logrotate.d/openrc + install -d "$PKG_DEST"/etc/local.d "$PKG_DEST"/run + + # openrc upstream removed service(8) for whatever reason, put it back + ln -s /sbin/rc-service $PKG_DEST/sbin/service + + # remove deprecated /sbin/runscript to avoid conflict with minicom + rm $PKG_DEST/sbin/runscript +} + +postinstall () { + mkdir -p /run/openrc + for dir in /libexec /lib; do + [ -d $dir/rc/init.d ] || continue + + for i in $dir/rc/init.d/* ; do + [ -e "$i" ] || continue + if [ -e /run/openrc/${i##*/} ]; then + rm -r $i + else + mv $i /run/openrc/ + fi + done + + rmdir $dir/rc/init.d $dir/rc /libexec 2>/dev/null + done + + # create rc.local compat + if [ -f /etc/rc.local ]; then + cat >/etc/local.d/rc.local-compat.start<< EOF +#!/bin/sh + +# this is only here for compatibility reasons +if [ -f /etc/rc.local ]; then + . /etc/rc.local +fi +EOF + chmod +x /etc/local.d/rc.local-compat.start + fi +} diff --git a/repo/system/s6-linux-init.xibuild b/repo/system/s6-linux-init.xibuild deleted file mode 100644 index fa68b90..0000000 --- a/repo/system/s6-linux-init.xibuild +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -MAKEDEPS="make" -DEPS="s6 skalibs nsss" - -PKG_VER=1.0.7.0 -SOURCE=https://skarnet.org/software/s6-linux-init/s6-linux-init-$PKG_VER.tar.gz -DESC="Small suite of programs for UNIX, designed to allow process supervision" - -build () { - ./configure --enable-shared \ - --enable-static \ - --enable-nsss \ - --enable-allstatic \ - --enable-static-libc \ - --libdir=/usr/lib \ - --libexecdir=/usr/lib/s6-linux-init \ - --with-dynlib=/usr/lib \ - --enable-utmps - - make -} - -package () { - make DESTDIR=$PKG_DEST install -} diff --git a/repo/system/s6-linux-utils.xibuild b/repo/system/s6-linux-utils.xibuild deleted file mode 100644 index 8d2d358..0000000 --- a/repo/system/s6-linux-utils.xibuild +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -MAKEDEPS="make" -DEPS="skalibs s6" - -PKG_VER=2.11.0.1 -SOURCE=https://skarnet.org/software/s6-linux-utils/s6-linux-utils-2.5.1.7.tar.gz -DESC="Minimalistic Linux-specific system utilities" - -build () { - ./configure --disable-allstatic \ - --prefix=/usr \ - --with=dynlib=/usr/lib - - make -} - -package () { - make DESTDIR=$PKG_DEST install -} diff --git a/repo/system/s6-portable-utils.xibuild b/repo/system/s6-portable-utils.xibuild deleted file mode 100644 index a0e0956..0000000 --- a/repo/system/s6-portable-utils.xibuild +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -MAKEDEPS="make" -DEPS="skalibs s6" - -PKG_VER=2.2.3.4 -SOURCE=https://skarnet.org/software/s6-portable-utils/s6-portable-utils-$PKG_VER.tar.gz -DESC="Tiny portable generic utilities" - -build () { - ./configure --enable-shared \ - --enable-static \ - --enable-allstatic \ - --enable-static-libc \ - --libdir=/usr/lib \ - --libexecdir=/usr/lib/s6-portable-utils \ - --with-dynlib=/usr/lib - make -} - -package () { - make DESTDIR=$PKG_DEST install -} diff --git a/repo/system/s6-rc.xibuild b/repo/system/s6-rc.xibuild deleted file mode 100644 index bbda0e8..0000000 --- a/repo/system/s6-rc.xibuild +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -MAKEDEPS="make" -DEPS="skalibs s6" - -PKG_VER=0.5.3.0 -SOURCE=https://skarnet.org/software/s6-rc/s6-rc-$PKG_VER.tar.gz - -DESC="Service manager of the s6 init system" - -build () { - ./configure --enable-shared \ - --enable-static \ - --enable-allstatic \ - --enable-static-libc \ - --libdir=/usr/lib \ - --libexecdir=/usr/lib/s6-rc \ - --with-dynlib=/usr/lib - - make -} - -package () { - make DESTDIR=$PKG_DEST install -} diff --git a/repo/system/s6.xibuild b/repo/system/s6.xibuild deleted file mode 100644 index 7f429a5..0000000 --- a/repo/system/s6.xibuild +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -MAKEDEPS="make" -DEPS="skalibs execline" - -PKG_VER=2.11.0.1 -SOURCE=https://skarnet.org/software/s6/s6-$PKG_VER.tar.gz -DESC="Small suite of programs for UNIX, designed to allow process supervision" - -build () { - ./configure --enable-shared \ - --enable-static \ - --enable-allstatic \ - --enable-static-libc \ - --libdir=/usr/lib \ - --libexecdir=/usr/lib/s6 \ - --with-dynlib=/usr/lib - - make -} - -package () { - make DESTDIR=$PKG_DEST install -} diff --git a/repo/system/sysvinit.xibuild b/repo/system/sysvinit.xibuild new file mode 100644 index 0000000..f585b61 --- /dev/null +++ b/repo/system/sysvinit.xibuild @@ -0,0 +1,25 @@ +#!/bin/sh + +MAKEDEPS="make patch" +DEPS="sh musl" + +PKG_VER=3.01 +SOURCE=http://download.savannah.nongnu.org/releases/sysvinit/sysvinit-$PKG_VER.tar.xz +ADDITIONAL=" + https://www.linuxfromscratch.org/patches/lfs/development/sysvinit-$PKG_VER-consolidated-1.patch + " + +DESC="The sysvinit system for controlling startup, running and shutdown of the system" + + +prepare () { + patch -Np1 -i sysvinit-$PKG_VER-consolidated-1.patch +} + +build () { + make +} + +package () { + make ROOT=$PKG_DEST install +} -- cgit v1.2.1