--long verbose \
-- "$@")
+# shellcheck disable=SC2181
if (($? != 0)); then
usage
exit 1
exit 1
fi
else
- [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
+ [[ -f /etc/machine-id ]] && read -r MACHINE_ID < /etc/machine-id
if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
&& [[ $MACHINE_ID ]] \
fi
TMPDIR="$(mktemp -d -t lsinitrd.XXXXXX)"
+# shellcheck disable=SC2064
trap "rm -rf '$TMPDIR'" EXIT
dracutlibdirs() {
list_modules() {
echo "dracut modules:"
+ # shellcheck disable=SC2046
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
$(dracutlibdirs modules.txt) 2> /dev/null
((ret += $?))
fi
}
-read -N 2 bin < "$image"
+read -r -N 2 bin < "$image"
if [ "$bin" = "MZ" ]; then
command -v objcopy > /dev/null || {
echo "Need 'objcopy' to unpack an UEFI executable."
if ((${#filenames[@]} <= 0)) && [[ -z $unpack ]] && [[ -z $unpackearly ]]; then
if [ -n "$uefi" ]; then
echo -n "initrd in UEFI: $uefi: "
- du -h $image | while read a b || [ -n "$a" ]; do echo $a; done
+ du -h "$image" | while read -r a _ || [ -n "$a" ]; do echo "$a"; done
if [ -f "$TMPDIR/osrel.txt" ]; then
name=$(sed -En '/^PRETTY_NAME/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
id=$(sed -En '/^ID/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
fi
else
echo -n "Image: $image: "
- du -h $image | while read a b || [ -n "$a" ]; do echo $a; done
+ du -h "$image" | while read -r a _ || [ -n "$a" ]; do echo "$a"; done
fi
echo "========================================================================"
fi
-read -N 6 bin < "$image"
+read -r -N 6 bin < "$image"
case $bin in
$'\x71\xc7'* | 070701)
CAT="cat --"
esac
if [[ $SKIP ]]; then
- bin="$($SKIP "$image" | { read -N 6 bin && echo "$bin"; })"
+ bin="$($SKIP "$image" | { read -r -N 6 bin && echo "$bin"; })"
else
- read -N 6 bin < "$image"
+ read -r -N 6 bin < "$image"
fi
case $bin in
$'\x1f\x8b'*)
if ((${#filenames[@]} > 1)); then
TMPFILE="$TMPDIR/initrd.cpio"
- $CAT "$image" 2> /dev/null > $TMPFILE
+ $CAT "$image" 2> /dev/null > "$TMPFILE"
pre_decompress() {
- cat $TMPFILE
+ cat "$TMPFILE"
}
CAT=pre_decompress
fi
elif ((${#filenames[@]} > 0)); then
extract_files
else
+ # shellcheck disable=SC2046
version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
$(dracutlibdirs 'dracut-*') 2> /dev/null)
((ret += $?))
echo "========================================================================"
else
echo -n "Arguments: "
+ # shellcheck disable=SC2046
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
$(dracutlibdirs build-parameter.txt) 2> /dev/null
echo
fi
fi
-exit $ret
+exit "$ret"