Skip to content

Commit 92ebfe4

Browse files
committed
Harden compatibility hooks and refactor shell scripts
Fix hook execution guards and POSIX issues (including kwin wayland priority). Improve script idempotence, error handling, and Bash quality with safer loops and checks. Standardize instructional comments in English and keep behavior resilient when targets are absent.
1 parent fea2b1f commit 92ebfe4

44 files changed

Lines changed: 345 additions & 262 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#!/bin/bash
22

3-
ln -sf "/usr/lib/modules/$(uname -r)/build" /usr/src/linux
4-
5-
# if folder not empty
6-
if [ ! -z "$(ls -A -- /etc/init.d)" ]; then
7-
8-
#run loop
9-
for i in /etc/init.d/*; do
10-
$i start
11-
done
12-
3+
# Keep /usr/src/linux pointing to the currently running kernel headers.
4+
# Legacy build scripts often expect this symlink to exist.
5+
kernel_build_path="/usr/lib/modules/$(uname -r)/build"
6+
if [ -e "$kernel_build_path" ]; then
7+
ln -sf "$kernel_build_path" /usr/src/linux
138
fi
9+
10+
# Start classic SysV init scripts when they are present and executable.
11+
# This hook is intentionally tolerant because /etc/init.d can be empty.
12+
for init_script in /etc/init.d/*; do
13+
[ -f "$init_script" ] || continue
14+
[ -x "$init_script" ] || continue
15+
"$init_script" start
16+
done
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
#!/bin/bash
22

3-
#Translation
4-
LANGUAGE=$LANG:en
3+
# Configure gettext fallbacks so UI strings are translated when possible.
4+
LANGUAGE="$LANG:en"
55
export TEXTDOMAINDIR="/usr/share/locale"
66
export TEXTDOMAIN=biglinux-improve-compatibility
77

8-
if [ ! -e /usr/lib/jvm/java-8-jre/jre/bin/javaws ]; then
8+
javaws_path="/usr/lib/jvm/java-8-jre/jre/bin/javaws"
9+
10+
# Prompt the user to install Java 8 only when javaws is missing.
11+
if [ ! -x "$javaws_path" ]; then
912
zenity --info --title="JAVA 8" --text $"Necessary to install <b>jre8</b>" --ok-label=$"Cancel" --extra-button=$"Install"
10-
if [ "$?" = "1" ];then
13+
if [ "$?" = "1" ]; then
1114
pamac-installer --build jre8
1215
pkexec archlinux-java set java-8-jre/jre
1316
fi
1417
else
15-
/usr/lib/jvm/java-8-jre/jre/bin/javaws $*
18+
"$javaws_path" "$@"
1619
fi

biglinux-improve-compatibility/usr/share/libalpm/hooks/biglinux-improve-compatibility-cisco-anyconnect-remove.hook

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ Target = cisco-anyconnect
66
[Action]
77
Description = Auto disable cisco-anyconnect after install
88
When = PreTransaction
9-
Exec = /bin/sh -c 'systemctl disable vpnagentd'
10-
9+
Exec = /bin/sh -c '{ [ -e /usr/lib/systemd/system/vpnagentd.service ] || [ -e /etc/systemd/system/vpnagentd.service ]; } && systemctl disable vpnagentd > /dev/null 2>&1'

biglinux-improve-compatibility/usr/share/libalpm/hooks/biglinux-improve-compatibility-cisco-anyconnect.hook

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ Target = cisco-anyconnect
77
[Action]
88
Description = Auto enable cisco-anyconnect after install
99
When = PostTransaction
10-
Exec = /bin/sh -c 'systemctl --now enable vpnagentd'
10+
Exec = /bin/sh -c '{ [ -e /usr/lib/systemd/system/vpnagentd.service ] || [ -e /etc/systemd/system/vpnagentd.service ]; } && systemctl enable vpnagentd > /dev/null 2>&1 && systemctl start vpnagentd > /dev/null 2>&1'

biglinux-improve-compatibility/usr/share/libalpm/hooks/biglinux-improve-compatibility-davinci-resolve.hook

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ Target = biglinux-improve-compatibility
88
[Action]
99
Description = Applying modifications to make Davinci Resolve compatible
1010
When = PostTransaction
11-
Exec = /bin/sh -c 'rm -f /opt/resolve/libs/libglib-2.0.so*; rm -f /opt/resolve/libs/libgio-2.0.so*; rm -f /opt/resolve/libs/libgmodule-2.0.so*'
11+
Exec = /bin/sh -c '[ -d /opt/resolve/libs ] && rm -f /opt/resolve/libs/libglib-2.0.so* /opt/resolve/libs/libgio-2.0.so* /opt/resolve/libs/libgmodule-2.0.so*'

biglinux-improve-compatibility/usr/share/libalpm/hooks/biglinux-improve-compatibility-epson-printer-utility-remove.hook

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ Target = epson-printer-utility
66
[Action]
77
Description = Auto enable epson-printer-utility after install
88
When = PreTransaction
9-
Exec = /bin/sh -c 'systemctl disable ecbd'
9+
Exec = /bin/sh -c '{ [ -e /usr/lib/systemd/system/ecbd.service ] || [ -e /etc/systemd/system/ecbd.service ]; } && systemctl disable ecbd > /dev/null 2>&1'

biglinux-improve-compatibility/usr/share/libalpm/hooks/biglinux-improve-compatibility-epson-printer-utility.hook

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ Target = epson-printer-utility
77
[Action]
88
Description = Auto enable epson-printer-utility after install
99
When = PostTransaction
10-
Exec = /bin/sh -c 'systemctl --now enable ecbd'
10+
Exec = /bin/sh -c '{ [ -e /usr/lib/systemd/system/ecbd.service ] || [ -e /etc/systemd/system/ecbd.service ]; } && systemctl enable ecbd > /dev/null 2>&1 && systemctl start ecbd > /dev/null 2>&1'

biglinux-improve-compatibility/usr/share/libalpm/hooks/biglinux-improve-compatibility-lact-remove.hook

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ Target = lact
66
[Action]
77
Description = Auto unconfigure lact after remove
88
When = PreTransaction
9-
Exec = /bin/sh -c 'systemctl disable --now lactd'
9+
Exec = /bin/sh -c '{ [ -e /usr/lib/systemd/system/lactd.service ] || [ -e /etc/systemd/system/lactd.service ]; } && systemctl disable lactd > /dev/null 2>&1 && systemctl stop lactd > /dev/null 2>&1'

biglinux-improve-compatibility/usr/share/libalpm/hooks/biglinux-improve-compatibility-lact.hook

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ Target = lact
77
[Action]
88
Description = Auto configure lact after install
99
When = PostTransaction
10-
Exec = /bin/sh -c 'systemctl enable --now lactd'
10+
Exec = /bin/sh -c '{ [ -e /usr/lib/systemd/system/lactd.service ] || [ -e /etc/systemd/system/lactd.service ]; } && systemctl enable lactd > /dev/null 2>&1 && systemctl start lactd > /dev/null 2>&1'

biglinux-improve-compatibility/usr/share/libalpm/hooks/biglinux-improve-compatibility-pcsclite-remove.hook

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ Target = pcsclite
66
[Action]
77
Description = Auto disable pcsclite after install
88
When = PreTransaction
9-
Exec = /bin/sh -c 'systemctl disable pcscd'
10-
9+
Exec = /bin/sh -c '{ [ -e /usr/lib/systemd/system/pcscd.service ] || [ -e /etc/systemd/system/pcscd.service ]; } && systemctl disable pcscd > /dev/null 2>&1'

0 commit comments

Comments
 (0)