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

32 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Licence GPL 3
[ "`id -u`" != "0" ] && { echo run as root; exit 1; }
############################
## if daemon skript exist ##
############################
if [ -f /etc/init.d/ipfs ] ; then
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_DATA=`cat /etc/init.d/ipfs | grep IPFS_DATA= | sed 's/IPFS_DATA=//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"
[ -d "$IPFS_DATA" ] && rm -R "$IPFS_DATA"
sudo deluser $IPFS_User --remove-home
update-rc.d -f ipfs remove
rm /etc/init.d/ipfs
###################################
## if daemon didnt exist anymore ##
###################################
else
## del if default files/folders found
[ -f "/usr/local/bin/ipfs" ] && rm "/usr/local/bin/ipfs"
[ -d "/var/spool/ipfs/" ] && rm -R "/var/spool/ipfs/"
fi