Bladeren bron

Per user ipfs daemon

Bob Mottram 8 jaren geleden
bovenliggende
commit
a1c6079341
2 gewijzigde bestanden met toevoegingen van 16 en 35 verwijderingen
  1. 16
    18
      src/freedombone-app-ipfs
  2. 0
    17
      src/freedombone-image-mesh

+ 16
- 18
src/freedombone-app-ipfs Bestand weergeven

421
         exit 63722
421
         exit 63722
422
     fi
422
     fi
423
 
423
 
424
-    echo '[Unit]' > ${rootdir}/etc/systemd/system/ipfs.service
425
-    echo 'Description=IPFS go daemon' >> ${rootdir}/etc/systemd/system/ipfs.service
426
-    echo 'After=syslog.target' >> ${rootdir}/etc/systemd/system/ipfs.service
427
-    echo 'After=network.target' >> ${rootdir}/etc/systemd/system/ipfs.service
428
-    echo '' >> ${rootdir}/etc/systemd/system/ipfs.service
429
-    echo '[Service]' >> ${rootdir}/etc/systemd/system/ipfs.service
430
-    echo 'Type=simple' >> ${rootdir}/etc/systemd/system/ipfs.service
431
-    echo "User=$MY_USERNAME" >> ${rootdir}/etc/systemd/system/ipfs.service
432
-    echo "Group=$MY_USERNAME" >> ${rootdir}/etc/systemd/system/ipfs.service
433
-    echo "WorkingDirectory=/home/$MY_USERNAME" >> ${rootdir}/etc/systemd/system/ipfs.service
434
-    echo "ExecStart=$IPFS_PATH/ipfs daemon --mount" >> ${rootdir}/etc/systemd/system/ipfs.service
435
-    echo 'Restart=on-failure' >> ${rootdir}/etc/systemd/system/ipfs.service
436
-    echo "Environment=\"USER=$MY_USERNAME\" \"HOME=/home/$MY_USERNAME\" \"GOPATH=/home/go/go${GO_VERSION}\"" >> ${rootdir}/etc/systemd/system/ipfs.service
437
-    echo '' >> ${rootdir}/etc/systemd/system/ipfs.service
438
-    echo '[Install]' >> ${rootdir}/etc/systemd/system/ipfs.service
439
-    echo 'WantedBy=multi-user.target' >> ${rootdir}/etc/systemd/system/ipfs.service
440
-
441
-    chroot ${rootdir} systemctl enable ipfs
424
+    IPFS_USER_DAEMON=${rootdir}/home/${MY_USERNAME}/.config/systemd/user/ipfs.service
425
+    mkdir -p $IPFS_USER_DAEMON
426
+
427
+    echo '[Unit]' > $IPFS_USER_DAEMON
428
+    echo 'Description=IPFS go daemon' >> $IPFS_USER_DAEMON
429
+    echo '' >> $IPFS_USER_DAEMON
430
+    echo '[Service]' >> $IPFS_USER_DAEMON
431
+    echo "ExecStart=$IPFS_PATH/ipfs daemon" >> $IPFS_USER_DAEMON
432
+    echo 'Restart=on-failure' >> $IPFS_USER_DAEMON
433
+    echo 'RestartSec=10' >> $IPFS_USER_DAEMON
434
+    echo '' >> $IPFS_USER_DAEMON
435
+    echo '[Install]' >> $IPFS_USER_DAEMON
436
+    echo 'WantedBy=default.target' >> $IPFS_USER_DAEMON
437
+    chroot ${rootdir} chown $MY_USERNAME:$MY_USERNAME /home/${MY_USERNAME}/.config/systemd/user/ipfs.service
438
+
439
+    chroot ${rootdir} systemctl --user enable ipfs
442
 }
440
 }
443
 
441
 
444
 function install_ipfs_go {
442
 function install_ipfs_go {

+ 0
- 17
src/freedombone-image-mesh Bestand weergeven

754
         return
754
         return
755
     fi
755
     fi
756
 
756
 
757
-    # directories to mount to
758
-    if [ ! -d /ipfs ]; then
759
-        mkdir /ipfs
760
-        mkdir /ipns
761
-        chown $MY_USERNAME:$MY_USERNAME /ipfs
762
-        chown $MY_USERNAME:$MY_USERNAME /ipns
763
-    fi
764
-
765
-    if [ -f /etc/fuse.conf ]; then
766
-        chown $MY_USERNAME:$MY_USERNAME /etc/fuse.conf
767
-    fi
768
-    if [ -f /dev/fuse ]; then
769
-        chown $MY_USERNAME:$MY_USERNAME /dev/fuse
770
-    fi
771
-
772
-    # TODO in avahi service for ipfs replace IPFS_PEER_ID
773
-
774
     echo 'IPFS installed with ID $IPFS_PEER_ID' >> $INSTALL_LOG
757
     echo 'IPFS installed with ID $IPFS_PEER_ID' >> $INSTALL_LOG
775
 }
758
 }
776
 
759