switch choose field to end parameter

This commit is contained in:
Tobias Powalowski 2024-07-29 14:17:01 +02:00
parent 8b65fd0f25
commit d0b464d164
4 changed files with 22 additions and 22 deletions

View file

@ -128,7 +128,7 @@ _show_login() {
}
_abort() {
if _dialog --yesno "Abort$(echo "${_TITLE}" | choose 4 -f '\|') ?" 5 45; then
if _dialog --yesno "Abort$(echo "${_TITLE}" | choose -f '\|' 4) ?" 5 45; then
[[ -e "${_ANSWER}-running" ]] && rm "${_ANSWER}-running"
[[ -e "${_ANSWER}" ]] && rm "${_ANSWER}"
clear

View file

@ -70,7 +70,7 @@ _find_btrfs_bootloader_subvolume() {
_subvolumes_in_use() {
_SUBVOLUME_IN_USE=""
while read -r i; do
echo "${i}" | rg -F -q "|btrfs|" && _SUBVOLUME_IN_USE="${_SUBVOLUME_IN_USE} $(echo "${i}" | choose 8 -f '\|')"
echo "${i}" | rg -F -q "|btrfs|" && _SUBVOLUME_IN_USE="${_SUBVOLUME_IN_USE} $(echo "${i}" | choose -f '\|' 8)"
done < /tmp/.parts
}
@ -84,7 +84,7 @@ _check_btrfs_filesystem_creation() {
_FSTYPE="btrfs"
_SKIP_FILESYSTEM=1
# check on filesystem creation, skip subvolume asking then!
echo "${i}" | choose 3 -f '\|' | rg -q 1 && _DETECT_CREATE_FILESYSTEM=1
echo "${i}" | choose -f '\|' 3 | rg -q 1 && _DETECT_CREATE_FILESYSTEM=1
fi
done
}

View file

@ -110,7 +110,7 @@ _enter_mountpoint() {
rg -qw "/srv" /tmp/.parts && _MP=/var
_dialog --no-cancel --title " Mountpoint for ${_DEV} " --inputbox "" 7 65 "${_MP}" 2>"${_ANSWER}" || return 1
_MP=$(cat "${_ANSWER}")
if [[ "$(rg -F "|${_MP}|" /tmp/.parts | choose 2 -f '\|')" == "${_MP}" ]]; then
if [[ "$(rg -F "|${_MP}|" /tmp/.parts | choose -f '\|' 2)" == "${_MP}" ]]; then
_dialog --infobox "ERROR: You have defined 2 identical mountpoints!\nPlease select another mountpoint." 4 45
_MP=""
sleep 3
@ -140,18 +140,18 @@ _check_mkfs_values() {
_run_mkfs() {
while read -r line; do
# basic parameters
_DEV=$(echo "${line}" | choose 0 -f '\|')
_FSTYPE=$(echo "${line}" | choose 1 -f '\|')
_MP=$(echo "${line}" | choose 2 -f '\|')
_DOMKFS=$(echo "${line}" | choose 3 -f '\|')
_LABEL_NAME=$(echo "${line}" | choose 4 -f '\|')
_FS_OPTIONS=$(echo "${line}" | choose 5 -f '\|')
_DEV=$(echo "${line}" | choose -f '\|' 0)
_FSTYPE=$(echo "${line}" | choose -f '\|' 1)
_MP=$(echo "${line}" | choose -f '\|' 2)
_DOMKFS=$(echo "${line}" | choose -f '\|' 3)
_LABEL_NAME=$(echo "${line}" | choose -f '\|' 4)
_FS_OPTIONS=$(echo "${line}" | choose -f '\|' 5)
[[ "${_FS_OPTIONS}" == "NONE" ]] && _FS_OPTIONS=""
# bcachefs, btrfs and other parameters
if [[ ${_FSTYPE} == "bcachefs" ]]; then
_BCFS_DEVS="${_BCFS_DEVS//#/ }"
_BCFS_DEVS=$(echo "${line}" | choose 6 -f '\|')
_BCFS_COMPRESS=$(echo "${line}" | choose 7 -f '\|')
_BCFS_DEVS=$(echo "${line}" | choose -f '\|' 6)
_BCFS_COMPRESS=$(echo "${line}" | choose -f '\|' 7)
if [[ "${_BCFS_COMPRESS}" == "NONE" ]];then
_BCFS_COMPRESS=""
else
@ -160,13 +160,13 @@ _run_mkfs() {
_mkfs "${_DEV}" "${_FSTYPE}" "${_DESTDIR}" "${_DOMKFS}" "${_MP}" "${_LABEL_NAME}" "${_FS_OPTIONS}" \
"${_BCFS_DEVS}" "${_BCFS_COMPRESS}" || return 1
elif [[ ${_FSTYPE} == "btrfs" ]]; then
_BTRFS_DEVS=$(echo "${line}" | choose 6 -f '\|')
_BTRFS_DEVS=$(echo "${line}" | choose -f '\|' 6)
# remove # from array
_BTRFS_DEVS="${_BTRFS_DEVS//#/ }"
_BTRFS_LEVEL=$(echo "${line}" | choose 7 -f '\|')
_BTRFS_LEVEL=$(echo "${line}" | choose -f '\|' 7)
[[ ! "${_BTRFS_LEVEL}" == "NONE" && "${_FSTYPE}" == "btrfs" ]] && _BTRFS_LEVEL="-m ${_BTRFS_LEVEL} -d ${_BTRFS_LEVEL}"
_BTRFS_SUBVOLUME=$(echo "${line}" | choose 8 -f '\|')
_BTRFS_COMPRESS=$(echo "${line}" | choose 9 -f '\|')
_BTRFS_SUBVOLUME=$(echo "${line}" | choose -f '\|' 8)
_BTRFS_COMPRESS=$(echo "${line}" | choose -f '\|' 9)
[[ "${_BTRFS_COMPRESS}" == "NONE" ]] && _BTRFS_COMPRESS=""
_mkfs "${_DEV}" "${_FSTYPE}" "${_DESTDIR}" "${_DOMKFS}" "${_MP}" "${_LABEL_NAME}" "${_FS_OPTIONS}" \
"${_BTRFS_DEVS}" "${_BTRFS_LEVEL}" "${_BTRFS_SUBVOLUME}" "${_BTRFS_COMPRESS}" || return 1
@ -193,7 +193,7 @@ _create_filesystem() {
_dialog --no-cancel --title " LABEL Name on ${_DEV} " --inputbox "Keep it short and use no spaces or special characters." 8 60 \
"$(${_LSBLK} LABEL "${_DEV}" 2>"${_NO_LOG}")" 2>"${_ANSWER}" || return 1
_LABEL_NAME=$(cat "${_ANSWER}")
if [[ "$(rg -F "|${_LABEL_NAME}|" /tmp/.parts | choose 4 -f '\|')" == "${_LABEL_NAME}" ]]; then
if [[ "$(rg -F "|${_LABEL_NAME}|" /tmp/.parts | choose -f '\|' 4)" == "${_LABEL_NAME}" ]]; then
_dialog --title " ERROR " --no-mouse --infobox "You have defined 2 identical LABEL names!\nPlease enter another name." 4 45
sleep 3
_LABEL_NAME=""

View file

@ -66,17 +66,17 @@ _auto_create_filesystems() {
_PROGRESS_COUNT=$((100/_MAX_COUNT))
## make and mount filesystems
for fsspec in ${_FSSPECS}; do
_DEV="${_DISK}$(echo "${fsspec}" | tr -d ' ' | choose 0 -f '\|')"
_DEV="${_DISK}$(echo "${fsspec}" | tr -d ' ' | choose -f '\|' 0)"
# Add check on nvme or mmc controller:
# NVME uses /dev/nvme0n1pX name scheme
# MMC uses /dev/mmcblk0pX
if echo "${_DISK}" | rg -q "nvme|mmc"; then
_DEV="${_DISK}p$(echo "${fsspec}" | tr -d ' ' | choose 0 -f '\|')"
_DEV="${_DISK}p$(echo "${fsspec}" | tr -d ' ' | choose -f '\|' 0)"
fi
_FSTYPE="$(echo "${fsspec}" | tr -d ' ' | choose 1 -f '\|')"
_FSTYPE="$(echo "${fsspec}" | tr -d ' ' | choose -f '\|' 1)"
_DOMKFS=1
_MP="$(echo "${fsspec}" | tr -d ' ' | choose 2 -f '\|')"
_LABEL_NAME="$(echo "${fsspec}" | tr -d ' ' | choose 3 -f '\|')"
_MP="$(echo "${fsspec}" | tr -d ' ' | choose -f '\|' 2)"
_LABEL_NAME="$(echo "${fsspec}" | tr -d ' ' | choose -f '\|' 3)"
_FS_OPTIONS=""
_BTRFS_DEVS=""
_BTRFS_LEVEL=""