diff --git a/README.md b/README.md index d396f8a..419ae00 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,19 @@ If you want change the download repository # bash make-bootstrap-file.sh -u https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/testing ``` +To display the script's help information, use the -h option: + +```console +# bash make-bootstrap-file.sh -h +``` + +Why Root (Superuser) is Required ? +=================================== + +This script must be run as root (superuser) because it performs several critical operations that require administrative privileges. +The primary reason is the use of the **mknod** command to make device nodes (/dev/null, /dev/random, and /dev/urandom), +which is restricted to superusers due to security considerations. + License ======= diff --git a/make-bootstrap-file.sh b/make-bootstrap-file.sh index de42f67..2e0c883 100644 --- a/make-bootstrap-file.sh +++ b/make-bootstrap-file.sh @@ -4,16 +4,25 @@ set -e -u -o pipefail +# Check if the user is root (superuser) +if [[ $(id -u) -ne 0 ]]; then + echo "This script must be run as root (superuser) because it uses 'mknod' to make device nodes, which requires superuser privileges." + exit 1 +fi + +# Display usage message usage() { cat <