Create usage printing function

This commit is contained in:
B4S3D 2021-12-17 12:06:00 -06:00
parent 076542f12c
commit e9b4b2c062

View file

@ -19,7 +19,14 @@ ZEALDISK=
[ ! -f "$ZEALDISK" ] && echo "\$ZEALDISK is not a path to a file." && exit 1 [ ! -f "$ZEALDISK" ] && echo "\$ZEALDISK is not a path to a file." && exit 1
TMPMOUNT=/tmp/zealtmp TMPMOUNT=/tmp/zealtmp
USAGE="Usage: $0 [ repo | vm ] \n\n repo - overwrites src/ with virtual disk contents.\n vm - overwrites virtual disk with src/ contents.\n"
print_usage() {
echo "Usage: $0 [ repo | vm ]"
echo
echo "repo - overwrites src/ with virtual disk contents."
echo "vm - overwrites virtual disk with src/ contents."
echo
}
mount_vdisk() { mount_vdisk() {
echo "Mounting virtual disk..." echo "Mounting virtual disk..."
@ -38,7 +45,7 @@ umount_vdisk() {
if [ -z $1 ] if [ -z $1 ]
then then
echo $USAGE print_usage
else else
sudo modprobe nbd sudo modprobe nbd
[ ! -d $TMPMOUNT ] && mkdir $TMPMOUNT [ ! -d $TMPMOUNT ] && mkdir $TMPMOUNT
@ -71,7 +78,7 @@ else
;; ;;
*) *)
echo "Unknown action." echo "Unknown action."
echo $USAGE print_usage
;; ;;
esac esac
fi fi