Browse Source

fix: shellcheck for modules.d/99base/module-setup.sh

master
Harald Hoyer 4 years ago committed by Harald Hoyer
parent
commit
18ff79021c
  1. 30
      modules.d/99base/module-setup.sh

30
modules.d/99base/module-setup.sh

@ -13,8 +13,6 @@ depends() {


# called by dracut # called by dracut
install() { install() {
local _d

inst_multiple mount mknod mkdir sleep chroot chown \ inst_multiple mount mknod mkdir sleep chroot chown \
sed ls flock cp mv dmesg rm ln rmmod mkfifo umount readlink setsid \ sed ls flock cp mv dmesg rm ln rmmod mkfifo umount readlink setsid \
modprobe modprobe
@ -30,9 +28,9 @@ install() {
# use password for hostonly images to facilitate secure sulogin in emergency console # use password for hostonly images to facilitate secure sulogin in emergency console
[[ $hostonly ]] && pwshadow='x' [[ $hostonly ]] && pwshadow='x'
grep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo "root:$pwshadow:0:0::/root:/bin/sh" >> "$initdir/etc/passwd" grep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo "root:$pwshadow:0:0::/root:/bin/sh" >> "$initdir/etc/passwd"
grep '^nobody:' $dracutsysrootdir/etc/passwd >> "$initdir/etc/passwd" grep '^nobody:' "$dracutsysrootdir"/etc/passwd >> "$initdir/etc/passwd"


[[ $hostonly ]] && grep '^root:' $dracutsysrootdir/etc/shadow >> "$initdir/etc/shadow" [[ $hostonly ]] && grep '^root:' "$dracutsysrootdir"/etc/shadow >> "$initdir/etc/shadow"


# install our scripts and hooks # install our scripts and hooks
inst_script "$moddir/init.sh" "/init" inst_script "$moddir/init.sh" "/init"
@ -40,14 +38,14 @@ install() {
inst_script "$moddir/loginit.sh" "/sbin/loginit" inst_script "$moddir/loginit.sh" "/sbin/loginit"
inst_script "$moddir/rdsosreport.sh" "/sbin/rdsosreport" inst_script "$moddir/rdsosreport.sh" "/sbin/rdsosreport"


[ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib [ -e "${initdir}/lib" ] || mkdir -m 0755 -p "${initdir}"/lib
mkdir -m 0755 -p ${initdir}/lib/dracut mkdir -m 0755 -p "${initdir}"/lib/dracut
mkdir -m 0755 -p ${initdir}/lib/dracut/hooks mkdir -m 0755 -p "${initdir}"/lib/dracut/hooks


mkdir -p ${initdir}/tmp mkdir -p "${initdir}"/tmp


inst_simple "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh" inst_simple "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
mkdir -p "${initdir}/var" mkdir -p "${initdir}"/var


if ! dracut_module_included "systemd"; then if ! dracut_module_included "systemd"; then
inst_multiple switch_root || dfatal "Failed to install switch_root" inst_multiple switch_root || dfatal "Failed to install switch_root"
@ -71,9 +69,9 @@ install() {
local VERSION="" local VERSION=""
local PRETTY_NAME="" local PRETTY_NAME=""
# Derive an os-release file from the host, if it exists # Derive an os-release file from the host, if it exists
if [ -e $dracutsysrootdir/etc/os-release ]; then if [[ -e $dracutsysrootdir/etc/os-release ]]; then
. $dracutsysrootdir/etc/os-release . "$dracutsysrootdir"/etc/os-release
grep -hE -ve '^VERSION=' -ve '^PRETTY_NAME' $dracutsysrootdir/etc/os-release >${initdir}/usr/lib/initrd-release grep -hE -ve '^VERSION=' -ve '^PRETTY_NAME' "$dracutsysrootdir"/etc/os-release >"${initdir}"/usr/lib/initrd-release
[[ -n ${VERSION} ]] && VERSION+=" " [[ -n ${VERSION} ]] && VERSION+=" "
[[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" " [[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
else else
@ -95,18 +93,18 @@ install() {
# to easily detect the dracut version if need be without # to easily detect the dracut version if need be without
# having it mixed in with the real underlying OS version. # having it mixed in with the real underlying OS version.
echo DRACUT_VERSION=\"${DRACUT_VERSION}\" echo DRACUT_VERSION=\"${DRACUT_VERSION}\"
} >> $initdir/usr/lib/initrd-release } >> "$initdir"/usr/lib/initrd-release
echo dracut-$DRACUT_VERSION > $initdir/lib/dracut/dracut-$DRACUT_VERSION echo "dracut-$DRACUT_VERSION" > "$initdir/lib/dracut/dracut-$DRACUT_VERSION"
ln -sf ../usr/lib/initrd-release $initdir/etc/initrd-release ln -sf ../usr/lib/initrd-release $initdir/etc/initrd-release
ln -sf initrd-release $initdir/usr/lib/os-release ln -sf initrd-release $initdir/usr/lib/os-release
ln -sf initrd-release $initdir/etc/os-release ln -sf initrd-release $initdir/etc/os-release


## save host_devs which we need bring up ## save host_devs which we need bring up
if [[ $hostonly_cmdline == "yes" ]]; then if [[ $hostonly_cmdline == "yes" ]]; then
if [[ -n "${host_devs[@]}" ]]; then if [[ -n "${host_devs[*]}" ]]; then
dracut_need_initqueue dracut_need_initqueue
fi fi
if [[ -f "$initdir/lib/dracut/need-initqueue" ]] || ! dracut_module_included "systemd"; then if [[ -f $initdir/lib/dracut/need-initqueue ]] || ! dracut_module_included "systemd"; then
( (
if dracut_module_included "systemd"; then if dracut_module_included "systemd"; then
DRACUT_SYSTEMD=1 DRACUT_SYSTEMD=1

Loading…
Cancel
Save