added ship deleter
This commit is contained in:
parent
50b1255158
commit
bc98d66398
32
bin/cosmic-rmship
Executable file
32
bin/cosmic-rmship
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/sh
|
||||
|
||||
run_user=$(id -u)
|
||||
if [ "$run_user" -eq 0 ]; then
|
||||
n="$1"
|
||||
s="$2"
|
||||
if [ ! -z "$n" ]; then
|
||||
user_exists=$(id -u "${n}" 2> /dev/null)
|
||||
if [ ! -z "${user_exists}" ]; then
|
||||
if [ ! -z "${s}" ]; then
|
||||
path="/var/gopher/${s}"
|
||||
if [ -d "$path" ]; then
|
||||
printf "Removing ship '%s' for user '%s'\\n" "${s}" "${n}"
|
||||
rm -rf "$path"
|
||||
rm -rf "/var/gopher/ships/${s}"
|
||||
rm "/home/${n}/ships/${s}"
|
||||
else
|
||||
printf "No ship by that name exists.\\n"
|
||||
fi
|
||||
else
|
||||
printf "Specificy a ship or colony name.\\n"
|
||||
fi
|
||||
else
|
||||
printf "User not found.\\n"
|
||||
fi
|
||||
else
|
||||
printf "Specify a user.\\n"
|
||||
fi
|
||||
else
|
||||
exec sudo "$0" "$@"
|
||||
fi
|
||||
|
19
install.sh
19
install.sh
|
@ -9,14 +9,8 @@ DIR=$(cd "$DIR" && pwd -P)
|
|||
if [ ! -L "/usr/local/bin/cosmic-user" ]; then
|
||||
ln -s "${DIR}/bin/cosmic-user" "/usr/local/bin/cosmic-user"
|
||||
fi
|
||||
if [ ! -L "/usr/local/bin/cosmic-rss" ]; then
|
||||
ln -s "${DIR}/bin/cosmic-rss" "/usr/local/bin/cosmic-rss"
|
||||
fi
|
||||
if [ ! -L "/usr/local/bin/cosmic-web" ]; then
|
||||
ln -s "${DIR}/bin/cosmic-web" "/usr/local/bin/cosmic-web"
|
||||
fi
|
||||
if [ ! -L "/usr/local/bin/cosmic-ship" ]; then
|
||||
ln -s "${DIR}/bin/cosmic-ship" "/usr/local/bin/cosmic-ship"
|
||||
if [ ! -L "/usr/local/bin/cosmic-rmship" ]; then
|
||||
ln -s "${DIR}/bin/cosmic-rmship" "/usr/local/bin/cosmic-rmship"
|
||||
fi
|
||||
|
||||
# User runnable commands
|
||||
|
@ -32,6 +26,15 @@ fi
|
|||
if [ ! -L "/usr/local/bin/log" ]; then
|
||||
ln -s "${DIR}/bin/cosmic-log" "/usr/local/bin/log"
|
||||
fi
|
||||
if [ ! -L "/usr/local/bin/cosmic-ship" ]; then
|
||||
ln -s "${DIR}/bin/cosmic-ship" "/usr/local/bin/cosmic-ship"
|
||||
fi
|
||||
if [ ! -L "/usr/local/bin/cosmic-rss" ]; then
|
||||
ln -s "${DIR}/bin/cosmic-rss" "/usr/local/bin/cosmic-rss"
|
||||
fi
|
||||
if [ ! -L "/usr/local/bin/cosmic-web" ]; then
|
||||
ln -s "${DIR}/bin/cosmic-web" "/usr/local/bin/cosmic-web"
|
||||
fi
|
||||
|
||||
# Files
|
||||
if [ ! -L "/etc/welcomemail.tmpl" ]; then
|
||||
|
|
Loading…
Reference in New Issue
Block a user