install-reddit: Don't sudo inside install-reddit, require it outside

Previously, install-reddit.sh ran install/reddit.sh with sudo. This
confused install.cfg when install-reddit.sh was itself run with sudo
because the inner sudo would cause $SUDO_USER to erroneously be root.
install-reddit.sh _should_ be run as sudo so that when it prints out
install.cfg the values are accurate, but should not run
install/reddit.sh with an additional sudo since that'll mess things up.
This commit is contained in:
Neil Williams
2016-02-26 11:47:07 -08:00
parent 25761e50fb
commit 23cbcd3bbf

View File

@@ -22,6 +22,11 @@
###############################################################################
set -e
if [[ $EUID -ne 0 ]]; then
echo "ERROR: Must be run with root privileges."
exit 1
fi
# load configuration
RUNDIR=$(dirname $0)
SCRIPTDIR="$RUNDIR/install"
@@ -95,6 +100,6 @@ important "but the easiest thing is probably editing /etc/hosts on the host mach
echo
read -er -n1 -p "proceed? [Y/n]" response
if [[ $response =~ ^[Yy]$ || $response == "" ]]; then
echo "Excellent. Here we go. We're going to need sudo for this one:"
sudo $SCRIPTDIR/reddit.sh
echo "Excellent. Here we go!"
$SCRIPTDIR/reddit.sh
fi