Ask for countries in updateMirrors() with checklist
This commit is contained in:
parent
4ac1d10118
commit
bdcdf47ab0
32
install.sh
32
install.sh
|
@ -1,9 +1,13 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
setDelimiters() {
|
||||||
|
delimiters=("$@")
|
||||||
|
}
|
||||||
|
|
||||||
formatOptions() {
|
formatOptions() {
|
||||||
options=()
|
options=()
|
||||||
for item in $@; do
|
for item in "$@"; do
|
||||||
options+=("${item}" "")
|
options+=("${item}" "${delimiters[@]}")
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +93,7 @@ setTimeZone() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setLocale() {
|
setLocale() {
|
||||||
|
# TODO: Let the user choose a locale
|
||||||
sed 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' -i /etc/locale.gen
|
sed 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' -i /etc/locale.gen
|
||||||
runInChroot "locale-gen"
|
runInChroot "locale-gen"
|
||||||
echo "LANG=en_US.UTF-8" > /etc/locale.conf
|
echo "LANG=en_US.UTF-8" > /etc/locale.conf
|
||||||
|
@ -105,14 +110,19 @@ networkConf() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setPassword() {
|
setPassword() {
|
||||||
password=$(whiptail --inputbox "Enter the root password." 0 0 3>&1 1>&2 2>&3)
|
askForPassword "root"
|
||||||
runInChroot "echo "root:${password}" | chpasswd"
|
runInChroot "echo "root:${password}" | chpasswd"
|
||||||
unset password
|
unset password
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMirrors() {
|
updateMirrors() {
|
||||||
runInChroot "cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup"
|
runInChroot "cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup"
|
||||||
runInChroot "sudo reflector --country Brazil,Chile,Colombia --protocol https --sort rate --save /etc/pacman.d/mirrorlist"
|
local IFS=$'\n'
|
||||||
|
setDelimiters "" "OFF"
|
||||||
|
formatOptions $(cat /etc/pacman.d/mirrorlist.pacnew | grep '^##' | cut -d' ' -f2- | sed -n '5~1p')
|
||||||
|
countries=$(whiptail --title "Countries" --checklist "" 0 0 0 "${options[@]}" 3>&1 1>&2 2>&3)
|
||||||
|
countriesFmt=$(echo "$countries" | sed -r 's/" "/,/g')
|
||||||
|
runInChroot "sudo reflector --country "${countriesFmt//\"/}" --protocol https --sort rate --save /etc/pacman.d/mirrorlist"
|
||||||
}
|
}
|
||||||
|
|
||||||
installMorePackages() {
|
installMorePackages() {
|
||||||
|
@ -125,18 +135,18 @@ grubSetUp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
askForPassword() {
|
askForPassword() {
|
||||||
password=$(whiptail --inputbox "Enter the password." 0 0 3>&1 1>&2 2>&3)
|
password=$(whiptail --inputbox "Enter the ${1} password." 0 0 3>&1 1>&2 2>&3)
|
||||||
passwordRe=$(whiptail --inputbox "Reenter password." 0 0 3>&1 1>&2 2>&3)
|
passwordRep=$(whiptail --inputbox "Reenter password." 0 0 3>&1 1>&2 2>&3)
|
||||||
while ! [ "$password" = "$passwordRe" ]; do
|
while ! [ "$password" = "$passwordRep" ]; do
|
||||||
password=$(whiptail --inputbox "Passwords do not match! Please enter the password again." 0 0 3>&1 1>&2 2>&3)
|
password=$(whiptail --inputbox "Passwords do not match! Please enter the password again." 0 0 3>&1 1>&2 2>&3)
|
||||||
passwordRe=$(whiptail --inputbox "Reenter password." 0 0 3>&1 1>&2 2>&3)
|
passwordRep=$(whiptail --inputbox "Reenter password." 0 0 3>&1 1>&2 2>&3)
|
||||||
done
|
done
|
||||||
unset passwordRe
|
unset passwordRep
|
||||||
}
|
}
|
||||||
|
|
||||||
userSetUp() {
|
userSetUp() {
|
||||||
username=$(whiptail --inputbox "Enter the new username." 0 0 3>&1 1>&2 2>&3)
|
username=$(whiptail --inputbox "Enter the new username." 0 0 3>&1 1>&2 2>&3)
|
||||||
askForPassword
|
askForPassword "${username}"
|
||||||
runInChroot "useradd -m ${username};echo "${username}:${password}" | chpasswd; sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers; usermod -aG wheel ${username}"
|
runInChroot "useradd -m ${username};echo "${username}:${password}" | chpasswd; sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers; usermod -aG wheel ${username}"
|
||||||
unset username
|
unset username
|
||||||
unset password
|
unset password
|
||||||
|
@ -201,4 +211,4 @@ runScript() {
|
||||||
finishInstallation
|
finishInstallation
|
||||||
}
|
}
|
||||||
|
|
||||||
runScript
|
# runScript
|
Loading…
Reference in New Issue