Skip to content

Commit 8a74a7d

Browse files
committed
Fix issues found by shellcheck
Specifically: SC2268 (style): Avoid x-prefix in comparisons as it no longer serves a purpose.
1 parent b7cc353 commit 8a74a7d

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

archlinux/PKGBUILD.install

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ configure_systemd() {
285285
# fix / ro mounted
286286
ln -sf /usr/lib/systemd/system/systemd-remount-fs.service /etc/systemd/system/sysinit.target.wants/
287287

288-
if [ "x$changed" != "x" ]
288+
if [ -n "$changed" ]
289289
then
290290
systemctl daemon-reload
291291
fi
@@ -442,7 +442,7 @@ post_remove() {
442442
changed=true
443443
fi
444444

445-
if [ "x$changed" != "x" ]
445+
if [ -n "$changed" ]
446446
then
447447
systemctl daemon-reload
448448
fi

init/functions

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ umount_retry() {
118118
get_mac_from_iface() {
119119
local iface="$1"
120120
local mac=
121-
if [ "x$iface" != "x" ] && [ -e "/sys/class/net/$iface" ]; then
121+
if [ -n "$iface" ] && [ -e "/sys/class/net/$iface" ]; then
122122
mac="$(cat "/sys/class/net/$iface/address")"
123123
fi
124124
echo "$mac"
@@ -127,7 +127,7 @@ get_mac_from_iface() {
127127
get_iface_from_mac() {
128128
local mac="$1"
129129
local iface=
130-
if [ "x$mac" != "x" ]; then
130+
if [ -n "$mac" ]; then
131131
iface="$(ip -o link | grep -i "$mac" | awk '{print $2}' | cut -d ':' -f1)"
132132
fi
133133
echo "$iface"
@@ -144,7 +144,7 @@ get_qubes_managed_iface() {
144144
# Load the module explicitly here, to avoid waiting for udev doing that
145145
[ -e /sys/module/xen_netfront ] || modprobe xen-netfront || :
146146
qubes_iface="$(get_iface_from_mac "$mac")"
147-
if [ "x$qubes_iface" != "x" ]; then
147+
if [ -n "$qubes_iface" ]; then
148148
echo "$qubes_iface"
149149
elif [ -e /sys/class/net/eth0 ]; then
150150
echo eth0
@@ -159,7 +159,7 @@ get_prefix_from_subnet() {
159159
x=${1%%"$3"*}
160160
prefix=$(( $2 + (${#x}/4) ))
161161

162-
if [ "x$prefix" != "x" ]; then
162+
if [ -n "$prefix" ]; then
163163
echo "$prefix"
164164
else
165165
echo "32"

vm-systemd/network-uplink-wait.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Setup IP address at specific time of system boot, instead of asynchronously
88
# by udev
99
QUBES_MANAGED_IFACE="$(get_qubes_managed_iface)"
10-
if [ "x$QUBES_MANAGED_IFACE" != "x" ]; then
10+
if [ -n "$QUBES_MANAGED_IFACE" ]; then
1111
# systemd does not support conditional After= dependencies, nor a tool to
1212
# just wait for the unit to be activated
1313
# if the network interface is expected, use `systemctl start` to wait for

0 commit comments

Comments
 (0)