1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/runit/runit.conf
3 # Copyright (C) 2004 - 2021 The T2 SDE Project
4 # Copyright (C) 1998 - 2003 ROCK Linux Project
6 # This Copyright note is generated by scripts/Create-CopyPatch,
7 # more information can be found in the files COPYING and README.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License version 2.
11 # --- T2-COPYRIGHT-NOTE-END ---
13 [ "$prefix" = usr ] && sbindir="sbin"
15 . $base/package/*/runit/djb-config admin $root$sbindir
17 hook_add postmake 6 'pkg_runit_addservices'
18 if ! pkginstalled daemontools; then
19 hook_add postmake 7 ' \
20 [ "$pkg_djb_commanddir" != "$root$sbindir" ] && add_flist ${pkg_djb_commanddir#$root}; \
21 [ "$pkg_djb_servicedir" ] && add_flist $pkg_djb_servicedir; \
22 [ "$pkg_djb_packagedir" ] && add_flist $pkg_djb_packagedir; \
26 pkg_runit_addservices() {
27 local agettyargs speed
29 # main scripts and virtual consoles
31 if [ "$SDECFG_INIT" == "runit" ]; then
32 #if [ ! -f $root$sysconfdir/1 ]; then
33 echo "Creating main scripts and virtual consoles..."
35 mkdir -p $root$sysconfdir
36 cp -vf ./doc/debian/[123] $root$sysconfdir/
37 cp -vf ./doc/debian/ctrlaltdel $root$sysconfdir/
38 chmod 744 $root$sysconfdir/[123]
39 chmod 744 $root$sysconfdir/ctrlaltdel
40 mkdir -p $root$sysconfdir/{1,3}.d
42 for i in console 1 2 3 4 5 6; do
43 if [ "$i" == "console" ]; then
44 echo "Creating getty $i..."
47 echo "Creating getty tty$i..."
51 mkdir -p $root$sysconfdir/getty-${i#vc/}
52 if [ "$i" == "console" -o "$i" == "vc/1" ]; then
53 agettyargs='-L -i -I '"'"'\012\015\012Maintenance Console:\012'"'"
55 agettyargs='-f /etc/issue.ansi'
57 cat << EOT > $root$sysconfdir/getty-${i#vc/}/run
59 exec /sbin/agetty $agettyargs $speed $i linux
61 cat << EOT > $root$sysconfdir/getty-${i#vc/}/finish
63 exec ${pkg_djb_commanddir#$root}/utmpset -w $i
65 chmod 755 $root$sysconfdir/getty-${i#vc/}/{run,finish}
70 echo "Make getties available to svscan..."
71 for i in 1 2 3 4 5 6; do
72 ln -snfv $sysconfdir/getty-$i $pkg_djb_servicedir/
75 # HACK, runit need it's own system initializer
76 install_init system $confdir/../sysvinit/system.init
78 ln -snfv /sbin/init.d/system "$root$sysconfdir/1.d/10system"
79 ln -snfv /sbin/init.d/system "$root$sysconfdir/3.d/90system"
82 if [ "$SDECFG_INIT" == "runit" ]; then
83 echo "Copying init files to /sbin..."
84 cp -vf ./command/runit $root$sbindir/runit
85 cp -vf ./command/runit-init $root$sbindir/init
90 ln -sfv forced_reboot $pkg_djb_commanddir/forced_poweroff
92 # Emulate daemontools if not present using chpst
93 if ! pkginstalled daemontools; then
94 echo "Emulate functionality of daemontools with chpst."
95 for x in softlimit envdir envuidgid pgrphack setlock setuidgid;
97 ln -sfv chpst $pkg_djb_commanddir/$x
102 if [ "$SDECFG_PKG_DJB_LAYOUT" == "1" ]; then
103 hook_add premake 5 "for x in ./doc/debian/*; do \
104 if [ -f \$x ]; then \
105 echo Fixing \$x...; \
106 sed -i -e 's,/var/service,/service,g' \$x; \
111 cat <<-EOP > $root/etc/profile.d/runit
112 export PATH=/command:\$PATH
115 hook_add postmake 5 'runit_profile_d'
117 hook_add premake 5 "for x in ./doc/debian/*; do \
118 if [ -f \$x ]; then \
119 echo Fixing \$x...; \
120 sed -i -e 's,/command:,,g' \$x; \
123 hook_add postinstall 8 'sed -i -e "s,/service,/var/service,g" \
124 $root/lib/network/runit.sh'