brendotools-wallman/wpset-setup

60 lines
1.8 KiB
Bash

#!/bin/bash
source parse
git checkout tags/$DOWNLOAD_VERSION
# setting USER variable
USER=$(logname)
# root check
ROOT=$(whoami)
if [ "$ROOT" != "root" ]; then
echo "an error occurred while checking for root permissions: DONT_HAVE_EM_CHIEF"
echo "(try re-running this script with sudo.)"
exit
fi
if [ "$1" = "-u" ]; then
exit
fi
# location where config file will reside.
# DO NOT CHANGE AS THIS IS HARD-CODED INTO
# ALL THE SCRIPTS AND ***BY GOD*** WILL IT BE A NIGHTMARE TO CHANGE.
CONFIG="/home/$USER/.config/wpdl.conf"
# the actual fuckin question asking... thing
echo "wpset setup script v$VERSION"
sleep 2
clear
echo "thanks for choosing wpdl - brendan's stupidly over-engineered wallpaper manager."
echo "this script will install wpset, as well as help you set up your config file."
echo ""
echo "what folder on the SMB share are your wallpapers stored?"
echo -n "i.e: brendo/Wallpapers: "
read SMBFOLDER
echo -n "what ssh user will we use to establish a tunnel? "
read SSH_USER
echo -n "what host will we connect to over ssh? "
read SSH_HOST
echo -n "what do you want me to call your SMB host? "
read HOST_DISP
echo "that's all i need! creating config file at $CONFIG..."
# let's write the config file.
echo "#!/bin/bash" >> $CONFIG
echo "SMBFOLDER=\"$SMBFOLDER\"" >> $CONFIG
echo "HOST=\"localhost\"" >> $CONFIG
echo "SSH_USER=\"$SSH_USER\"" >> $CONFIG
echo "SSH_HOST=\"$SSH_HOST\"" >> $CONFIG
echo "HOST_DISP=\"$HOST_DISP\"" >> $CONFIG
echo "WALL_LOC=\"/home/$USER/wallpaper\"" >> $CONFIG
echo "LASTWP_LOC=\"\$WALL_LOC/.lastwp\"" >> $CONFIG
echo "LAST=\$(cat /home/$USER/wallpaper/.lastwp)" >> $CONFIG
chown $USER:$USER $CONFIG
echo "done! now let's chuck wpset in /bin/..."
echo wpset | sed "s/VERSION\=\"\"/VERSION\=\"$DOWNLOAD_VERSION\""
mv wpset /bin/wpset
mkdir -p /etc/wpdl
mv parse /etc/wpdl/parse
echo "done! goodbye."