]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - INSTALL/CreatePersistentImg.sh
Fix the order issue in TreeView mode. (#3218)
[Ventoy.git] / INSTALL / CreatePersistentImg.sh
index 3041873f4482618c2813dc8bd194c53b9197a8c9..21d65c47bf1fd48610e2e630ee834fdeadfff79a 100644 (file)
@@ -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
@@ -56,10 +68,15 @@ fi
 
 # check size
 if echo $size | grep -q "^[0-9][0-9]*$"; then
-    if [ $size -le 1 ]; then
-        echo "Invalid size $size"
-        exit 1
+    vtMinSize=1
+    if echo $fstype | grep -q '^xfs$'; then
+        vtMinSize=16
     fi
+    
+    if [ $size -lt $vtMinSize ]; then
+        echo "size too small ($size)"
+        exit 1
+    fi    
 else
     echo "Invalid size $size"
     exit 1