mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-19 19:40:37 +02:00
'fixed km, tz menu switching'
This commit is contained in:
parent
d486dad1d6
commit
0fca45b51b
3 changed files with 71 additions and 36 deletions
|
@ -1497,7 +1497,7 @@ select_source()
|
||||||
set_clock()
|
set_clock()
|
||||||
{
|
{
|
||||||
if [ -e /usr/bin/tz ]; then
|
if [ -e /usr/bin/tz ]; then
|
||||||
tz
|
tz --setup
|
||||||
else
|
else
|
||||||
DIALOG --msgbox "Error:\ntz script not found, aborting clock setting" 0 0
|
DIALOG --msgbox "Error:\ntz script not found, aborting clock setting" 0 0
|
||||||
fi
|
fi
|
||||||
|
@ -1507,7 +1507,7 @@ set_clock()
|
||||||
set_keyboard()
|
set_keyboard()
|
||||||
{
|
{
|
||||||
if [ -e /usr/bin/km ]; then
|
if [ -e /usr/bin/km ]; then
|
||||||
km
|
km --setup
|
||||||
else
|
else
|
||||||
DIALOG --msgbox "Error:\nkm script not found, aborting keyboard and console setting" 0 0
|
DIALOG --msgbox "Error:\nkm script not found, aborting keyboard and console setting" 0 0
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -5,6 +5,12 @@ ANSWER="/tmp/.km"
|
||||||
TITLE="Arch Linux Keymap And Console Font Setting"
|
TITLE="Arch Linux Keymap And Console Font Setting"
|
||||||
BASEDIR="/usr/share/kbd"
|
BASEDIR="/usr/share/kbd"
|
||||||
|
|
||||||
|
if [ "$1" = "--setup" ]; then
|
||||||
|
EXIT="Return to Main Menu"
|
||||||
|
else
|
||||||
|
EXIT="Exit"
|
||||||
|
fi
|
||||||
|
|
||||||
abort()
|
abort()
|
||||||
{
|
{
|
||||||
DIALOG --yesno "Abort Keymap And Console Font Setting?" 6 40 || return 0
|
DIALOG --yesno "Abort Keymap And Console Font Setting?" 6 40 || return 0
|
||||||
|
@ -37,13 +43,18 @@ dokeymap() {
|
||||||
for i in $(find $BASEDIR/keymaps -follow -name "*.gz" | sed 's|^.*/||g' | sort); do
|
for i in $(find $BASEDIR/keymaps -follow -name "*.gz" | sed 's|^.*/||g' | sort); do
|
||||||
KEYMAPS="$KEYMAPS $i -"
|
KEYMAPS="$KEYMAPS $i -"
|
||||||
done
|
done
|
||||||
DIALOG --menu "Select A Keymap" 22 60 16 $KEYMAPS 2>$ANSWER || DIALOG --msgbox "Aborting, your current keymap was not changed." 0 0
|
DIALOG --menu "Select A Keymap" 22 60 16 $KEYMAPS 2>$ANSWER || CANCEL="1"
|
||||||
|
if [ "$CANCEL" = "1" ]; then
|
||||||
|
DIALOG --msgbox "Aborting, your current keymap was not changed." 0 0
|
||||||
|
S_NEXTITEM="1"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
keymap=$(cat $ANSWER)
|
keymap=$(cat $ANSWER)
|
||||||
echo $keymap > /tmp/.keymap
|
echo $keymap > /tmp/.keymap
|
||||||
if [ "$keymap" ]; then
|
if [ "$keymap" ]; then
|
||||||
echo "Loading keymap: $keymap"
|
DIALOG --infobox "Loading keymap: $keymap" 0 0
|
||||||
#loadkeys -q $BASEDIR/keymaps/$keymap
|
#loadkeys -q $BASEDIR/keymaps/$keymap
|
||||||
loadkeys -q $keymap || error_kmset
|
loadkeys -q $keymap > /dev/null 2>&1 || error_kmset
|
||||||
fi
|
fi
|
||||||
S_NEXTITEM=2
|
S_NEXTITEM=2
|
||||||
}
|
}
|
||||||
|
@ -55,19 +66,25 @@ doconsolefont() {
|
||||||
for i in $(find $BASEDIR/consolefonts -maxdepth 1 ! -name '*.cp.gz' -name "*.gz" | sed 's|^.*/||g' | sort); do
|
for i in $(find $BASEDIR/consolefonts -maxdepth 1 ! -name '*.cp.gz' -name "*.gz" | sed 's|^.*/||g' | sort); do
|
||||||
FONTS="$FONTS $i -"
|
FONTS="$FONTS $i -"
|
||||||
done
|
done
|
||||||
DIALOG --menu "Select A Console Font" 22 60 16 $FONTS 2>$ANSWER || DIALOG --msgbox "Aborting, your current consolefont was not changed." 0 0
|
CANCEL=""
|
||||||
|
DIALOG --menu "Select A Console Font" 22 60 16 $FONTS 2>$ANSWER || CANCEL=1
|
||||||
|
if [ "$CANCEL" = "1" ]; then
|
||||||
|
DIALOG --msgbox "Aborting, your current consolefont was not changed." 0 0
|
||||||
|
S_NEXTITEM="2"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
font=$(cat $ANSWER)
|
font=$(cat $ANSWER)
|
||||||
echo $font > /tmp/.font
|
echo $font > /tmp/.font
|
||||||
if [ "$font" ]; then
|
if [ "$font" ]; then
|
||||||
echo "Loading font: $font"
|
DIALOG --infobox "Loading font: $font" 0 0
|
||||||
for i in $(seq 1 6); do
|
for i in $(seq 1 6); do
|
||||||
if [ -d /dev/vc ]; then
|
if [ -d /dev/vc ]; then
|
||||||
setfont $BASEDIR/consolefonts/$font -C /dev/vc/${i}
|
setfont $BASEDIR/consolefonts/$font -C /dev/vc/${i} > /dev/null 2>&1
|
||||||
else
|
else
|
||||||
setfont $BASEDIR/consolefonts/$font -C /dev/tty${i}
|
setfont $BASEDIR/consolefonts/$font -C /dev/tty${i} > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
[ -e /dev/ttyS0 ] && setfont $BASEDIR/consolefonts/$font -C /dev/ttyS0
|
[ -e /dev/ttyS0 ] && setfont $BASEDIR/consolefonts/$font -C /dev/ttyS0 > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
S_NEXTITEM=3
|
S_NEXTITEM=3
|
||||||
}
|
}
|
||||||
|
@ -82,7 +99,7 @@ mainmenu() {
|
||||||
--menu "Use the UP and DOWN arrows to navigate menus. Use TAB to switch between buttons and ENTER to select." 15 55 8 \
|
--menu "Use the UP and DOWN arrows to navigate menus. Use TAB to switch between buttons and ENTER to select." 15 55 8 \
|
||||||
"1" "Set Keymap" \
|
"1" "Set Keymap" \
|
||||||
"2" "Set Consolefont" \
|
"2" "Set Consolefont" \
|
||||||
"3" "Exit" 2>$ANSWER
|
"3" "$EXIT" 2>$ANSWER
|
||||||
case $(cat $ANSWER) in
|
case $(cat $ANSWER) in
|
||||||
"1")
|
"1")
|
||||||
dokeymap
|
dokeymap
|
||||||
|
|
|
@ -5,6 +5,12 @@ ANSWER="/tmp/.tz"
|
||||||
TITLE="Arch Linux Time And Date Setting"
|
TITLE="Arch Linux Time And Date Setting"
|
||||||
BASEDIR="/usr/share/zoneinfo"
|
BASEDIR="/usr/share/zoneinfo"
|
||||||
|
|
||||||
|
if [ "$1" = "--setup" ]; then
|
||||||
|
EXIT="Return to Main Menu"
|
||||||
|
else
|
||||||
|
EXIT="Exit"
|
||||||
|
fi
|
||||||
|
|
||||||
abort()
|
abort()
|
||||||
{
|
{
|
||||||
DIALOG --yesno "Abort Time And Date Setting?" 6 40 || return 0
|
DIALOG --yesno "Abort Time And Date Setting?" 6 40 || return 0
|
||||||
|
@ -46,14 +52,16 @@ hwclock $HWCLOCK_PARAMS
|
||||||
|
|
||||||
dotimezone () {
|
dotimezone () {
|
||||||
REGIONS=""
|
REGIONS=""
|
||||||
SET_REGION=""
|
|
||||||
SET_ZONE=""
|
SET_ZONE=""
|
||||||
for i in $(grep ^[A-Z] $BASEDIR/zone.tab | cut -f 3 | sed -e 's#/.*##g'| sort -u); do
|
for i in $(grep ^[A-Z] $BASEDIR/zone.tab | cut -f 3 | sed -e 's#/.*##g'| sort -u); do
|
||||||
REGIONS="$REGIONS $i -"
|
REGIONS="$REGIONS $i -"
|
||||||
done
|
done
|
||||||
DIALOG --menu "Please Select A Region:" 22 60 16 $REGIONS 2>$ANSWER && SET_REGION="1"
|
while ! [ "$SET_ZONE" = "1" ]; do
|
||||||
region=$(cat $ANSWER)
|
SET_REGION=""
|
||||||
if [ "${SET_REGION}" = "1" ]; then
|
DIALOG --menu "Please Select A Region:" 22 60 16 $REGIONS 2>$ANSWER && SET_REGION="1"
|
||||||
|
region=$(cat $ANSWER)
|
||||||
|
if [ "${SET_REGION}" = "1" ]; then
|
||||||
|
ZONES=""
|
||||||
for i in $(grep ^[A-Z] $BASEDIR/zone.tab | grep $region/ | cut -f 3 | sed -e "s#$region/##g"| sort -u); do
|
for i in $(grep ^[A-Z] $BASEDIR/zone.tab | grep $region/ | cut -f 3 | sed -e "s#$region/##g"| sort -u); do
|
||||||
ZONES="$ZONES $i -"
|
ZONES="$ZONES $i -"
|
||||||
done
|
done
|
||||||
|
@ -65,13 +73,14 @@ if [ "${SET_REGION}" = "1" ]; then
|
||||||
[ -e /etc/localtime ] && rm -f /etc/localtime
|
[ -e /etc/localtime ] && rm -f /etc/localtime
|
||||||
cp $BASEDIR/$region/$zone /etc/localtime
|
cp $BASEDIR/$region/$zone /etc/localtime
|
||||||
dohwclock
|
dohwclock
|
||||||
else
|
S_NEXTITEM="2"
|
||||||
DIALOG --msgbox "Skipping region and timezone, please select a timezone." 0 0
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
DIALOG --msgbox "Skipping region and timezone, please select a region first." 0 0
|
DIALOG --msgbox "Skipping region and timezone." 0 0
|
||||||
fi
|
S_NEXTITEM="1"
|
||||||
S_NEXTITEM="2"
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
error_timeset()
|
error_timeset()
|
||||||
|
@ -84,7 +93,7 @@ SET_TIME=""
|
||||||
USE_NTPDATE=""
|
USE_NTPDATE=""
|
||||||
HARDWARECLOCK=""
|
HARDWARECLOCK=""
|
||||||
if [ ! -s /tmp/.timezone ]; then
|
if [ ! -s /tmp/.timezone ]; then
|
||||||
DIALOG --msgbox "You have to select a region and timezone." 0 0
|
DIALOG --msgbox "You have to select a region and timezone first." 0 0
|
||||||
S_NEXTITEM="1"
|
S_NEXTITEM="1"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
@ -104,9 +113,20 @@ if [ "${SET_TIME}" = "1" ]; then
|
||||||
DIALOG --msgbox "Synced clock with internet pool successfully.\n\nYour current time is now:\n$(date)" 0 0
|
DIALOG --msgbox "Synced clock with internet pool successfully.\n\nYour current time is now:\n$(date)" 0 0
|
||||||
else
|
else
|
||||||
# display and ask to set date/time
|
# display and ask to set date/time
|
||||||
dialog --calendar "Set the date.\nUse <TAB> to navigate and arrow keys to change values." 0 0 0 0 0 2> $ANSWER || (error_timeset; return 1)
|
CANCEL=""
|
||||||
|
dialog --calendar "Set the date.\nUse <TAB> to navigate and arrow keys to change values." 0 0 0 0 0 2> $ANSWER || CANCEL="1"
|
||||||
|
if [ "$CANCEL" = "1" ]; then
|
||||||
|
error_timeset
|
||||||
|
S_NEXTITEM="2"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
local _date="$(cat $ANSWER)"
|
local _date="$(cat $ANSWER)"
|
||||||
dialog --timebox "Set the time.\nUse <TAB> to navigate and up/down to change values." 0 0 2> $ANSWER || (error_timeset; return 1)
|
dialog --timebox "Set the time.\nUse <TAB> to navigate and up/down to change values." 0 0 2> $ANSWER || CANCEL="1"
|
||||||
|
if [ "$CANCEL" = "1" ]; then
|
||||||
|
error_timeset
|
||||||
|
S_NEXTITEM="2"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
local _time="$(cat $ANSWER)"
|
local _time="$(cat $ANSWER)"
|
||||||
# save the time
|
# save the time
|
||||||
# DD/MM/YYYY hh:mm:ss -> YYYY-MM-DD hh:mm:ss
|
# DD/MM/YYYY hh:mm:ss -> YYYY-MM-DD hh:mm:ss
|
||||||
|
@ -117,8 +137,6 @@ if [ "${SET_TIME}" = "1" ]; then
|
||||||
dohwclock
|
dohwclock
|
||||||
DIALOG --msgbox "Your current time is now:\n$(date)" 0 0
|
DIALOG --msgbox "Your current time is now:\n$(date)" 0 0
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
DIALOG --msgbox "Current time was not changed!" 0 0
|
|
||||||
fi
|
fi
|
||||||
S_NEXTITEM="3"
|
S_NEXTITEM="3"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue