ipfs_daemon/remove
6543 1841508b68 create remove and purge script
rename install script
2018-03-14 22:51:31 +01:00

23 lines
666 B
Bash
Executable File

#!/bin/bash
# Licence GPL 3
[ "`id -u`" != "0" ] && { echo run as root; exit 1; }
############################
## if daemon skript exist ##
############################
[ -f /etc/init.d/ipfs ] &&{
DAEMON=`cat /etc/init.d/ipfs | grep DAEMON= | sed 's/DAEMON=//g'`
IPFS_PID_FILE=`cat /etc/init.d/ipfs | grep IPFS_PID_FILE= | sed 's/IPFS_PID_FILE=//g'`
IPFS_UID=`cat /etc/init.d/ipfs | grep IPFS_UID= | sed 's/IPFS_UID=//g'`
IPFS_User=`id $IPFS_UID | cut -d "(" -f 2 | cut -d ")" -f 1`
[ -f "$DAEMON" ] && rm "$DAEMON"
[ -f "$IPFS_PID_FILE" ] && rm "$DAEMON"
sudo deluser $IPFS_User --remove-home
update-rc.d -f ipfs remove
rm /etc/init.d/ipfs
}