Replace echo -n with printf in code with a /bin/sh shebang
POSIX does not mandate that echo support the -n parameter. printf has more well-defined behavior.master
parent
ee44f62972
commit
5899f2f516
|
|
@ -1,2 +1,2 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
[ -c /dev/watchdog ] && echo -n 'V' > /dev/watchdog
|
[ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ set_ifname() {
|
||||||
fix_bootif() {
|
fix_bootif() {
|
||||||
local macaddr=${1}
|
local macaddr=${1}
|
||||||
local IFS='-'
|
local IFS='-'
|
||||||
macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
|
macaddr=$(printf '%s:' ${macaddr})
|
||||||
macaddr=${macaddr%:}
|
macaddr=${macaddr%:}
|
||||||
# strip hardware type field from pxelinux
|
# strip hardware type field from pxelinux
|
||||||
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
|
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ print_s390() {
|
||||||
for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
|
for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
|
||||||
[ -e $i ] || continue
|
[ -e $i ] || continue
|
||||||
channel=$(readlink -f $i)
|
channel=$(readlink -f $i)
|
||||||
echo -n "${channel##*/},"
|
printf '%s' "${channel##*/},"
|
||||||
done
|
done
|
||||||
})
|
})
|
||||||
[ -n "$SUBCHANNELS" ] || return 1
|
[ -n "$SUBCHANNELS" ] || return 1
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,14 @@ SNAPSIZE=$(getargs rd.lvm.snapsize -d rd_LVM_SNAPSIZE=)
|
||||||
lvmdevs=$(
|
lvmdevs=$(
|
||||||
for f in /tmp/.lvm_scan-*; do
|
for f in /tmp/.lvm_scan-*; do
|
||||||
[ -e "$f" ] || continue
|
[ -e "$f" ] || continue
|
||||||
echo -n "${f##/tmp/.lvm_scan-} "
|
printf '%s' "${f##/tmp/.lvm_scan-} "
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
|
|
||||||
if [ ! -e /etc/lvm/lvm.conf ]; then
|
if [ ! -e /etc/lvm/lvm.conf ]; then
|
||||||
{
|
{
|
||||||
echo 'devices {';
|
echo 'devices {';
|
||||||
echo -n ' filter = [ '
|
printf ' filter = [ '
|
||||||
for dev in $lvmdevs; do
|
for dev in $lvmdevs; do
|
||||||
printf '"a|^/dev/%s$|", ' $dev;
|
printf '"a|^/dev/%s$|", ' $dev;
|
||||||
done;
|
done;
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ elif [ "$netdriver" = "bnx2x" ]; then
|
||||||
sleep 3
|
sleep 3
|
||||||
fipvlan "$netif" -c -s
|
fipvlan "$netif" -c -s
|
||||||
else
|
else
|
||||||
echo -n "$netif" > /sys/module/fcoe/parameters/create
|
printf '%s' "$netif" > /sys/module/fcoe/parameters/create
|
||||||
fi
|
fi
|
||||||
|
|
||||||
need_shutdown
|
need_shutdown
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ filtersubvol() {
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
subvol\=*) :;;
|
subvol\=*) :;;
|
||||||
*) echo -n "${1}," ;;
|
*) printf '%s' "${1}," ;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -298,7 +298,7 @@ _dogetargs() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ -n "$_found" ]; then
|
if [ -n "$_found" ]; then
|
||||||
[ $# -gt 0 ] && echo -n "$@"
|
[ $# -gt 0 ] && printf '%s' "$*"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -329,9 +329,9 @@ getargs() {
|
||||||
done
|
done
|
||||||
if [ -n "$_gfound" ]; then
|
if [ -n "$_gfound" ]; then
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
echo -n "$@"
|
printf '%s' "$*"
|
||||||
else
|
else
|
||||||
echo -n 1
|
printf 1
|
||||||
fi
|
fi
|
||||||
debug_on
|
debug_on
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,7 @@ while :; do
|
||||||
done
|
done
|
||||||
|
|
||||||
{
|
{
|
||||||
echo -n "Mounted root filesystem "
|
printf "Mounted root filesystem "
|
||||||
while read dev mp rest || [ -n "$dev" ]; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
|
while read dev mp rest || [ -n "$dev" ]; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
|
||||||
} | vinfo
|
} | vinfo
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sda2 /d
|
||||||
# randomly.
|
# randomly.
|
||||||
mdadm -W /dev/md0
|
mdadm -W /dev/md0
|
||||||
set -e
|
set -e
|
||||||
echo -n test >keyfile
|
printf test >keyfile
|
||||||
cryptsetup -q luksFormat /dev/md0 /keyfile
|
cryptsetup -q luksFormat /dev/md0 /keyfile
|
||||||
echo "The passphrase is test"
|
echo "The passphrase is test"
|
||||||
cryptsetup luksOpen /dev/md0 dracut_crypt_test </keyfile
|
cryptsetup luksOpen /dev/md0 dracut_crypt_test </keyfile
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
[ -b "/dev/mapper/$2" ] && exit 0
|
[ -b "/dev/mapper/$2" ] && exit 0
|
||||||
echo -n test >/keyfile
|
printf test >/keyfile
|
||||||
/sbin/cryptsetup luksOpen "$1" "$2" </keyfile
|
/sbin/cryptsetup luksOpen "$1" "$2" </keyfile
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sdb /de
|
||||||
# wait for the array to finish initailizing, otherwise this sometimes fails
|
# wait for the array to finish initailizing, otherwise this sometimes fails
|
||||||
# randomly.
|
# randomly.
|
||||||
mdadm -W /dev/md0
|
mdadm -W /dev/md0
|
||||||
echo -n test >keyfile
|
printf test >keyfile
|
||||||
cryptsetup -q luksFormat /dev/md0 /keyfile
|
cryptsetup -q luksFormat /dev/md0 /keyfile
|
||||||
echo "The passphrase is test"
|
echo "The passphrase is test"
|
||||||
set -e
|
set -e
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
[ -b /dev/mapper/$2 ] && exit 0
|
[ -b /dev/mapper/$2 ] && exit 0
|
||||||
echo -n test >/keyfile
|
printf test >/keyfile
|
||||||
/sbin/cryptsetup luksOpen $1 $2 </keyfile
|
/sbin/cryptsetup luksOpen $1 $2 </keyfile
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ sfdisk /dev/sda <<EOF
|
||||||
,25M
|
,25M
|
||||||
EOF
|
EOF
|
||||||
udevadm settle
|
udevadm settle
|
||||||
echo -n test >keyfile
|
printf test >keyfile
|
||||||
cryptsetup -q luksFormat /dev/sda2 /keyfile
|
cryptsetup -q luksFormat /dev/sda2 /keyfile
|
||||||
cryptsetup -q luksFormat /dev/sda3 /keyfile
|
cryptsetup -q luksFormat /dev/sda3 /keyfile
|
||||||
cryptsetup -q luksFormat /dev/sda4 /keyfile
|
cryptsetup -q luksFormat /dev/sda4 /keyfile
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
[ -b /dev/mapper/$2 ] && exit 0
|
[ -b /dev/mapper/$2 ] && exit 0
|
||||||
echo -n test >/keyfile
|
printf test >/keyfile
|
||||||
/sbin/cryptsetup luksOpen $1 $2 </keyfile
|
/sbin/cryptsetup luksOpen $1 $2 </keyfile
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
[ -b /dev/mapper/$2 ] && exit 0
|
[ -b /dev/mapper/$2 ] && exit 0
|
||||||
echo -n test >/keyfile
|
printf test >/keyfile
|
||||||
/sbin/cryptsetup luksOpen $1 $2 </keyfile
|
/sbin/cryptsetup luksOpen $1 $2 </keyfile
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ strstr() { [ "${1##*"$2"*}" != "$1" ]; }
|
||||||
|
|
||||||
stty sane
|
stty sane
|
||||||
if strstr "$CMDLINE" "rd.shell"; then
|
if strstr "$CMDLINE" "rd.shell"; then
|
||||||
[ -c /dev/watchdog ] && echo -n 'V' > /dev/watchdog
|
[ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
|
||||||
strstr "$(setsid --help)" "control" && CTTY="-c"
|
strstr "$(setsid --help)" "control" && CTTY="-c"
|
||||||
setsid $CTTY sh -i
|
setsid $CTTY sh -i
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
|
||||||
done
|
done
|
||||||
rm -f -- /etc/lvm/lvm.conf
|
rm -f -- /etc/lvm/lvm.conf
|
||||||
udevadm control --reload
|
udevadm control --reload
|
||||||
echo -n test >keyfile
|
printf test >keyfile
|
||||||
cryptsetup -q luksFormat /dev/sdb /keyfile
|
cryptsetup -q luksFormat /dev/sdb /keyfile
|
||||||
echo "The passphrase is test"
|
echo "The passphrase is test"
|
||||||
cryptsetup luksOpen /dev/sdb dracut_crypt_test </keyfile && \
|
cryptsetup luksOpen /dev/sdb dracut_crypt_test </keyfile && \
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
[ -b /dev/mapper/$2 ] && exit 0
|
[ -b /dev/mapper/$2 ] && exit 0
|
||||||
echo -n test >/keyfile
|
printf test >/keyfile
|
||||||
/sbin/cryptsetup luksOpen $1 $2 </keyfile
|
/sbin/cryptsetup luksOpen $1 $2 </keyfile
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue