Skip to content

Commit

Permalink
Fix shellcheck warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Gladkov <[email protected]>
  • Loading branch information
legionus committed Aug 4, 2021
1 parent 73f789f commit c0a7d1a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
4 changes: 3 additions & 1 deletion data/etc/rc.d/init.d/killall
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

processes()
{
for pid in $(cd /proc; printf '%s\n' [0-9]* |sort -g); do
for pid in $(cd /proc || exit; printf '%s\n' [0-9]* |sort -g); do
f="/proc/$pid"

[ -e "$f/cmdline" ] ||
Expand All @@ -30,6 +30,7 @@ processes()
uid='' name='' pid='' ppid='' state='' cmdline='' n='' v=''

{
# shellcheck disable=SC2162
while read n v _; do
case "$n" in
"Name:") name="$v" ;;
Expand All @@ -40,6 +41,7 @@ processes()
esac
done < "$f/status"

# shellcheck disable=SC2162
while read -d '' v; do
cmdline="${cmdline:+$cmdline }$v"
done < "$f/cmdline"
Expand Down
4 changes: 2 additions & 2 deletions data/etc/rc.d/init.d/mountfs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ stop()
continue
case "$t" in
/dev) ;;
$rootmnt|$rootmnt/*) [ -z "${UMOUNT_ROOTMNT-}" ] || printf '%s ' "$t" ;;
"$rootmnt"|"$rootmnt"/*) [ -z "${UMOUNT_ROOTMNT-}" ] || printf '%s ' "$t" ;;
*) printf '%s ' "$t" ;;
esac
done
Expand All @@ -142,7 +142,7 @@ stop()
continue
case "$t" in
/|/proc) ;;
$rootmnt|$rootmnt/*) [ -z "${UMOUNT_ROOTMNT-}" ] || printf '%s ' "$t" ;;
"$rootmnt"|"$rootmnt"/*) [ -z "${UMOUNT_ROOTMNT-}" ] || printf '%s ' "$t" ;;
*) printf '%s ' "$t" ;;
esac
done
Expand Down
1 change: 1 addition & 0 deletions features/mdadm/bin/generate-udev-rules
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
fatal "unable to find device name in \`$SYSFS_PATH/dev/block/$1/uevent'"

MD_UUID=
# shellcheck disable=SC2046
eval $(mdadm --detail --export "/dev/$DEVNAME")

[ -n "$MD_UUID" ] ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ is_raid()
{
local MD_UUID='' MD_DEVICES='' MD_METADATA='' MD_DEVNAME='' MD_NAME=''

# shellcheck disable=SC2046
eval $(mdadm --detail --export "/dev/block/$1")

[ -n "$MD_UUID" ] && [ -f "/etc/initrd/md/${MD_UUID//:}" ] ||
Expand Down
10 changes: 4 additions & 6 deletions features/sshfsroot/bin/get-dirs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/bin/bash -efu

DIR="$WORKDIR/root"
mkdir -p -- \
"$DIR/home/root"

mkdir -p -m 700 -- "$DIR/home/root/.ssh"
mkdir -p -- "$DIR/home/root/.ssh"
chmod 700 -- "$DIR/home/root/.ssh"

if [ -n "${SSHFS_KEY-}" ]; then
cp -- "$SSHFS_KEY" "$DIR/home/root/.ssh/id_key"
Expand All @@ -16,10 +14,10 @@ for f in ${SSHFS_KEYS-}; do
chmod 600 -- "$DIR/home/root/.ssh/${f##*/}"
done

[ ! -n "${SSHFS_KNOWN_HOSTS-}" ] ||
[ -z "${SSHFS_KNOWN_HOSTS-}" ] ||
cp -- "$SSHFS_KNOWN_HOSTS" "$DIR/home/root/.ssh/known_hosts"

[ ! -n "${SSHFS_CONFIG-}" ] ||
[ -z "${SSHFS_CONFIG-}" ] ||
cp -- "$SSHFS_CONFIG" "$DIR/home/root/.ssh/config"

printf '%s\n' "$DIR"
5 changes: 3 additions & 2 deletions tools/create-initrd
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ append_progs()

append_libs()
{
local n fn
local SEARCH_PATH=$(ldconfig -vNX 2>/dev/null | grep ^/ | cut -d: -f1)
local n fn SEARCH_PATH

SEARCH_PATH="$(ldconfig -vNX 2>/dev/null | grep ^/ | cut -d: -f1)"

for n; do
[ -n "$n" ] ||
Expand Down

0 comments on commit c0a7d1a

Please sign in to comment.