Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shellcheck fixes #300

Merged
merged 7 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ex/apt/dpkg-status
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mkdir -p "$RUNDIR"
touched=0
errored=0

while read tag p0 p1 p2 p3 p4 pp; do
while read -r tag p0 p1 p2 p3 p4 pp; do
if [ "$tag" = 'status:' ] && [ "$p1" = 'unpacked' ]; then
if [ "$touched" = 0 ]; then
touch "$RUNDIR/unpacked"
Expand Down
6 changes: 4 additions & 2 deletions ex/notify.d/400-notify-send
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ case "$NR_SESSION" in
unset DBUS_SESSION_BUS_ADDRESS
fi

export DISPLAY=$(sed -z -n s/^DISPLAY=//p "/proc/$NR_SESSPPID/environ")
export XAUTHORITY=$(sed -z -n s/^XAUTHORITY=//p "/proc/$NR_SESSPPID/environ")
DISPLAY=$(sed -z -n s/^DISPLAY=//p "/proc/$NR_SESSPPID/environ")
export DISPLAY
XAUTHORITY=$(sed -z -n s/^XAUTHORITY=//p "/proc/$NR_SESSPPID/environ")
export XAUTHORITY

if [ -z "$DISPLAY" ]; then
echo "[$0] could not find DISPLAY for $NR_USERNAME on $NR_SESSION" 1>&2
Expand Down
8 changes: 4 additions & 4 deletions ex/restart.d/dbus.service
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

# by Vladimir Kudrya
# https://github.com/Vladimir-csp/
Expand Down Expand Up @@ -35,9 +35,9 @@ get_active_deps(){
{
systemctl list-dependencies -l --reverse --plain dbus.socket
systemctl list-dependencies -l --reverse --plain dbus.service
} | grep -o '[^[:space:]]\+.service' | sort -u | while read SERVICE
} | grep -o '[^[:space:]]\+.service' | sort -u | while read -r SERVICE
do
if [ "$SERVICE" != "dbus.service" -a "$SERVICE" != "$DISPLAY_MANAGER" ] && systemctl -q is-active "$SERVICE"
if [ "$SERVICE" != "dbus.service" ] && [ "$SERVICE" != "$DISPLAY_MANAGER" ] && systemctl -q is-active "$SERVICE"
then
echo "$SERVICE"
fi
Expand All @@ -62,7 +62,7 @@ $ACTIVE_DEPS
$DISPLAY_MANAGER
EOF

[ -t 0 ] && read -p "Press Enter to continue > " PRESSENTER
[ -t 0 ] && read -pr "Press Enter to continue > " PRESSENTER

# prepare list to be a CLI arg
ACTIVE_DEPS="$(echo "$ACTIVE_DEPS" | tr '\n' ' ')"
Expand Down
2 changes: 1 addition & 1 deletion lib/iucode-scan-versions
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ test -r /etc/default/intel-microcode && . /etc/default/intel-microcode
test "$IUCODE_TOOL_INITRAMFS" = "no" && exit 0

# run iucode_tool to scan for microcodes
if [ -r /usr/share/misc/intel-microcode* ]; then
if [ -n "$(find /usr/share/misc -maxdepth 1 -type f -name 'intel-microcode*' -perm /u+r)" ]; then
exec iucode_tool -l $filter --ignore-broken -tb /lib/firmware/intel-ucode -ta /usr/share/misc/intel-microcode* 2>&1
exit $?
fi
Expand Down
3 changes: 2 additions & 1 deletion lib/notify.d.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ fi
. "$GETTEXTLIB"

# Get LANG of session
export LANG=$(sed -z -n s/^LANG=//p "/proc/$NR_SESSPPID/environ")
LANG=$(sed -z -n s/^LANG=//p "/proc/$NR_SESSPPID/environ")
export LANG
8 changes: 4 additions & 4 deletions lib/vmlinuz-get-version
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ try_decompress()
# Try to find the header ($1) and decompress from here
for pos in $(tr "$1\n$2" "\n$2=" < "$img" | grep -abo "^$2"); do
pos=${pos%%:*}
tail -c+$pos "$img" | $3 > $tmp 2>/dev/null
get_version $tmp
tail -c+"$pos" "$img" | $3 > "$tmp" 2>/dev/null
get_version "$tmp"
done
}

Expand All @@ -50,10 +50,10 @@ fi

# Prepare temp files:
tmp=$(mktemp)
trap "rm -f $tmp" 0
trap 'rm -f "$tmp"' 0

# Initial attempt for uncompressed images or objects:
get_version $img
get_version "$img"

# That didn't work, so retry after decompression.
which gunzip > /dev/null && try_decompress '\037\213\010' xy gunzip
Expand Down