Unverified Commit b8838b30 authored by Zhymabek Roman's avatar Zhymabek Roman Committed by GitHub
Browse files

Adding root user check to ExtendPersistentImg (as in CreatePersistentImg) (#2633)

* Adding root user check & Enhance help info

* Update root user check
parent 00de8b93
...@@ -4,8 +4,9 @@ print_usage() { ...@@ -4,8 +4,9 @@ print_usage() {
echo 'Usage: ExtendPersistentImg.sh file size' echo 'Usage: ExtendPersistentImg.sh file size'
echo ' file persistent dat file' echo ' file persistent dat file'
echo ' size extend size in MB' echo ' size extend size in MB'
echo 'Example:' echo 'Examples:'
echo ' sh ExtendPersistentImg.sh ubuntu.dat 2048' echo ' sh ExtendPersistentImg.sh ubuntu.dat 2048 - This command would extend ubuntu.dat by 2048MB (2GB)'
echo ' sh ExtendPersistentImg.sh ubuntu.dat -2048 - This command reduces ubuntu.dat by 2048MB (-2GB)'
echo '' echo ''
} }
...@@ -19,6 +20,11 @@ if [ -z "$2" ]; then ...@@ -19,6 +20,11 @@ if [ -z "$2" ]; then
exit 1 exit 1
fi fi
uid=$(id -u)
if [ $uid -ne 0 ]; then
print_err "Please use sudo or run the script as root."
exit 1
fi
if [ "$1" = "__vbash__" ]; then if [ "$1" = "__vbash__" ]; then
shift shift
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment