# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/runit/runit.conf # Copyright (C) 2004 - 2021 The T2 SDE Project # Copyright (C) 1998 - 2003 ROCK Linux Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2. # --- T2-COPYRIGHT-NOTE-END --- [ "$prefix" = usr ] && sbindir="sbin" . $base/package/*/runit/djb-config admin $root$sbindir hook_add postmake 6 'pkg_runit_addservices' if ! pkginstalled daemontools; then hook_add postmake 7 ' \ [ "$pkg_djb_commanddir" != "$root$sbindir" ] && add_flist ${pkg_djb_commanddir#$root}; \ [ "$pkg_djb_servicedir" ] && add_flist $pkg_djb_servicedir; \ [ "$pkg_djb_packagedir" ] && add_flist $pkg_djb_packagedir; \ true' fi pkg_runit_addservices() { local agettyargs speed # main scripts and virtual consoles # only if it is INIT if [ "$SDECFG_INIT" == "runit" ]; then #if [ ! -f $root$sysconfdir/1 ]; then echo "Creating main scripts and virtual consoles..." mkdir -p $root$sysconfdir cp -vf ./doc/debian/[123] $root$sysconfdir/ cp -vf ./doc/debian/ctrlaltdel $root$sysconfdir/ chmod 744 $root$sysconfdir/[123] chmod 744 $root$sysconfdir/ctrlaltdel mkdir -p $root$sysconfdir/{1,3}.d for i in console 1 2 3 4 5 6; do if [ "$i" == "console" ]; then echo "Creating getty $i..." speed=9600 else echo "Creating getty tty$i..." i="vc/$i" speed=38400 fi mkdir -p $root$sysconfdir/getty-${i#vc/} if [ "$i" == "console" -o "$i" == "vc/1" ]; then agettyargs='-L -i -I '"'"'\012\015\012Maintenance Console:\012'"'" else agettyargs='-f /etc/issue.ansi' fi cat << EOT > $root$sysconfdir/getty-${i#vc/}/run #!/bin/sh exec /sbin/agetty $agettyargs $speed $i linux EOT cat << EOT > $root$sysconfdir/getty-${i#vc/}/finish #!/bin/sh exec ${pkg_djb_commanddir#$root}/utmpset -w $i EOT chmod 755 $root$sysconfdir/getty-${i#vc/}/{run,finish} done #fi # getties to svscan echo "Make getties available to svscan..." for i in 1 2 3 4 5 6; do ln -snfv $sysconfdir/getty-$i $pkg_djb_servicedir/ done # HACK, runit need it's own system initializer install_init system $confdir/../sysvinit/system.init ln -snfv /sbin/init.d/system "$root$sysconfdir/1.d/10system" ln -snfv /sbin/init.d/system "$root$sysconfdir/3.d/90system" # init at /sbin if [ "$SDECFG_INIT" == "runit" ]; then echo "Copying init files to /sbin..." cp -vf ./command/runit $root$sbindir/runit cp -vf ./command/runit-init $root$sbindir/init fi fi ln -sfv forced_reboot $pkg_djb_commanddir/forced_poweroff # Emulate daemontools if not present using chpst if ! pkginstalled daemontools; then echo "Emulate functionality of daemontools with chpst." for x in softlimit envdir envuidgid pgrphack setlock setuidgid; do ln -sfv chpst $pkg_djb_commanddir/$x done fi } if [ "$SDECFG_PKG_DJB_LAYOUT" == "1" ]; then hook_add premake 5 "for x in ./doc/debian/*; do \ if [ -f \$x ]; then \ echo Fixing \$x...; \ sed -i -e 's,/var/service,/service,g' \$x; \ fi ; \ done" runit_profile_d() { cat <<-EOP > $root/etc/profile.d/runit export PATH=/command:\$PATH EOP } hook_add postmake 5 'runit_profile_d' else hook_add premake 5 "for x in ./doc/debian/*; do \ if [ -f \$x ]; then \ echo Fixing \$x...; \ sed -i -e 's,/command:,,g' \$x; \ fi ; \ done" hook_add postinstall 8 'sed -i -e "s,/service,/var/service,g" \ $root/lib/network/runit.sh' fi