Rework step options handling

This commit is contained in:
2022-12-12 11:16:26 +01:00
parent 44ae559918
commit 1f431daa16
30 changed files with 120 additions and 120 deletions

View File

@@ -78,7 +78,6 @@ step_1_info() {
# Shift away args
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
echoinfoArgs "[OPTIONS] [SD CARD DEVICE] [HD DEVICE]"
echo "Download latest Raspberry Pi OS lite image $PIARCH"
if contextExe; then
echoinfo "Download URL: $PIDOWNURL"
@@ -87,6 +86,7 @@ step_1_info() {
echoinfo " -a, --arch : armhf (default), arm64"
fi
}
step_1_options() { echo "[OPTIONS] [SD CARD DEVICE] [HD DEVICE]"; }
step_1_alias() { echo "setup"; }
step_1() {
# Shift away args
@@ -112,11 +112,11 @@ step_2_info() {
# Shift away args
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
echoinfoArgs "[OPTIONS] [SD CARD DEVICE]"
echo "Write Raspberry Pi OS image to SD card"
echoinfo "This operation will delete all data previously on the SD card!"
contextExe && [ -n "${1:-}" ] && echoinfo " [SD CARD DEVICE]: $1"
}
step_2_options() { echo "[OPTIONS] [SD CARD DEVICE]"; }
step_2_alias() { echo "writesd"; }
step_2() {
# Shift away args
@@ -155,12 +155,12 @@ step_3_info() {
# Shift away args
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
echoinfoArgs "[SD CARD DEVICE]"
echo "Prepare SD for first run"
if contextExe; then
[ -n "${1:-}" ] && echoinfo " [SD CARD DEVICE]: $1"
fi
}
step_3_options() { echo "[SD CARD DEVICE]"; }
step_3() {
# Shift away args
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
@@ -219,13 +219,13 @@ step_4_info() {
# Shift away args
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
echoinfoArgs "[SD CARD DEVICE] [HD DEVICE]"
echo "Prepare SD card to boot from hard disk"
if contextExe; then
[ -n "${1:-}" ] && echoinfo " [SD CARD DEVICE]: $1"
[ -n "${2:-}" ] && echoinfo " [HD DEVICE]: $2"
fi
}
step_4_options() { echo "[SD CARD DEVICE] [HD DEVICE]"; }
step_4_alias() { echo "hdboot"; }
step_4() {
# Shift away args
@@ -290,7 +290,6 @@ step_5_info() {
# Shift away args
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
echoinfoArgs "[SD CARD DEVICE] [HD DEVICE]"
echo "Prepare HD for boot (TODO)"
if contextExe; then
@@ -298,6 +297,7 @@ step_5_info() {
[ -n "${2:-}" ] && echoinfo " [HD DEVICE]: $2"
fi
}
step_5_options() { echo "[SD CARD DEVICE] [HD DEVICE]"; }
step_5() {
# Shift away args
shift; local lArgs=( "$@" ); evalArgs "${lArgs[@]}"; shift $?
@@ -452,7 +452,8 @@ step_20() {
}
rpiSwapFile="/var/swap"
step_22_info() { echoinfoArgs "[SD CARD DEVICE]"; echo "Resize second SD card partition"; }
step_22_info() { echo "Resize second SD card partition"; }
step_22_options() { echo "[SD CARD DEVICE]"; }
step_22_alias() { echo "resizesd"; }
step_22() {
shift
@@ -481,11 +482,11 @@ step_22() {
}
step_24_info() {
echoinfoArgs "[OPTION]"
echo "Turn off power LED"
echoinfo " [OPTION]"
echoinfo " -p : Turn off permanentely (/etc/rc.local)"
}
step_24_options() { echo "[OPTION]"; }
step_24_alias() { echo "disable_powerled"; }
step_24() {
exep "${ledOffCmd}"