From 4c21484c95188e78c6c62c5e04ceb7e849847e65 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 7 Mar 2018 22:26:08 +0000 Subject: [PATCH] dat-boi daemon --- src/freedombone-app-scuttlebot | 38 ++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/src/freedombone-app-scuttlebot b/src/freedombone-app-scuttlebot index 3c96b4b5..f13ed568 100755 --- a/src/freedombone-app-scuttlebot +++ b/src/freedombone-app-scuttlebot @@ -373,19 +373,49 @@ function mesh_install_dat { #!/bin/bash npm install --arch=$NPM_ARCH -g dat npm install --arch=$NPM_ARCH -g @garbados/dat-boi -npm install --arch=$NPM_ARCH -g add-to-systemd -add-to-systemd dat-boi --user "$(whoami)" "$(which dat-boi)" EOF chroot "$rootdir" /bin/chmod +x /usr/bin/install_dat chroot "$rootdir" /usr/bin/install_dat rm "$rootdir/usr/bin/install_dat" + + { echo '[Unit]'; + echo 'Description=DAT-boi'; + echo 'After=syslog.target'; + echo 'After=network.target'; + echo ''; + echo '[Service]'; + echo 'Type=simple'; + echo 'User=root'; + echo 'Group=root'; + echo 'ExecStart=/usr/local/bin/dat-boi'; + echo 'Restart=always'; + echo ''; + echo '[Install]'; + echo 'WantedBy=multi-user.target'; } > "$rootdir/etc/systemd/system/dat-boi.service" + chmod +x "$rootdir/etc/systemd/system/dat-boi.service" + chroot "$rootdir" systemctl enable dat-boi } function install_dat { npm install -g dat npm install -g @garbados/dat-boi - npm install -g add-to-systemd - add-to-systemd dat-boi --user "$(whoami)" "$(which dat-boi)" + + { echo '[Unit]'; + echo 'Description=DAT-boi'; + echo 'After=syslog.target'; + echo 'After=network.target'; + echo ''; + echo '[Service]'; + echo 'Type=simple'; + echo 'User=root'; + echo 'Group=root'; + echo 'ExecStart=/usr/local/bin/dat-boi'; + echo 'Restart=always'; + echo ''; + echo '[Install]'; + echo 'WantedBy=multi-user.target'; } > /etc/systemd/system/dat-boi.service + chmod +x /etc/systemd/system/dat-boi.service + systemctl enable dat-boi } function mesh_install_scuttlebot {