mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-08-10 05:37:41 +00:00
Prevent root from running the enter.sh helper script (#4216)
* Prevent root from running the enter.sh helper script Since configure doesn't like being ran as root, check in the enter.sh script that the user running it is not UID/GID 0. The script itself takes care of running what needs to be executed privileged with explicit sudo commands. Fixes #4214 * Reword the error message Co-authored-by: Stefan Agner <stefan@agner.ch>
This commit is contained in:
parent
e7f314273d
commit
4c09ceb656
@ -7,6 +7,11 @@ CACHE_DIR="${CACHE_DIR:-$HOME/hassos-cache}"
|
|||||||
ARGS="$*"
|
ARGS="$*"
|
||||||
COMMAND="${ARGS:-bash}"
|
COMMAND="${ARGS:-bash}"
|
||||||
|
|
||||||
|
if [ "$BUILDER_UID" -eq "0" ] || [ "$BUILDER_GID" == "0" ]; then
|
||||||
|
echo "ERROR: Please run this script as a regular (non-root) user with sudo privileges."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
sudo mkdir -p "${CACHE_DIR}"
|
sudo mkdir -p "${CACHE_DIR}"
|
||||||
sudo chown -R "${BUILDER_UID}:${BUILDER_GID}" "${CACHE_DIR}"
|
sudo chown -R "${BUILDER_UID}:${BUILDER_GID}" "${CACHE_DIR}"
|
||||||
sudo docker build -t hassos:local .
|
sudo docker build -t hassos:local .
|
||||||
|
Loading…
x
Reference in New Issue
Block a user