* added the Unlicense as valid in misc/share/REGISTER
[t2sde.git] / package / init / runit / runit.conf
blob11da3483ba618d754e964dca198cb145b461bcae
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
5
6 # This Copyright note is generated by scripts/Create-CopyPatch,
7 # more information can be found in the files COPYING and README.
8
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; \
23         true'
26 pkg_runit_addservices() {
27         local agettyargs speed
29         # main scripts and virtual consoles
30         # only if it is INIT
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..."
45                                 speed=9600
46                         else
47                                 echo "Creating getty tty$i..."
48                                 i="vc/$i"
49                                 speed=38400
50                         fi
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'"'"
54                         else
55                                 agettyargs='-f /etc/issue.ansi'
56                         fi
57                         cat << EOT > $root$sysconfdir/getty-${i#vc/}/run
58 #!/bin/sh
59 exec /sbin/agetty $agettyargs $speed $i linux
60 EOT
61                         cat << EOT > $root$sysconfdir/getty-${i#vc/}/finish
62 #!/bin/sh
63 exec ${pkg_djb_commanddir#$root}/utmpset -w $i
64 EOT
65                         chmod 755 $root$sysconfdir/getty-${i#vc/}/{run,finish}
66                 done
67         #fi
69         # getties to svscan
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/
73         done
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"
81         # init at /sbin
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
86         fi
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;
96                 do
97                         ln -sfv chpst $pkg_djb_commanddir/$x
98                 done
99         fi
100         }
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; \
107         fi      ; \
108         done"
110         runit_profile_d() {
111                 cat <<-EOP > $root/etc/profile.d/runit
112         export PATH=/command:\$PATH
113         EOP
114         }
115         hook_add postmake 5 'runit_profile_d'
116 else
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; \
121         fi      ; \
122         done"
123         hook_add postinstall 8 'sed -i -e "s,/service,/var/service,g" \
124                 $root/lib/network/runit.sh'