Skip to content

Commit b6df8b6

Browse files
author
Andreas Poulsen
committed
Language variability in protect_terminal
1 parent fb6af1a commit b6df8b6

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

os2borgerpc/sikkerhed/adjust_settings_access.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,10 @@ else # Remove access to settings
4141
4242
USER=\$(id -un)
4343
44-
# Extract the line in /etc/default/locale where LANG is set
45-
LOCALE_VAR=\$(grep LANG= /etc/default/locale)
46-
4744
# Set the info text based on the chosen language
48-
if echo \$LOCALE_VAR | grep sv; then
45+
if echo \$LANG | grep sv; then
4946
INFO="Systeminställningarna är inte tillgängliga för allmänheten.\n\nKontakta personalen om det uppstår problem."
50-
elif echo \$LOCALE_VAR | grep en; then
47+
elif echo \$LANG | grep en; then
5148
INFO="The settings are not accessible to the public.\n\nContact the staff if there are issues."
5249
else
5350
INFO="Systemindstillingerne er ikke tilgængelige for publikum.\n\nKontakt personalet, hvis der er problemer."

os2borgerpc/sikkerhed/desktop_toggle_writable.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ if [ "$ACTIVATE" = 'True' ]; then
5353
# Prepend temporarily setting DESKTOP mutable before copying new files in, as otherwise that will fail
5454
# We first determine the name of the user desktop directory as before
5555
sed -i "/USERNAME=\"$USERNAME\"/a \
56-
export \$(grep LANG= \/etc\/default\/locale)\n\
56+
export \$(grep LANG= \/etc\/default\/locale | tr -d \'\"\')\n\
5757
runuser -u $USERNAME xdg-user-dirs-update\n\
5858
DESKTOP=\$(runuser -u $USERNAME xdg-user-dir DESKTOP)\n\
5959
chattr -i \$DESKTOP" $USER_CLEANUP

os2borgerpc/sikkerhed/protect_terminal.sh

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,25 @@ else # Deny access
3939
fi
4040

4141
cat <<- EOF > "$PROGRAM_OLD_PATH"
42-
#!/bin/bash
42+
#!/bin/bash
4343
44-
USER=\$(id -un)
44+
USER=\$(id -un)
4545
46-
if [ \$USER == "user" ]; then
47-
zenity --info --text="Terminalen er ikke tilgængelig for publikum."
48-
else
49-
"$PROGRAM_NEW_PATH"
50-
fi
51-
EOF
46+
# Set the info text based on the chosen language
47+
if echo \$LANG | grep sv; then
48+
INFO="Terminalen är inte tillgänglig för allmänheten."
49+
elif echo \$LANG | grep en; then
50+
INFO="The terminal is not accessible to the public."
51+
else
52+
INFO="Terminalen er ikke tilgængelig for publikum."
53+
fi
54+
55+
if [ \$USER == "user" ]; then
56+
zenity --info --text="\$INFO"
57+
else
58+
"$PROGRAM_NEW_PATH"
59+
fi
60+
EOF
5261

5362
chmod +x "$PROGRAM_OLD_PATH"
5463

0 commit comments

Comments
 (0)