From 1935deb53fedcea17be05c65d0d0bd69a714cbde Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 16 Dec 2017 15:21:01 +0000 Subject: [PATCH] Start git-ssb daemon on mesh image --- src/freedombone-app-scuttlebot | 20 ++++++++++++++++++++ src/freedombone-image-mesh | 4 +++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/freedombone-app-scuttlebot b/src/freedombone-app-scuttlebot index d8af44a2..9953ff50 100755 --- a/src/freedombone-app-scuttlebot +++ b/src/freedombone-app-scuttlebot @@ -224,8 +224,10 @@ function remove_scuttlebot { function git_ssb_script { if [[ "$1" == "mesh" ]]; then git_ssb_script_name=$rootdir/usr/bin/git-ssb-create + git_ssb_daemon_filename=$rootdir/etc/systemd/system/git_ssb.service else git_ssb_script_name=/usr/bin/git-ssb-create + git_ssb_daemon_filename=/etc/systemd/system/git_ssb.service fi echo '#!/bin/bash' > $git_ssb_script_name echo 'reponame="$1"' >> $git_ssb_script_name @@ -239,6 +241,24 @@ function git_ssb_script { echo 'fi' >> $git_ssb_script_name echo 'exit 0' >> $git_ssb_script_name chmod +x $git_ssb_script_name + + echo '[Unit]' > $git_ssb_daemon_filename + echo 'Description=Git SSB (SSB git web interface)' >> $git_ssb_daemon_filename + echo 'After=syslog.target' >> $git_ssb_daemon_filename + echo 'After=network.target' >> $git_ssb_daemon_filename + echo 'After=scuttlebot.target' >> $git_ssb_daemon_filename + echo '' >> $git_ssb_daemon_filename + echo '[Service]' >> $git_ssb_daemon_filename + echo 'Type=simple' >> $git_ssb_daemon_filename + echo 'User=scuttlebot' >> $git_ssb_daemon_filename + echo 'Group=scuttlebot' >> $git_ssb_daemon_filename + echo "WorkingDirectory=/etc/scuttlebot" >> $git_ssb_daemon_filename + echo "ExecStart=/usr/bin/git ssb web --public localhost:$GIT_SSB_PORT" >> $git_ssb_daemon_filename + echo 'Restart=always' >> $git_ssb_daemon_filename + echo 'Environment="USER=scuttlebot"' >> $git_ssb_daemon_filename + echo '' >> $git_ssb_daemon_filename + echo '[Install]' >> $git_ssb_daemon_filename + echo 'WantedBy=multi-user.target' >> $git_ssb_daemon_filename } function scuttlebot_git_setup { diff --git a/src/freedombone-image-mesh b/src/freedombone-image-mesh index e0598dc2..bd82476b 100755 --- a/src/freedombone-image-mesh +++ b/src/freedombone-image-mesh @@ -1289,7 +1289,7 @@ function mesh_setup_vpn { function initialise_scuttlebot_pub { chown -R scuttlebot:scuttlebot /etc/scuttlebot - systemctl enable scuttlebot.service + systemctl enable git_ssb.service systemctl daemon-reload systemctl start scuttlebot.service @@ -1328,6 +1328,8 @@ function initialise_scuttlebot_pub { if [ -f /etc/nginx/sites-available/git_ssb ]; then sed -i "s|server_name .*|server_name ${HOSTNAME}.local;|g" /etc/nginx/sites-available/git_ssb ln -s /etc/nginx/sites-available/git_ssb /etc/nginx/sites-enabled/git_ssb + systemctl enable scuttlebot.service + systemctl start git_ssb.service fi }