Allow selection of locale and language

This commit is contained in:
Austin Horstman 2022-02-24 15:12:21 -06:00
parent 5fd8d54174
commit 09a7bfd97c
5 changed files with 121 additions and 3 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
install.conf install.conf
installlog.txt installlog.txt
archnikus.code-workspace archnikus.code-workspace
setup.conf setup.conf
*.log

View File

@ -5,6 +5,7 @@ set -a
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
SCRIPTS_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"/scripts SCRIPTS_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"/scripts
CONFIGS_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"/configs CONFIGS_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"/configs
DIALOGRC=$CONFIGS_DIR/.dialogrc
set +a set +a
echo -ne " echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------

53
configs/.dialogrc Normal file
View File

@ -0,0 +1,53 @@
aspect = 0
separate_widget = ""
tab_len = 0
visit_items = OFF
use_shadow = OFF
use_colors = ON
screen_color = (BLUE,BLACK,OFF)
shadow_color = (BLACK,BLACK,OFF)
dialog_color = (BLUE,BLACK,OFF)
title_color = (WHITE,BLACK,OFF)
border_color = (BLUE,BLACK,OFF)
border2_color = border_color
button_active_color = (BLACK,BLUE,OFF)
button_inactive_color = (WHITE,BLACK,OFF)
button_key_active_color = (BLACK,BLUE,OFF)
button_key_inactive_color = (RED,BLACK,OFF)
button_label_active_color = (BLACK,BLUE,OFF)
button_label_inactive_color = (WHITE,BLACK,OFF)
inputbox_color = (WHITE,BLACK,OFF)
inputbox_border_color = (BLACK,BLACK,OFF)
searchbox_color = (WHITE,BLACK,OFF)
searchbox_title_color = (BLUE,BLACK,OFF)
searchbox_border_color = (WHITE,BLACK,OFF)
position_indicator_color = (WHITE,BLACK,OFF)
menubox_color = (BLACK,BLACK,OFF)
menubox_border_color = (BLACK,BLACK,OFF)
menubox_border2_color = menubox_border_color
item_color = (WHITE,BLACK,OFF)
item_selected_color = (BLACK,BLUE,OFF)
tag_color = (WHITE,BLACK,OFF)
tag_selected_color = (BLACK,BLUE,OFF)
tag_key_color = (WHITE,BLACK,OFF)
tag_key_selected_color = (BLACK,BLUE,OFF)
check_color = (WHITE,BLACK,OFF)
check_selected_color = (BLACK,BLUE,OFF)
uarrow_color = (WHITE,BLACK,OFF)
darrow_color = (WHITE,BLACK,OFF)
itemhelp_color = (BLACK,WHITE,OFF)
form_active_text_color = (BLACK,BLUE,OFF)
form_text_color = (WHITE,BLACK,OFF)
form_item_readonly_color = (BLACK,WHITE,OFF)

View File

@ -47,11 +47,11 @@ echo -ne "
Setup Language to US and set locale Setup Language to US and set locale
------------------------------------------------------------------------- -------------------------------------------------------------------------
" "
sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen echo "$LOCALE" >> /etc/locale.gen
locale-gen locale-gen
timedatectl --no-ask-password set-timezone ${TIMEZONE} timedatectl --no-ask-password set-timezone ${TIMEZONE}
timedatectl --no-ask-password set-ntp 1 timedatectl --no-ask-password set-ntp 1
localectl --no-ask-password set-locale LANG="en_US.UTF-8" LC_TIME="en_US.UTF-8" localectl --no-ask-password set-locale LANG="$LANG" LANGUAGE="$LANGUAGE" LC_TIME="$LC_TIME"
ln -s /usr/share/zoneinfo/${TIMEZONE} /etc/localtime ln -s /usr/share/zoneinfo/${TIMEZONE} /etc/localtime
# Set keymaps # Set keymaps
localectl --no-ask-password set-keymap ${KEYMAP} localectl --no-ask-password set-keymap ${KEYMAP}

View File

@ -208,6 +208,56 @@ echo -ne "Your key boards layout: ${keymap} \n"
set_option KEYMAP $keymap set_option KEYMAP $keymap
} }
locale() {
declare -a locales
i=1 #Index counter for adding to array
j=1 #Option menu value generator
while read line
do
# array[ $i ]=$j
# (( j++ ))
locales[ ($i + 1) ]=$line
(( i=($i+2) ))
done < <((grep UTF-8 /etc/locale.gen | sed 's/\..*$//' | sed '/@/d' | awk '{print $1}' | uniq | sed 's/#//g')) #consume file path provided as argument
#Define parameters for menu
terminal=$(tty) #Gather current terminal session for appropriate redirection
height=20
width=76
choice_height=16
back_title="ArchTitus"
title="Locale Selection"
menu="Choose a locale:"
#Build the menu with variables & dynamic content
while true; do
choice=$(dialog --clear \
--colors \
--no-items \
--backtitle "$back_title" \
--title "$title" \
--menu "$menu" \
$height $width $choice_height \
"${locales[@]}" \
2>&1 >$terminal)
if [ -z "$choice" ]
then
echo "Nothing selected. Required to continue."
else
echo "Selected $choice";
set_option LOCALE "\"${choice}.UTF-8 UTF-8\""
set_option LANG "\"${choice}.UTF-8\""
set_option LANGUAGE "\"${choice}\""
set_option LC_TIME "\"${choice}.UTF-8\""
break
fi
done
}
drivessd () { drivessd () {
echo -ne " echo -ne "
Is this an ssd? yes/no: Is this an ssd? yes/no:
@ -297,12 +347,25 @@ installtype () {
set_option INSTALL_TYPE $install_type set_option INSTALL_TYPE $install_type
} }
prep() {
echo -ne "
Preparing your system for installation
"
pacman -Sy --noconfirm --needed dialog
}
# More features in future # More features in future
# language (){} # language (){}
# Starting functions # Starting functions
clear clear
logo logo
prep
clear
logo
locale
clear
logo
userinfo userinfo
clear clear
logo logo