Start git-ssb daemon on mesh image

This commit is contained in:
Bob Mottram 2017-12-16 15:21:01 +00:00
parent 816bded661
commit 1935deb53f
2 changed files with 23 additions and 1 deletions

View File

@ -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 {

View File

@ -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
}