Smart iSCSI Mounter v0.97.1

- Improved handling of input args.
This commit is contained in:
2020-05-23 14:37:12 +01:00
parent 4f042de02f
commit 3fae36c374
+19 -11
View File
@@ -24,7 +24,6 @@ show_usage (){
echo "Additional Options:" echo "Additional Options:"
echo "'-s (--status)'" echo "'-s (--status)'"
echo "'-r (--release)'" echo "'-r (--release)'"
exit 1;
} }
report_status (){ report_status (){
@@ -100,41 +99,50 @@ check_admin (){
} }
# Process input parameters # Process input parameters
while (( "$#" )); do for arg in "$@"; do
case "$2" in case "$arg" in
-f|--force) -f|--force)
_FLAG_FORCE=1 _FLAG_FORCE=1
;; shift
esac ;;
case "$1" in
-m|--mount) -m|--mount)
check_admin check_admin
read_iscsi_con read_iscsi_con
mount_func mount_func
shift
;; ;;
-u|--umount) -u|--umount)
check_admin check_admin
read_iscsi_con read_iscsi_con
umount_func umount_func
shift
;; ;;
-s|--status) -s|--status)
echo "[Showing status of mount-point]" echo "[Showing status of mount-point]"
check_admin check_admin
read_iscsi_con read_iscsi_con
report_status report_status
shift
;; ;;
-r|--release) -r|--release)
echo "Smart iSCSI Mounter v0.97" echo "Smart iSCSI Mounter v0.97.1"
shift
;; ;;
-*) -h|--help)
show_usage show_usage
shift
;;
-q|--quiet)
echo "Quiet"
shift
;; ;;
esac esac
exit 0; done
done
# Show usage if no parameters have been passed # Show usage if no parameters have been passed
if [[ $# -eq 0 ]] if [[ $# -eq 0 ]]
then then
show_usage show_usage
fi fi
exit 0;