Added a position shift for script arguments, simplified conditional case
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_ROOT=$(dirname "$0")
|
||||
# @TODO: Implement more soft-coding and interactivity to this script
|
||||
ZFS_POOL_NAME="media"
|
||||
ZFS_COMPAT="openzfs-2.1-linux"
|
||||
@@ -61,14 +62,16 @@ create_datasets () {
|
||||
}
|
||||
|
||||
print_menu () {
|
||||
echo "Placeholder content"
|
||||
echo "$(<"${SCRIPT_ROOT}"/zfs-media-drive.help)"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [ -z "$1" ] && [ "$1" == "init" ]; then
|
||||
if [ -n "$1" ] && [ "$1" == "init" ]; then
|
||||
shift
|
||||
|
||||
while getopts "d:p:k:f:c:v:" opt; do
|
||||
case $opt in
|
||||
k) ZFS_KEY_LOC="${OPTARG}";;
|
||||
@@ -82,7 +85,7 @@ if ! [ -z "$1" ] && [ "$1" == "init" ]; then
|
||||
done
|
||||
|
||||
if [ -z "$ZFS_TARGET_DRIVE" ]; then
|
||||
echo "It is necessary to argue a -d option."
|
||||
echo "Error: It is necessary to argue a -d option."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user