Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For new users and local language setting #62

Closed
sc74 opened this issue Mar 3, 2024 · 1 comment
Closed

For new users and local language setting #62

sc74 opened this issue Mar 3, 2024 · 1 comment

Comments

@sc74
Copy link
Contributor

sc74 commented Mar 3, 2024

For the next version, would it be possible to run a script on first startup to request the language and geographic area for the time?

Indeed, new or basic ArchLinux users whose language is not English, it can be very complicated to correctly set the language for the vconsole, X11.

Going back to what Manjaro does, a suggestion would be to use the dialog package and a script.

An example that should of course be improved

#! /bin/bash

#clearing variables

TIMEZONE=""
LOCALE=""
X11KEYMAP=""

#Using Dialog to ask for user input for variables

  let i=0
W=()
while read -r line; do
	let i=$i+1
	W+=($line "")
done < <( timedatectl list-timezones )
TIMEZONE=$(dialog --clear --title "Manjaro ARM Installer" \
--menu "Choose your timezone!" 20 50 15 \
"${W[@]}" 3>&1 1>&2 2>&3 3>&- \
)

let i=0
W=()
while read -r line; do
	let i=$i+1
	W+=($line "")
done < <( cat /etc/locale.gen | grep "UTF-8" | tail -n +2 | sed -e 's/^#*//' | awk '{print $1}' )
LOCALE=$(dialog --clear --title "AstroArch Installer" \
	--menu "Choose your locale!" 20 50 15 \
	"${W[@]}" 3>&1 1>&2 2>&3 3>&- \
	)

let i=0
W=()
while read -r line; do
	let i=$i+1
	W+=($line "")
done < <( localectl list-keymaps )
CLIKEYMAP=$(dialog --clear --title "AstroArch Installer" \
	--menu "Choose your TTY keyboard layout:" 20 50 15 \
	"${W[@]}" 3>&1 1>&2 2>&3 3>&- \
)

   let i=0
W=()
while read -r line; do
	let i=$i+1
	W+=($line "")
done < <( localectl list-x11-keymap-layouts )
X11KEYMAP=$(dialog --clear --title "AstroArch Installer" \
	--menu "Choose your X11 keyboard layout:" 20 50 15 \
	"${W[@]}" 3>&1 1>&2 2>&3 3>&- \
)

#system setup

ln -sf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime
sed -i s/"#$LOCALE"/"$LOCALE"/g /etc/locale.gen
echo "LANG=$LOCALE" | tee --append $TMPDIR/root/etc/locale.conf
locale-gen
echo "KEYMAP=$CLIKEYMAP" | tee --append $TMPDIR/root/etc/vconsole.conf
echo 'Section "InputClass"' > $TMPDIR/root/etc/X11/xorg.conf.d/00-keyboard.conf
echo 'Identifier "system-keyboard"' >> $TMPDIR/root/etc/X11/xorg.conf.d/00-keyboard.conf
echo 'Option "XkbLayout" "us"' >> $TMPDIR/root/etc/X11/xorg.conf.d/00-keyboard.conf
echo 'EndSection' >> $TMPDIR/root/etc/X11/xorg.conf.d/00-keyboard.conf
sed -i s/"us"/"$X11KEYMAP"/ $TMPDIR/root/etc/X11/xorg.conf.d/00-keyboard.conf
unset LANG
source /etc/profile.d/locale.sh
@MattBlack85
Copy link
Collaborator

superseded by #75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants