Per user ipfs daemon

This commit is contained in:
Bob Mottram 2016-09-03 17:03:23 +01:00
parent 391f92a1d4
commit a1c6079341
2 changed files with 15 additions and 34 deletions

View File

@ -421,24 +421,22 @@ function mesh_install_ipfs_go {
exit 63722 exit 63722
fi fi
echo '[Unit]' > ${rootdir}/etc/systemd/system/ipfs.service IPFS_USER_DAEMON=${rootdir}/home/${MY_USERNAME}/.config/systemd/user/ipfs.service
echo 'Description=IPFS go daemon' >> ${rootdir}/etc/systemd/system/ipfs.service mkdir -p $IPFS_USER_DAEMON
echo 'After=syslog.target' >> ${rootdir}/etc/systemd/system/ipfs.service
echo 'After=network.target' >> ${rootdir}/etc/systemd/system/ipfs.service
echo '' >> ${rootdir}/etc/systemd/system/ipfs.service
echo '[Service]' >> ${rootdir}/etc/systemd/system/ipfs.service
echo 'Type=simple' >> ${rootdir}/etc/systemd/system/ipfs.service
echo "User=$MY_USERNAME" >> ${rootdir}/etc/systemd/system/ipfs.service
echo "Group=$MY_USERNAME" >> ${rootdir}/etc/systemd/system/ipfs.service
echo "WorkingDirectory=/home/$MY_USERNAME" >> ${rootdir}/etc/systemd/system/ipfs.service
echo "ExecStart=$IPFS_PATH/ipfs daemon --mount" >> ${rootdir}/etc/systemd/system/ipfs.service
echo 'Restart=on-failure' >> ${rootdir}/etc/systemd/system/ipfs.service
echo "Environment=\"USER=$MY_USERNAME\" \"HOME=/home/$MY_USERNAME\" \"GOPATH=/home/go/go${GO_VERSION}\"" >> ${rootdir}/etc/systemd/system/ipfs.service
echo '' >> ${rootdir}/etc/systemd/system/ipfs.service
echo '[Install]' >> ${rootdir}/etc/systemd/system/ipfs.service
echo 'WantedBy=multi-user.target' >> ${rootdir}/etc/systemd/system/ipfs.service
chroot ${rootdir} systemctl enable ipfs echo '[Unit]' > $IPFS_USER_DAEMON
echo 'Description=IPFS go daemon' >> $IPFS_USER_DAEMON
echo '' >> $IPFS_USER_DAEMON
echo '[Service]' >> $IPFS_USER_DAEMON
echo "ExecStart=$IPFS_PATH/ipfs daemon" >> $IPFS_USER_DAEMON
echo 'Restart=on-failure' >> $IPFS_USER_DAEMON
echo 'RestartSec=10' >> $IPFS_USER_DAEMON
echo '' >> $IPFS_USER_DAEMON
echo '[Install]' >> $IPFS_USER_DAEMON
echo 'WantedBy=default.target' >> $IPFS_USER_DAEMON
chroot ${rootdir} chown $MY_USERNAME:$MY_USERNAME /home/${MY_USERNAME}/.config/systemd/user/ipfs.service
chroot ${rootdir} systemctl --user enable ipfs
} }
function install_ipfs_go { function install_ipfs_go {

View File

@ -754,23 +754,6 @@ function setup_ipfs {
return return
fi fi
# directories to mount to
if [ ! -d /ipfs ]; then
mkdir /ipfs
mkdir /ipns
chown $MY_USERNAME:$MY_USERNAME /ipfs
chown $MY_USERNAME:$MY_USERNAME /ipns
fi
if [ -f /etc/fuse.conf ]; then
chown $MY_USERNAME:$MY_USERNAME /etc/fuse.conf
fi
if [ -f /dev/fuse ]; then
chown $MY_USERNAME:$MY_USERNAME /dev/fuse
fi
# TODO in avahi service for ipfs replace IPFS_PEER_ID
echo 'IPFS installed with ID $IPFS_PEER_ID' >> $INSTALL_LOG echo 'IPFS installed with ID $IPFS_PEER_ID' >> $INSTALL_LOG
} }