aboutsummaryrefslogtreecommitdiffstats
path: root/make-bootstrap-file.sh
diff options
context:
space:
mode:
Diffstat (limited to 'make-bootstrap-file.sh')
-rw-r--r--make-bootstrap-file.sh28
1 files changed, 20 insertions, 8 deletions
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 <<EOF
- Usage:
- bash $0 make-bootstrap-file.sh
- or
- bash $0 make-bootstrap-file.sh --arch i686 --release v0.4.3 --url https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/stable
- or
- bash $0 make-bootstrap-file.sh -a i686 -r v0.4.3 -u https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/stable
+Usage: bash $0 [options]
+
+Options:
+ -a, --arch ARCH Specify architecture (default: x86_64)
+ -r, --release VERSION Specify version (default: v0.4.3)
+ -u, --url URL Specify repository URL (default: https://mirror.fsf.org/hyperbola/gnu-plus-linux-libre/stable)
+ -owu, --owner-user-id ID Owner user ID for the tar file (default: 1000)
+ -owg, --owner-group-id ID Owner group ID for the tar file (default: 1000)
+ -h, --help Display this help message
EOF
- exit 1
}
SCRIPT=$(readlink -f "$0")
@@ -51,9 +60,12 @@ while [[ $# -gt 0 ]]; do
TAR_OWNER_GROUP_ID="${2}"
shift 2
;;
+ -h|--help)
+ usage && exit 0
+ ;;
*)
echo "Unrecognized option: $key"
- usage
+ usage && exit 1
;;
esac
done