progress
This commit is contained in:
parent
a1226ee3e4
commit
4c69decdad
44
functions
44
functions
|
@ -4,7 +4,7 @@ err() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
input() {
|
||||
input_old() {
|
||||
local input
|
||||
local found="0"
|
||||
echo "$1 $2"
|
||||
|
@ -40,4 +40,44 @@ reset() {
|
|||
if [ "$1" == "packages" ]; then
|
||||
function packages() { :; }
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
input() {
|
||||
output=""
|
||||
echo "${1}"
|
||||
read -r -p "[${2}]: " output
|
||||
test -z "${output}" && output="${2}"
|
||||
return 0
|
||||
}
|
||||
|
||||
#multiplechoice "networksystem" "dhcpcd" "networkmanager" "iwd" "none"
|
||||
|
||||
multiplechoice() {
|
||||
output=""
|
||||
local done=""
|
||||
local input=("${@}")
|
||||
for i in $(seq 1 "$(( ${#input[@]} - 1 ))"); do
|
||||
if [[ "${i}" == "1" ]]; then
|
||||
choices="${input[$i]}"
|
||||
use="${input[$i]}"
|
||||
else
|
||||
choices="${choices}|${input[$i]}"
|
||||
use+=" ${input[$i]}"
|
||||
fi
|
||||
done
|
||||
while input "[${choices}]: " "${input[1]}"; do
|
||||
for i in $(seq 1 "$(( ${#input[@]} - 1 ))"); do
|
||||
if [[ "${output}" == "${input[$i]}" ]] || [[ "${output}" == "${input[$i]:0:2}" ]]; then
|
||||
echo setconf add "${1}" "${input[$i]}"
|
||||
done=1
|
||||
fi
|
||||
done
|
||||
if [[ -z "${done}" ]]; then
|
||||
echo wronginput "${output}"
|
||||
echo use these: "${use}"
|
||||
else
|
||||
break
|
||||
fi
|
||||
|
||||
done
|
||||
}
|
||||
|
|
14
main.sh
14
main.sh
|
@ -20,7 +20,7 @@ target_phy_disk() {
|
|||
local output
|
||||
DISKS_DETAILS=$(lsblk -l -o KNAME,TYPE,SIZE,MODEL,WWN|grep disk)
|
||||
echo "$DISKS_DETAILS"
|
||||
input "which one?" "$(echo "$DISKS_DETAILS"|awk '{print $1}'|tr '\n' ' ')" "not found."
|
||||
input_old "which one?" "$(echo "$DISKS_DETAILS"|awk '{print $1}'|tr '\n' ' ')" "not found."
|
||||
TARGET_PHY_DISK="/dev/${output}"
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ encryption_style() {
|
|||
echo "c)no keyfile (double pw enter)" #bios: 1 uefi: 2
|
||||
echo "d)keyfile on usb" #bios: 1 uefi: ?
|
||||
echo "e)unencrypted boot" #bios: 2 uefi: 2
|
||||
input "how to encrypt?" "a b c d e" "wrong input"
|
||||
multiplechoice "a" "b" "c" "d" "e"
|
||||
ENCRYPTION_STYLE="$output"
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ base() {
|
|||
}
|
||||
|
||||
gfx() {
|
||||
input "Which GFX System?" "amd nvidia intel" "unknown error"
|
||||
input_old "Which GFX System?" "amd nvidia intel" "unknown error"
|
||||
GFX=$output
|
||||
. ./etc/gfx/$GFX
|
||||
packages
|
||||
|
@ -170,7 +170,7 @@ gfx() {
|
|||
}
|
||||
|
||||
soundsystem() {
|
||||
input "Which Soundsystem" "pulseaudio pipewire" "unknown error"
|
||||
input_old "Which Soundsystem" "pulseaudio pipewire" "unknown error"
|
||||
SOUNDSYSTEM=$output
|
||||
. ./etc/soundsystem/$SOUNDSYSTEM
|
||||
packages
|
||||
|
@ -178,7 +178,7 @@ soundsystem() {
|
|||
}
|
||||
|
||||
de() {
|
||||
input "Which Desktop Environment?" "plasma gnome minimal" "unknown error"
|
||||
input_old "Which Desktop Environment?" "plasma gnome minimal" "unknown error"
|
||||
DE=$output
|
||||
if ! [ "$DE" == "minimal" ]; then
|
||||
gfx
|
||||
|
@ -190,14 +190,14 @@ de() {
|
|||
}
|
||||
|
||||
printing() {
|
||||
input "Do you want printing?" "yes no" "unknown error"
|
||||
input_old "Do you want printing?" "yes no" "unknown error"
|
||||
if [ "$output" == "yes" ]; then
|
||||
addpkg cups
|
||||
fi
|
||||
}
|
||||
|
||||
lang() {
|
||||
input "Which language?" "de en" "unknown error"
|
||||
input_old "Which language?" "de en" "unknown error"
|
||||
LANGUAGE=$output
|
||||
if [ "$LANGUAGE" == "de" ]; then
|
||||
L1=de_DE
|
||||
|
|
Loading…
Reference in New Issue
Block a user