Skip to content

Commit

Permalink
linux: warn root install
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Dec 26, 2023
1 parent 4bf2c0b commit 6c2db07
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions install/local/install-scrypted-dependencies-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@ then
exit 1
fi

function readyn() {
while true; do
read -p "$1 (y/n) " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no. (y/n)";;
esac
done
}

if [ "$SERVICE_USER" == "root" ]
then
readyn "Scrypted will store its files in the root user home directory. Running as a non-root user is recommended. Are you sure?"
if [ "$yn" == "n" ]
then
exit 1
fi
fi

echo "Stopping existing service if it is running..."
systemctl stop scrypted.service

Expand Down Expand Up @@ -56,12 +76,6 @@ then
exit 0
fi

if [ "$SERVICE_USER" == "root" ]
then
echo "Scrypted SERVICE_USER root is not allowed."
exit 1
fi

# this is not RUN as we do not care about the result
USER_HOME=$(eval echo ~$SERVICE_USER)
echo "Setting permissions on $USER_HOME/.scrypted"
Expand Down

0 comments on commit 6c2db07

Please sign in to comment.