]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
Fix Issue #1825 (#1826)
authorHenrique <jhbs.student@gmail.com>
Mon, 12 Sep 2022 15:18:12 +0000 (12:18 -0300)
committerGitHub <noreply@github.com>
Mon, 12 Sep 2022 15:18:12 +0000 (23:18 +0800)
the modifications verify user privilege and prevent improper script execution.

INSTALL/CreatePersistentImg.sh

index 1dc90e6d2c5f74581ffe06fd791aaeedf2d8ea85..21d65c47bf1fd48610e2e630ee834fdeadfff79a 100644 (file)
@@ -18,6 +18,18 @@ print_usage() {
     echo ''
 }
 
     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
 while [ -n "$1" ]; do
     if [ "$1" = "-s" ]; then
         shift