Skip to content

Commit

Permalink
build-rootfs.sh: check for root
Browse files Browse the repository at this point in the history
Signed-off-by: gbionescu <[email protected]>
  • Loading branch information
gbionescu committed Sep 4, 2024
1 parent bf12a9a commit c0b1d33
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion build-rootfs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/bash
set -e

# Check if root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi

SCRIPT_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
RPATH="$SCRIPT_DIR/rootfs.ext4"

Expand All @@ -19,7 +26,7 @@ while getopts "h?s" opt; do
exit 0
;;
s)
echo "Disable sparse file creation."
echo "Disabled sparse file creation."
SPARSE=0
shift
;;
Expand Down

0 comments on commit c0b1d33

Please sign in to comment.