1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#!/bin/sh
if [ -e /service ]
then
: # presumably everything ok already
else
if lsb_release &>/dev/null;
then
dist=$(lsb_release -a | grep Distributor | awk {'print $3'})
else
dist="Debian"
fi
case $dist in
Ubuntu | Debian)
[ -e /etc/service ] || apt install daemontools-run -y
ln -s /etc/service /service
;;
*)
# assuming compiler tools installed from download-build-install-deps
# assuming systemd-based system for starting daemontools
mkdir -p /package
chmod 1755 /package
cd /package
wget https://cr.yp.to/daemontools/daemontools-0.76.tar.gz
gunzip daemontools-0.76.tar
tar -xpf daemontools-0.76.tar
cd admin/daemontools-0.76
echo gcc -O \
--include=errno.h \
--include=unistd.h \
--include=grp.h \
--include=signal.h \
--include=stdio.h \
-Wno-incompatible-pointer-types \
-Wno-implicit-int \
> src/conf-cc
package/compile
package/upgrade
mkdir -p /service
(
echo '[Unit]'
echo 'Description=DJB daemontools'
echo 'After=sysinit.target'
echo ''
echo '[Service]'
echo 'ExecStart=/command/svscanboot'
echo 'Restart=always'
echo ''
echo '[Install]'
echo 'WantedBy=multi-user.target'
) > /lib/systemd/system/daemontools.service
chmod 644 /lib/systemd/system/daemontools.service
ln -s /lib/systemd/system/daemontools.service /etc/systemd/system/multi-user.target.wants/
systemctl start daemontools
esac
fi
|