Sfoglia il codice sorgente

Start git-ssb daemon on mesh image

Bob Mottram 7 anni fa
parent
commit
1935deb53f
2 ha cambiato i file con 23 aggiunte e 1 eliminazioni
  1. 20
    0
      src/freedombone-app-scuttlebot
  2. 3
    1
      src/freedombone-image-mesh

+ 20
- 0
src/freedombone-app-scuttlebot Vedi File

@@ -224,8 +224,10 @@ function remove_scuttlebot {
224 224
 function git_ssb_script {
225 225
     if [[ "$1" == "mesh" ]]; then
226 226
         git_ssb_script_name=$rootdir/usr/bin/git-ssb-create
227
+        git_ssb_daemon_filename=$rootdir/etc/systemd/system/git_ssb.service
227 228
     else
228 229
         git_ssb_script_name=/usr/bin/git-ssb-create
230
+        git_ssb_daemon_filename=/etc/systemd/system/git_ssb.service
229 231
     fi
230 232
     echo '#!/bin/bash' > $git_ssb_script_name
231 233
     echo 'reponame="$1"' >> $git_ssb_script_name
@@ -239,6 +241,24 @@ function git_ssb_script {
239 241
     echo 'fi' >> $git_ssb_script_name
240 242
     echo 'exit 0' >> $git_ssb_script_name
241 243
     chmod +x $git_ssb_script_name
244
+
245
+    echo '[Unit]' > $git_ssb_daemon_filename
246
+    echo 'Description=Git SSB (SSB git web interface)' >> $git_ssb_daemon_filename
247
+    echo 'After=syslog.target' >> $git_ssb_daemon_filename
248
+    echo 'After=network.target' >> $git_ssb_daemon_filename
249
+    echo 'After=scuttlebot.target' >> $git_ssb_daemon_filename
250
+    echo '' >> $git_ssb_daemon_filename
251
+    echo '[Service]' >> $git_ssb_daemon_filename
252
+    echo 'Type=simple' >> $git_ssb_daemon_filename
253
+    echo 'User=scuttlebot' >> $git_ssb_daemon_filename
254
+    echo 'Group=scuttlebot' >> $git_ssb_daemon_filename
255
+    echo "WorkingDirectory=/etc/scuttlebot" >> $git_ssb_daemon_filename
256
+    echo "ExecStart=/usr/bin/git ssb web --public localhost:$GIT_SSB_PORT" >> $git_ssb_daemon_filename
257
+    echo 'Restart=always' >> $git_ssb_daemon_filename
258
+    echo 'Environment="USER=scuttlebot"' >> $git_ssb_daemon_filename
259
+    echo '' >> $git_ssb_daemon_filename
260
+    echo '[Install]' >> $git_ssb_daemon_filename
261
+    echo 'WantedBy=multi-user.target' >> $git_ssb_daemon_filename
242 262
 }
243 263
 
244 264
 function scuttlebot_git_setup {

+ 3
- 1
src/freedombone-image-mesh Vedi File

@@ -1289,7 +1289,7 @@ function mesh_setup_vpn {
1289 1289
 function initialise_scuttlebot_pub {
1290 1290
     chown -R scuttlebot:scuttlebot /etc/scuttlebot
1291 1291
 
1292
-    systemctl enable scuttlebot.service
1292
+    systemctl enable git_ssb.service
1293 1293
     systemctl daemon-reload
1294 1294
     systemctl start scuttlebot.service
1295 1295
 
@@ -1328,6 +1328,8 @@ function initialise_scuttlebot_pub {
1328 1328
     if [ -f /etc/nginx/sites-available/git_ssb ]; then
1329 1329
         sed -i "s|server_name .*|server_name ${HOSTNAME}.local;|g" /etc/nginx/sites-available/git_ssb
1330 1330
         ln -s /etc/nginx/sites-available/git_ssb /etc/nginx/sites-enabled/git_ssb
1331
+        systemctl enable scuttlebot.service
1332
+        systemctl start git_ssb.service
1331 1333
     fi
1332 1334
 }
1333 1335