Skip to content

Commit 3771709

Browse files
bdrungConan-Kudo
authored andcommitted
fix: replace true by :
Calling the `true` command is not needed in most cases. Use the `:` no-operation command instead.
1 parent 8527214 commit 3771709

10 files changed

Lines changed: 20 additions & 20 deletions

File tree

dracut-functions.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ get_blockdev_drv_through_sys() {
648648
local _path
649649
650650
_path=$(realpath "$1")
651-
while true; do
651+
while :; do
652652
if [[ -L "$_path"/driver/module ]]; then
653653
_mod=$(realpath "$_path"/driver/module)
654654
_mod=$(basename "$_mod")
@@ -1538,7 +1538,7 @@ DRACUT_LDCONFIG=${DRACUT_LDCONFIG:-ldconfig}
15381538
DRACUT_TESTBIN=${DRACUT_TESTBIN:-/bin/sh}
15391539
15401540
if ! [[ "${DRACUT_INSTALL-}" ]]; then
1541-
DRACUT_INSTALL=$(find_binary dracut-install || true)
1541+
DRACUT_INSTALL=$(find_binary dracut-install || :)
15421542
fi
15431543
15441544
if ! [[ $DRACUT_INSTALL ]] && [[ -x "${BASH_SOURCE[0]%/*}/dracut-install" ]]; then

dracut-initramfs-restore.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ find_initrd_for_kernel_version() {
5252
fi
5353
}
5454

55-
mount -o ro /boot &> /dev/null || true
55+
mount -o ro /boot &> /dev/null || :
5656

5757
IMG=$(find_initrd_for_kernel_version "$KERNEL_VERSION")
5858
if [ -z "$IMG" ]; then

dracut.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ if [[ $regenerate_all == "yes" ]]; then
10861086
[[ -f $i/modules.dep ]] || [[ -f $i/modules.dep.bin ]] || continue
10871087
"$dracut_cmd" --kver="$i" "${dracut_args[@]}" &
10881088
done
1089-
while true; do
1089+
while :; do
10901090
wait -n
10911091
wst=$?
10921092
if [[ $wst == 127 ]]; then
@@ -1614,7 +1614,7 @@ module_check() {
16141614
[ $# -ge 2 ] && _forced=$2
16151615
[[ -f $_moddir/module-setup.sh ]] || return 1
16161616
unset "${module_functions[@]}"
1617-
check() { true; }
1617+
check() { :; }
16181618
# shellcheck disable=SC1090
16191619
. "$_moddir"/module-setup.sh
16201620
_is_func check || return 0
@@ -1658,7 +1658,7 @@ module_depends() {
16581658
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
16591659
[[ -f $_moddir/module-setup.sh ]] || return 1
16601660
unset "${module_functions[@]}"
1661-
depends() { true; }
1661+
depends() { :; }
16621662
# shellcheck disable=SC1090
16631663
. "$_moddir"/module-setup.sh
16641664
moddir=$_moddir depends
@@ -1676,7 +1676,7 @@ module_cmdline() {
16761676
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
16771677
[[ -f $_moddir/module-setup.sh ]] || return 1
16781678
unset "${module_functions[@]}"
1679-
cmdline() { true; }
1679+
cmdline() { :; }
16801680
# shellcheck disable=SC1090
16811681
. "$_moddir"/module-setup.sh
16821682
moddir="$_moddir" cmdline
@@ -1694,7 +1694,7 @@ module_config() {
16941694
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
16951695
[[ -f $_moddir/module-setup.sh ]] || return 1
16961696
unset "${module_functions[@]}"
1697-
config() { true; }
1697+
config() { :; }
16981698
# shellcheck disable=SC1090
16991699
. "$_moddir"/module-setup.sh
17001700
moddir="$_moddir" config
@@ -1712,7 +1712,7 @@ module_install() {
17121712
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
17131713
[[ -f $_moddir/module-setup.sh ]] || return 1
17141714
unset "${module_functions[@]}"
1715-
install() { true; }
1715+
install() { :; }
17161716
# shellcheck disable=SC1090
17171717
. "$_moddir"/module-setup.sh
17181718
moddir="$_moddir" install
@@ -1730,7 +1730,7 @@ module_installkernel() {
17301730
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
17311731
[[ -f $_moddir/module-setup.sh ]] || return 1
17321732
unset "${module_functions[@]}"
1733-
installkernel() { true; }
1733+
installkernel() { :; }
17341734
# shellcheck disable=SC1090
17351735
. "$_moddir"/module-setup.sh
17361736
moddir="$_moddir" installkernel

modules.d/11systemd-networkd/networkd-run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ for ifpath in /sys/class/net/*; do
1515
grep -E "^(NEXT_SERVER|ROOT_PATH)=" "$leases_file" \
1616
| sed -e "s/NEXT_SERVER=/new_next_server='/" \
1717
-e "s/ROOT_PATH=/new_root_path='/" \
18-
-e "s/$/'/" > "$dhcpopts_file" || true
18+
-e "s/$/'/" > "$dhcpopts_file" || :
1919
fi
2020

2121
source_hook initqueue/online "$ifname"

modules.d/68lvmthinpool-monitor/start-thinpool-monitor.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ if [ -n "$THIN_POOLS" ]; then
3737
lvm lvchange -ay "$THIN_POOL" --config "$CONFIG"
3838
done
3939

40-
while true; do
40+
while :; do
4141
for THIN_POOL in $THIN_POOLS; do
4242
lvm lvextend --use-policies --config "$CONFIG" "$THIN_POOL"
4343
done

modules.d/70crypt/crypt-cleanup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
rm -f -- /etc/udev/rules.d/70-luks.rules > /dev/null 2>&1
55

66
if ! getarg rd.luks.uuid > /dev/null 2>&1 && getargbool 1 rd.luks > /dev/null 2>&1; then
7-
while true; do
7+
while :; do
88
local do_break="y"
99
for i in /dev/mapper/luks-*; do
1010
cryptsetup luksClose "$i" > /dev/null 2>&1 && do_break=n

modules.d/70lvm/lvm_scan.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ no_lvm_conf_filter() {
6565
fi
6666

6767
# /etc/lvm/lvm.conf exists with no filter setting
68-
true > /run/lvm/initrd_no_filter
68+
: > /run/lvm/initrd_no_filter
6969
return 0
7070
}
7171

modules.d/71overlayfs-crypt/overlayfs-crypt-lib.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ generate_random_password() {
4444

4545
entropy_sources="/proc/sys/kernel/random/boot_id /proc/sys/kernel/random/uuid /dev/urandom"
4646

47-
stat -L /dev/* /proc/* /sys/* > "$tmpf" 2>&1 || true
47+
stat -L /dev/* /proc/* /sys/* > "$tmpf" 2>&1 || :
4848

4949
for src in $entropy_sources; do
5050
[ -e "$src" ] && head -c 4096 "$src" >> "$tmpf" 2> /dev/null
@@ -142,8 +142,8 @@ overlayfs_crypt_setup() {
142142

143143
info "Setting up encrypted overlay on $dev"
144144

145-
modprobe -q dm_mod 2> /dev/null || true
146-
modprobe -q dm_crypt 2> /dev/null || true
145+
modprobe -q dm_mod 2> /dev/null || :
146+
modprobe -q dm_crypt 2> /dev/null || :
147147

148148
crypt_dev="/dev/mapper/$mapname"
149149

@@ -189,7 +189,7 @@ overlayfs_crypt_setup() {
189189
warn "luksOpen failed on $dev"
190190
return 1
191191
fi
192-
udevadm settle 2> /dev/null || true
192+
udevadm settle 2> /dev/null || :
193193

194194
info "LUKS device opened, waiting for $crypt_dev"
195195

test/TEST-30-DMSQUASH/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ check_autooverlay_marker() {
5757
# Reset root.img to single partition state for autooverlay test
5858
reset_overlay_partition() {
5959
test_marker_reset
60-
sfdisk --delete "$TESTDIR"/root.img 2 2> /dev/null || true
60+
sfdisk --delete "$TESTDIR"/root.img 2 2> /dev/null || :
6161
dd if=/dev/zero of="$TESTDIR"/root.img bs=1M seek=320 count=50 conv=notrunc status=none
6262
local rootPartitions
6363
rootPartitions=$(sfdisk -d "$TESTDIR"/root.img | grep -c 'root\.img[0-9]')

test/test-functions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ DRACUT=${DRACUT-dracut}
1818
PKGLIBDIR=${PKGLIBDIR-$basedir}
1919

2020
if [[ -f /etc/machine-id ]]; then
21-
read -r TOKEN < /etc/machine-id || true
21+
read -r TOKEN < /etc/machine-id || :
2222
fi
2323
[ -z "${TOKEN-}" ] && . /etc/os-release && TOKEN="$ID"
2424

0 commit comments

Comments
 (0)