Skip to content

Commit 2412f6d

Browse files
add bash-power and fix noWatchdog, meltdownMitigations
1 parent 8ce427a commit 2412f6d

9 files changed

Lines changed: 117 additions & 4 deletions

File tree

Lines changed: 10 additions & 0 deletions
Loading

usr/share/biglinux/biglinux-settings/performance/meltdownMitigations.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# check current status
44
# action=$1
55
if [ "$1" == "check" ]; then
6-
if [[ -n "$(grep "mitigations=off" /proc/cmdline)" ]];then
6+
if [[ -n "$(grep "mitigations=off" /proc/cmdline)" ]]||[[ -e /tmp/meltdownMitigations ]] ;then
77
echo "true"
88
else
99
echo "false"

usr/share/biglinux/biglinux-settings/performance/meltdownMitigationsRun.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ updateGrubTask() {
5252
# Add the parameter
5353
sed -i.bak -E "/^GRUB_CMDLINE_LINUX=/ s|(['\"])$| $parameter\1|" "/etc/default/grub"
5454
fi
55+
> /tmp/meltdownMitigations
5556
else
5657
# remove the parameter
5758
sed -i -E "s/$parameter//g" "/etc/default/grub"
59+
rm /tmp/meltdownMitigations
5860
fi
5961

6062
# Run update-grub only if changes were made

usr/share/biglinux/biglinux-settings/performance/noWatchdog.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# check current status
44
# action=$1
55
if [ "$1" == "check" ]; then
6-
if [[ -n "$(grep "nowatchdog" /proc/cmdline)" ]] && [[ -n "$(grep "tsc=nowatchdog" /proc/cmdline)" ]];then
6+
if [[ -n "$(grep "nowatchdog" /proc/cmdline)" ]] && [[ -n "$(grep "tsc=nowatchdog" /proc/cmdline)" ]]||[[ -e "/tmp/noWatchdog" ]] ;then
77
echo "true"
88
else
99
echo "false"

usr/share/biglinux/biglinux-settings/performance/noWatchdogRun.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ updateGrubTask() {
5252
# Add the parameter
5353
sed -i.bak -E "/^GRUB_CMDLINE_LINUX=/ s|(['\"])$| $parameter\1|" "/etc/default/grub"
5454
fi
55+
> /tmp/noWatchdog
5556
else
5657
# remove the parameter
5758
sed -i -E "s/$parameter//g" "/etc/default/grub"
59+
rm /tmp/noWatchdog
5860
fi
5961

6062
# Run update-grub only if changes were made
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# check current status
4+
# action=$1
5+
if [ "$1" == "check" ]; then
6+
# for all DEs
7+
if [ ! -e "$HOME/.bash-normal" ];then #or if some Command &>/dev/null;then # if command response exit 0
8+
echo "true"
9+
else
10+
echo "false"
11+
fi
12+
13+
# change the state
14+
# action=$1
15+
# state=$2
16+
elif [ "$1" == "toggle" ]; then
17+
# if the state is true
18+
if [ "$2" == "true" ]; then
19+
# execute a command as root, prompting for a password only once.
20+
if ! pacman -Q biglinux-bash-config &>/dev/null; then
21+
pkexec $PWD/usability/bashPowerRun.sh "install" "$USER" "$DISPLAY" "$XAUTHORITY" "$DBUS_SESSION_BUS_ADDRESS" "$LANG" "$LANGUAGE"
22+
fi
23+
biglinux-change-default-shell bash-power
24+
# execute a command as a user
25+
# if the state is false
26+
else
27+
# execute a command as a user
28+
biglinux-change-default-shell bash-normal
29+
# execute a command as root, prompting for a password only once.
30+
fi
31+
exit $?
32+
fi
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
#Translation
4+
export TEXTDOMAINDIR="/usr/share/locale"
5+
export TEXTDOMAIN=biglinux-settings
6+
7+
# Assign the received arguments to variables with clear names
8+
function="$1"
9+
originalUser="$2"
10+
userDisplay="$3"
11+
userXauthority="$4"
12+
userDbusAddress="$5"
13+
userLang="$6"
14+
userLanguage="$7"
15+
16+
# Helper function to run a command as the original user
17+
runAsUser() {
18+
# Single quotes around variables are a good security practice
19+
su "$originalUser" -c "export DISPLAY='$userDisplay'; export XAUTHORITY='$userXauthority'; export DBUS_SESSION_BUS_ADDRESS='$userDbusAddress'; export LANG='$userLang'; export LC_ALL='$userLang'; export LANGUAGE='$userLanguage'; $1"
20+
}
21+
22+
# Creates a named pipe (FIFO) for communication with Zenity
23+
pipePath="/tmp/bashPower_pipe_$$"
24+
mkfifo "$pipePath"
25+
26+
# Starts Zenity IN THE BACKGROUND, as the user, with the full environment
27+
if [[ "$function" == "install" ]]; then
28+
zenityTitle=$"Bash Power Install"
29+
zenityText=$"Installing Bash Power, Please wait..."
30+
else
31+
zenityTitle=$"Bash Power Uninstall"
32+
zenityText=$"Uninstalling Bash Power, Please wait..."
33+
fi
34+
runAsUser "zenity --progress --title=\"$zenityTitle\" --text=\"$zenityText\" --pulsate --auto-close --no-cancel < '$pipePath'" &
35+
36+
# Executes the root tasks.
37+
updateTask() {
38+
if [[ "$function" == "install" ]]; then
39+
pacman -Syu --noconfirm biglinux-bash-config
40+
fi
41+
exitCode=$?
42+
}
43+
updateTask > "$pipePath"
44+
45+
# Cleans up the pipe
46+
rm "$pipePath"
47+
48+
# Shows the final result to the user, also with the correct theme.
49+
if [[ "$exitCode" == "0" ]] && [[ "$function" == "install" ]]; then
50+
zenityText=$"Bash Power installed successfully!"
51+
runAsUser "zenity --info --text=\"$zenityText\""
52+
else
53+
zenityText=$"Failed to install Bash Power!"
54+
zenity --info --text="$zenityText"
55+
fi
56+
57+
# Exits the script with the correct exit code
58+
exit $exitCode

usr/share/biglinux/biglinux-settings/usability/recentFiles.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ if [ "$1" == "check" ]; then
1616

1717
# Se what-to-remember é 0 (lembrar tudo) e UseRecent é true e FilesEnabled é true = ativado
1818
if [[ "$what_to_remember" == "0" ]] && [[ "${use_recent,,}" == "true" ]] && [[ "${files_enabled,,}" == "true" ]]; then
19-
echo "true"
19+
echo "true"
2020
else
21-
echo "false"
21+
echo "false"
2222
fi
2323
elif [[ "$XDG_CURRENT_DESKTOP" == *"GNOME"* ]];then
2424
remember=$(gsettings get org.gnome.desktop.privacy remember-recent-files 2>/dev/null)

usr/share/biglinux/biglinux-settings/usability_page.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,13 @@ def __init__(self, main_window, **kwargs):
5151
"recent_files-symbolic"
5252
)
5353

54+
# bashPower
55+
self.create_row(
56+
group,
57+
_("Bash Power"),
58+
_("BigLinux terminal improvements and customizations."),
59+
"bashPower",
60+
"bashPower-symbolic"
61+
)
62+
5463
self.sync_all_switches()

0 commit comments

Comments
 (0)