Skip to content
This repository was archived by the owner on Jan 18, 2026. It is now read-only.

Commit 147a878

Browse files
author
Erazem Kokot
authored
Lint configure_locale.sh (#884)
Update variable definitions for configure_locale.sh
1 parent cc18820 commit 147a878

1 file changed

Lines changed: 26 additions & 23 deletions

File tree

lib/configure_locale.sh

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
### License: GPL v2.0
1616
###############################################################
1717

18+
# Disable shellcheck warning about variables being referenced but not assigned
19+
# shellcheck disable=2154
20+
1821
set_keys() {
1922

20-
op_title="$key_op_msg"
23+
op_title="${key_op_msg}"
2124
while (true)
2225
do
23-
keyboard=$(dialog --nocancel --ok-button "$ok" --menu "$keys_msg" 18 60 10 \
26+
keyboard=$(dialog --nocancel --ok-button "${ok}" --menu "${keys_msg}" 18 60 10 \
2427
"us" "United States" \
2528
"de" "German" \
2629
"el" "Greek" \
@@ -33,11 +36,11 @@ set_keys() {
3336
"ru" "Russian" \
3437
"sv" "Swedish" \
3538
"uk" "United Kingdom" \
36-
"$other" "$other-keymaps" 3>&1 1>&2 2>&3)
37-
source "$lang_file"
39+
"${other}" "${other}-keymaps" 3>&1 1>&2 2>&3)
40+
source "${lang_file}"
3841

39-
if [ "$keyboard" = "$other" ]; then
40-
keyboard=$(dialog --ok-button "$ok" --cancel-button "$cancel" --menu "$keys_msg" 19 60 10 $key_maps 3>&1 1>&2 2>&3)
42+
if [ "${keyboard}" = "${other}" ]; then
43+
keyboard=$(dialog --ok-button "${ok}" --cancel-button "${cancel}" --menu "${keys_msg}" 19 60 10 "${key_maps}" 3>&1 1>&2 2>&3)
4144
if [ "$?" -eq "0" ]; then
4245
break
4346
fi
@@ -46,17 +49,17 @@ set_keys() {
4649
fi
4750
done
4851

49-
localectl set-keymap "$keyboard"
50-
echo "$(date -u "+%F %H:%M") : Set keymap to: $keyboard" >> "$log"
52+
localectl set-keymap "${keyboard}"
53+
echo "$(date -u "+%F %H:%M") : Set keymap to: ${keyboard}" >> "${log}"
5154

5255
}
5356

5457
set_locale() {
5558

56-
op_title="$locale_op_msg"
59+
op_title="${locale_op_msg}"
5760
while (true)
5861
do
59-
LOCALE=$(dialog --nocancel --ok-button "$ok" --menu "$locale_msg" 18 60 11 \
62+
LOCALE=$(dialog --nocancel --ok-button "${ok}" --menu "${locale_msg}" 18 60 11 \
6063
"en_US.UTF-8" "United States" \
6164
"en_AU.UTF-8" "Australia" \
6265
"pt_BR.UTF-8" "Brazil" \
@@ -75,10 +78,10 @@ set_locale() {
7578
"ru_RU.UTF-8" "Russian" \
7679
"es_ES.UTF-8" "Spanish" \
7780
"sv_SE.UTF-8" "Swedish" \
78-
"$other" "$other-locale" 3>&1 1>&2 2>&3)
81+
"${other}" "${other}-locale" 3>&1 1>&2 2>&3)
7982

80-
if [ "$LOCALE" = "$other" ]; then
81-
LOCALE=$(dialog --ok-button "$ok" --cancel-button "$cancel" --menu "$locale_msg" 18 60 11 $localelist 3>&1 1>&2 2>&3)
83+
if [ "${LOCALE}" = "${other}" ]; then
84+
LOCALE=$(dialog --ok-button "${ok}" --cancel-button "${cancel}" --menu "${locale_msg}" 18 60 11 "${localelist}" 3>&1 1>&2 2>&3)
8285
if [ "$?" -eq "0" ]; then
8386
break
8487
fi
@@ -87,24 +90,24 @@ set_locale() {
8790
fi
8891
done
8992

90-
echo "$(date -u "+%F %H:%M") : Set locale to: $LOCALE" >> "$log"
93+
echo "$(date -u "+%F %H:%M") : Set locale to: ${LOCALE}" >> "${log}"
9194

9295
}
9396

9497

9598
set_zone() {
9699

97-
op_title="$zone_op_msg"
100+
op_title="${zone_op_msg}"
98101
while (true)
99102
do
100-
ZONE=$(dialog --nocancel --ok-button "$ok" --menu "$zone_msg0" 18 60 11 $zonelist 3>&1 1>&2 2>&3)
101-
if (find /usr/share/zoneinfo -maxdepth 1 -type d | sed -n -e 's!^.*/!!p' | grep "$ZONE" &> /dev/null); then
102-
sublist=$(find /usr/share/zoneinfo/"$ZONE" -maxdepth 1 | sed -n -e 's!^.*/!!p' | sort | sed 's/$/ -/g' | grep -v "$ZONE")
103-
SUBZONE=$(dialog --ok-button "$ok" --cancel-button "$back" --menu "$zone_msg1" 18 60 11 $sublist 3>&1 1>&2 2>&3)
103+
ZONE=$(dialog --nocancel --ok-button "${ok}" --menu "${zone_msg0}" 18 60 11 "${zonelist}" 3>&1 1>&2 2>&3)
104+
if (find /usr/share/zoneinfo -maxdepth 1 -type d | sed -n -e 's!^.*/!!p' | grep "${ZONE}" &> /dev/null); then
105+
sublist=$(find /usr/share/zoneinfo/"${ZONE}" -maxdepth 1 | sed -n -e 's!^.*/!!p' | sort | sed 's/$/ -/g' | grep -v "${ZONE}")
106+
SUBZONE=$(dialog --ok-button "${ok}" --cancel-button "${back}" --menu "${zone_msg1}" 18 60 11 "${sublist}" 3>&1 1>&2 2>&3)
104107
if [ "$?" -eq "0" ]; then
105-
if (find /usr/share/zoneinfo/"$ZONE" -maxdepth 1 -type d | sed -n -e 's!^.*/!!p' | grep "$SUBZONE" &> /dev/null); then
106-
sublist=$(find /usr/share/zoneinfo/"$ZONE"/"$SUBZONE" -maxdepth 1 | sed -n -e 's!^.*/!!p' | sort | sed 's/$/ -/g' | grep -v "$SUBZONE")
107-
SUB_SUBZONE=$(dialog --ok-button "$ok" --cancel-button "$back" --menu "$zone_msg1" 15 60 7 $sublist 3>&1 1>&2 2>&3)
108+
if (find /usr/share/zoneinfo/"${ZONE}" -maxdepth 1 -type d | sed -n -e 's!^.*/!!p' | grep "${SUBZONE}" &> /dev/null); then
109+
sublist=$(find /usr/share/zoneinfo/"${ZONE}"/"${SUBZONE}" -maxdepth 1 | sed -n -e 's!^.*/!!p' | sort | sed 's/$/ -/g' | grep -v "${SUBZONE}")
110+
SUB_SUBZONE=$(dialog --ok-button "${ok}" --cancel-button "${back}" --menu "${zone_msg1}" 15 60 7 "${sublist}" 3>&1 1>&2 2>&3)
108111
if [ "$?" -eq "0" ]; then
109112
ZONE="${ZONE}/${SUBZONE}/${SUB_SUBZONE}"
110113
break
@@ -119,7 +122,7 @@ set_zone() {
119122
fi
120123
done
121124

122-
echo "$(date -u "+%F %H:%M") : Set timezone to: $ZONE" >> "$log"
125+
echo "$(date -u "+%F %H:%M") : Set timezone to: ${ZONE}" >> "${log}"
123126

124127
}
125128

0 commit comments

Comments
 (0)