sed changes

improve locale.gen searching sed and make locale uncommenting sed more specific
This commit is contained in:
i-c-u-p 2022-06-07 12:57:59 +00:00 committed by GitHub
parent e5df3ff78e
commit 7aae2a2ebe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -211,7 +211,7 @@ locale_selector () {
'') locale="en_US.UTF-8" '') locale="en_US.UTF-8"
info_print "$locale will be the default locale." info_print "$locale will be the default locale."
return 0;; return 0;;
'/') sed -E '/^# +|^#$/d;s/^#| *$//g;s/ .*/ (Charset:&)/' /etc/locale.gen | less -M '/') sed -E '/^#( +|$)/d;s/^#| *$//g;s/ .*/ (Charset:&)/' /etc/locale.gen | less -M
clear clear
return 1;; return 1;;
*) if ! grep -q "^#\?$(sed 's/[].*[]/\\&/g' <<< $locale) " /etc/locale.gen; then *) if ! grep -q "^#\?$(sed 's/[].*[]/\\&/g' <<< $locale) " /etc/locale.gen; then
@ -363,7 +363,7 @@ info_print "Generating a new fstab."
genfstab -U /mnt >> /mnt/etc/fstab genfstab -U /mnt >> /mnt/etc/fstab
# Configure selected locale and console keymap # Configure selected locale and console keymap
sed -i "/^#$locale/s/^#//" /mnt/etc/locale.gen sed -i "/^#$locale /s/^#//" /mnt/etc/locale.gen
echo "LANG=$locale" > /mnt/etc/locale.conf echo "LANG=$locale" > /mnt/etc/locale.conf
echo "KEYMAP=$kblayout" > /mnt/etc/vconsole.conf echo "KEYMAP=$kblayout" > /mnt/etc/vconsole.conf
@ -479,4 +479,4 @@ done
# Finishing up. # Finishing up.
info_print "Done, you may now wish to reboot (further changes can be done by chrooting into /mnt)." info_print "Done, you may now wish to reboot (further changes can be done by chrooting into /mnt)."
exit exit