diff options
author | Casper <me@skylarcloud.xyz> | 2024-12-23 17:13:45 -0700 |
---|---|---|
committer | Casper <me@skylarcloud.xyz> | 2024-12-23 17:13:45 -0700 |
commit | 01a33ab0913d439150065ac23644c4f140ff8917 (patch) | |
tree | 9ad71bd7e6f5a5aad2c2cdbff4bb75de12565998 /qmenu/qmenu_vm/fqvm_volume | |
parent | 7b5a0e9e88f015cb68a46bb657661f4663e287af (diff) |
added qmenu!
Diffstat (limited to 'qmenu/qmenu_vm/fqvm_volume')
-rw-r--r-- | qmenu/qmenu_vm/fqvm_volume | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/qmenu/qmenu_vm/fqvm_volume b/qmenu/qmenu_vm/fqvm_volume new file mode 100644 index 0000000..8b762e0 --- /dev/null +++ b/qmenu/qmenu_vm/fqvm_volume @@ -0,0 +1,26 @@ +qube_class=$(qvm-ls --raw-data -O flags "$qube" | cut -c 1) + +if [ "$qube_class" = t ] || [ "$qube_class" = s ] || [ "$qube_class" = S ]; then + + volume=$(printf 'Root\nPrivate' | dmenu-unlinked -l 2 -i -p "$qube:" | awk '{print tolower($0)}') +else + volume=private +fi + +if [ -n "$volume" ]; then + + current_storage=$(( $(qvm-volume info "$qube:$volume" size) / 1048576 )) + + mebibyte=$(echo "$current_storage" | dmenu-unlinked -p "Enter the maximum size of $volume storage in MiB to be allocated to $qube:") && + + if [ "$mebibyte" -gt "$current_storage" ]; then + + byte=$(( mebibyte * 1048576 )) + + nyprompt "Increase the maximum $volume storage size of $qube from $current_storage MiB to $mebibyte MiB?" && + + (qvm-volume extend "$qube:$volume" "$byte"&) + else + echo Go back... | dmenu-unlinked -p "Warning: Unable to decrease the maximum $volume storage!" > /dev/null 2>&1 + fi +fi |