mirror of
https://codeberg.org/privacy1st/arch
synced 2024-12-23 01:16:04 +01:00
installer script: work in progress (3)
This commit is contained in:
parent
30dfe15a6e
commit
a32bb78c2e
@ -115,7 +115,7 @@ function get_multi_choice {
|
|||||||
# if ptr has no value yet, ask user for input!
|
# if ptr has no value yet, ask user for input!
|
||||||
|
|
||||||
local -n MENU_OPTIONS=$3
|
local -n MENU_OPTIONS=$3
|
||||||
local tmp=$(dialog --stdout --checklist "$2" 0 0 0 ${MENU_OPTIONS}) || {
|
TMP1=$(dialog --stdout --checklist "$2" 0 0 0 ${MENU_OPTIONS}) || {
|
||||||
echo "Error during menu selection!"
|
echo "Error during menu selection!"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@ -123,7 +123,10 @@ function get_multi_choice {
|
|||||||
|
|
||||||
# Result of dialog is space separated list
|
# Result of dialog is space separated list
|
||||||
# Store this as an array
|
# Store this as an array
|
||||||
readarray -d " " -t ptr <<<"$tmp"
|
# Without newline at last array element: https://unix.stackexchange.com/a/519917/315162
|
||||||
|
# readarray -d " " -t ptr < <(printf '%s' "$TMP1")
|
||||||
|
#
|
||||||
|
space_separated_to_array TMP1 "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,21 +249,17 @@ function choose_mount_options() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
get_multi_choice FS_MOUNT_OPTIONS "Select mount options" TMP1 || return $?
|
get_multi_choice FS_MOUNT_OPTIONS "Select mount options" TMP1 || return $?
|
||||||
|
|
||||||
# TODO: test FS_MOUNT_OPTIONS
|
|
||||||
echo "${FS_MOUNT_OPTIONS[@]}"
|
|
||||||
echo "${#FS_MOUNT_OPTIONS[@]}"
|
|
||||||
for i in "${FS_MOUNT_OPTIONS[@]}"; do
|
|
||||||
echo "<<$i>>"
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
check_network || return $?
|
check_network || return $?
|
||||||
get_user_input || return $?
|
get_user_input || return $?
|
||||||
get_cpu_vendor || return $?
|
get_cpu_vendor || return $?
|
||||||
|
|
||||||
get_default_mount_options || return $?
|
get_default_mount_options || return $?
|
||||||
choose_mount_options || return $?
|
choose_mount_options || return $?
|
||||||
|
|
||||||
|
# TODO: use FS_DEFAULT_MOUNT_OPTIONS and FS_MOUNT_OPTIONS in combination
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
function newline_to_space(){
|
function newline_to_space() {
|
||||||
# Replaces all newlines with spaces
|
# Replaces all newlines with spaces
|
||||||
# $1: name of variable
|
# $1: name of variable
|
||||||
|
|
||||||
@ -6,12 +6,27 @@ function newline_to_space(){
|
|||||||
# Replace newlines with spaces
|
# Replace newlines with spaces
|
||||||
# See bash string substitution: https://gist.github.com/JPvRiel/b279524d3e56229a896477cb8082a72b
|
# See bash string substitution: https://gist.github.com/JPvRiel/b279524d3e56229a896477cb8082a72b
|
||||||
|
|
||||||
echo "removing newlines in str: -->$ptr<--"
|
# echo "removing newlines in str: -->$ptr<--"
|
||||||
ptr="${ptr//$'\n'/' '}"
|
ptr="${ptr//$'\n'/' '}"
|
||||||
echo "new str is: -->$ptr<--"
|
# echo "new str is: -->$ptr<--"
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_block_devices(){
|
function space_separated_to_array() {
|
||||||
|
# $1: name of variable with space separated list
|
||||||
|
# $2: name of array to store values into
|
||||||
|
|
||||||
|
local -n ptr=$1
|
||||||
|
local -n ptr2=$2
|
||||||
|
# ptr space separated list.
|
||||||
|
# Store this as array ptr2.
|
||||||
|
# Without newline at last array element: https://unix.stackexchange.com/a/519917/315162
|
||||||
|
readarray -d " " -t ptr2 < <(printf '%s' "$ptr")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function get_block_devices() {
|
||||||
# return: the following variables:
|
# return: the following variables:
|
||||||
# BLOCK_DEVICES (array with each block device as one entry)
|
# BLOCK_DEVICES (array with each block device as one entry)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user