From: Henrique Date: Mon, 12 Sep 2022 15:18:12 +0000 (-0300) Subject: Fix Issue #1825 (#1826) X-Git-Tag: v1.0.80~13 X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/Ventoy.git/commitdiff_plain/ff3ce4da6665db0278907570309782295b21f5cc Fix Issue #1825 (#1826) the modifications verify user privilege and prevent improper script execution. --- diff --git a/INSTALL/CreatePersistentImg.sh b/INSTALL/CreatePersistentImg.sh index 1dc90e6..21d65c4 100644 --- a/INSTALL/CreatePersistentImg.sh +++ b/INSTALL/CreatePersistentImg.sh @@ -18,6 +18,18 @@ print_usage() { echo '' } +print_err() { + echo "" + echo "$*" + echo "" +} + +uid=$(id -u) +if [ $uid -ne 0 ]; then + print_err "Please use sudo or run the script as root." + exit 1 +fi + while [ -n "$1" ]; do if [ "$1" = "-s" ]; then shift