Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
May 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions INSTALL/ExtendPersistentImg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ print_usage() {
echo 'Usage: ExtendPersistentImg.sh file size'
echo ' file persistent dat file'
echo ' size extend size in MB'
echo 'Example:'
echo ' sh ExtendPersistentImg.sh ubuntu.dat 2048'
echo 'Examples:'
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 ''
}

Expand All @@ -19,6 +20,11 @@ if [ -z "$2" ]; then
exit 1
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
shift
Expand Down