better names for cosmic admin utils

This commit is contained in:
James Tomasino 2018-11-21 23:41:51 -05:00
parent 79b8b16c15
commit d15faeb607
3 changed files with 29 additions and 2 deletions

23
cosmic-ship Executable file
View File

@ -0,0 +1,23 @@
#!/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
printf "Creating ship '%s' for user '%s'\\n" "${s}" "${n}"
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
printf "You must be root to run this script.\\n"
fi

View File

@ -5,8 +5,12 @@ DIR="$( cd "$( dirname "$0" )" && pwd )"
# Fix path in case of symlinks
DIR=$(cd "$DIR" && pwd -P)
if [ ! -L "/usr/local/bin/cosmicuser" ]; then
ln -s "${DIR}/cosmicuser" "/usr/local/bin/cosmicuser"
if [ ! -L "/usr/local/bin/cosmic-user" ]; then
ln -s "${DIR}/cosmic-user" "/usr/local/bin/cosmic-user"
fi
if [ ! -L "/usr/local/bin/cosmic-ship" ]; then
ln -s "${DIR}/cosmic-ship" "/usr/local/bin/cosmic-ship"
fi
if [ ! -L "/usr/local/bin/log" ]; then