Allow running on a cross-compiled rootfs
For the shell scripts, new environment variables were introduced. dracutsysrootdir is the root directory, file existence checks use it. DRACUT_LDCONFIG can override ldconfig with a different one that works on the sysroot with foreign binaries. DRACUT_LDD can override ldd with a different one that works with foreign binaries. DRACUT_TESTBIN can override /bin/sh. A cross-compiled sysroot may use symlinks that are valid only when running on the target so a real file must be provided that exist in the sysroot. DRACUT_INSTALL now supports debugging dracut-install in itself when run by dracut but without debugging the dracut scripts. E.g. DRACUT_INSTALL="valgrind dracut-install or DRACUT_INSTALL="dracut-install --debug". DRACUT_COMPRESS_BZIP2, DRACUT_COMPRESS_LBZIP2, DRACUT_COMPRESS_LZMA, DRACUT_COMPRESS_XZ, DRACUT_COMPRESS_GZIP, DRACUT_COMPRESS_PIGZ, DRACUT_COMPRESS_LZOP, DRACUT_COMPRESS_ZSTD, DRACUT_COMPRESS_LZ4, DRACUT_COMPRESS_CAT: All of the compression utilities may be overridden, to support the native binaries in non-standard places. DRACUT_ARCH overrides "uname -m". SYSTEMD_VERSION overrides "systemd --version". The dracut-install utility was overhauled to support sysroot via a new option -r and fixes for clang-analyze. It supports cross-compiler-ldd from https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f DRACUT_INSTALL_PATH was introduced so dracut-install can work with a different PATH. In a cross-compiled environment (e.g. Yocto), PATH points to natively built binaries that are not in the host's /bin, /usr/bin, etc. dracut-install still needs plain /bin and /usr/bin that are relative to the cross-compiled sysroot. The hashmap pool allocate_tile/deallocate_tile code was removed because clang-analyze showed errors in it. hashmap_copy was removed because it wasn't used and clang-analyze showed errors in it. DRACUT_INSTALL_LOG_TARGET and DRACUT_INSTALL_LOG_LEVEL were introduced so dracut-install can use different settings from DRACUT_LOG_TARGET and DRACUT_LOG_LEVEL. Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>master
parent
89bc1aa324
commit
a01204202b
|
@ -40,19 +40,43 @@ str_ends() { [ "${1%*"$2"}" != "$1" ]; }
|
||||||
# find a binary. If we were not passed the full path directly,
|
# find a binary. If we were not passed the full path directly,
|
||||||
# search in the usual places to find the binary.
|
# search in the usual places to find the binary.
|
||||||
find_binary() {
|
find_binary() {
|
||||||
if [[ -z ${1##/*} ]]; then
|
local _delim
|
||||||
if [[ -x $1 ]] || { [[ "$1" == *.so* ]] && ldd "$1" &>/dev/null; }; then
|
local l
|
||||||
|
local p
|
||||||
|
[[ -z ${1##/*} ]] || _delim="/"
|
||||||
|
|
||||||
|
if [[ "$1" == *.so* ]]; then
|
||||||
|
for l in libdirs ; do
|
||||||
|
if { $DRACUT_LDD "$dracutsysrootdir$l$_delim$1" &>/dev/null; }; then
|
||||||
|
printf "%s\n" "$1"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if { $DRACUT_LDD "$dracutsysrootdir$_delim$1" &>/dev/null; }; then
|
||||||
printf "%s\n" "$1"
|
printf "%s\n" "$1"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [[ "$1" == */* ]]; then
|
||||||
|
if [[ -L $dracutsysrootdir$_delim$1 ]] || [[ -x $dracutsysrootdir$_delim$1 ]]; then
|
||||||
|
printf "%s\n" "$1"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
for p in $DRACUT_PATH ; do
|
||||||
|
if [[ -L $dracutsysrootdir$p$_delim$1 ]] || [[ -x $dracutsysrootdir$p$_delim$1 ]]; then
|
||||||
|
printf "%s\n" "$1"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
[[ -n "$dracutsysrootdir" ]] && return 1
|
||||||
type -P "${1##*/}"
|
type -P "${1##*/}"
|
||||||
}
|
}
|
||||||
|
|
||||||
ldconfig_paths()
|
ldconfig_paths()
|
||||||
{
|
{
|
||||||
ldconfig -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
|
$DRACUT_LDCONFIG ${dracutsysrootdir:+-r ${dracutsysrootdir} -f /etc/ld.so.conf} -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
|
||||||
}
|
}
|
||||||
|
|
||||||
# Version comparision function. Assumes Linux style version scheme.
|
# Version comparision function. Assumes Linux style version scheme.
|
||||||
|
@ -633,9 +657,9 @@ check_kernel_config()
|
||||||
{
|
{
|
||||||
local _config_opt="$1"
|
local _config_opt="$1"
|
||||||
local _config_file
|
local _config_file
|
||||||
[[ -f /boot/config-$kernel ]] \
|
[[ -f $dracutsysrootdir/boot/config-$kernel ]] \
|
||||||
&& _config_file="/boot/config-$kernel"
|
&& _config_file="/boot/config-$kernel"
|
||||||
[[ -f /lib/modules/$kernel/config ]] \
|
[[ -f $dracutsysrootdir/lib/modules/$kernel/config ]] \
|
||||||
&& _config_file="/lib/modules/$kernel/config"
|
&& _config_file="/lib/modules/$kernel/config"
|
||||||
|
|
||||||
# no kernel config file, so return true
|
# no kernel config file, so return true
|
||||||
|
|
|
@ -57,7 +57,7 @@ if ! [[ $kernel ]]; then
|
||||||
export kernel
|
export kernel
|
||||||
fi
|
fi
|
||||||
|
|
||||||
srcmods="/lib/modules/$kernel/"
|
srcmods="$dracutsysrootdir/lib/modules/$kernel/"
|
||||||
|
|
||||||
[[ $drivers_dir ]] && {
|
[[ $drivers_dir ]] && {
|
||||||
if ! command -v kmod &>/dev/null && vercmp "$(modprobe --version | cut -d' ' -f3)" lt 3.7; then
|
if ! command -v kmod &>/dev/null && vercmp "$(modprobe --version | cut -d' ' -f3)" lt 3.7; then
|
||||||
|
@ -79,17 +79,21 @@ export srcmods
|
||||||
export hookdirs
|
export hookdirs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DRACUT_LDD=${DRACUT_LDD:-ldd}
|
||||||
|
DRACUT_TESTBIN=${DRACUT_TESTBIN:-/bin/sh}
|
||||||
|
DRACUT_LDCONFIG=${DRACUT_LDCONFIG:-ldconfig}
|
||||||
|
|
||||||
. $dracutbasedir/dracut-functions.sh
|
. $dracutbasedir/dracut-functions.sh
|
||||||
|
|
||||||
# Detect lib paths
|
# Detect lib paths
|
||||||
if ! [[ $libdirs ]] ; then
|
if ! [[ $libdirs ]] ; then
|
||||||
if [[ "$(ldd /bin/sh)" == */lib64/* ]] &>/dev/null \
|
if [[ "$($DRACUT_LDD $dracutsysrootdir$DRACUT_TESTBIN)" == */lib64/* ]] &>/dev/null \
|
||||||
&& [[ -d /lib64 ]]; then
|
&& [[ -d $dracutsysrootdir/lib64 ]]; then
|
||||||
libdirs+=" /lib64"
|
libdirs+=" /lib64"
|
||||||
[[ -d /usr/lib64 ]] && libdirs+=" /usr/lib64"
|
[[ -d $dracutsysrootdir/usr/lib64 ]] && libdirs+=" /usr/lib64"
|
||||||
else
|
else
|
||||||
libdirs+=" /lib"
|
libdirs+=" /lib"
|
||||||
[[ -d /usr/lib ]] && libdirs+=" /usr/lib"
|
[[ -d $dracutsysrootdir/usr/lib ]] && libdirs+=" /usr/lib"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
libdirs+=" $(ldconfig_paths)"
|
libdirs+=" $(ldconfig_paths)"
|
||||||
|
@ -168,7 +172,18 @@ elif ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/install/dracut-install ]];
|
||||||
DRACUT_INSTALL=$dracutbasedir/install/dracut-install
|
DRACUT_INSTALL=$dracutbasedir/install/dracut-install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [[ -x $DRACUT_INSTALL ]]; then
|
# Test if dracut-install is a standalone executable with no options.
|
||||||
|
# E.g. DRACUT_INSTALL may be set externally as:
|
||||||
|
# DRACUT_INSTALL="valgrind dracut-install"
|
||||||
|
# or
|
||||||
|
# DRACUT_INSTALL="dracut-install --debug"
|
||||||
|
# in which case the string cannot be tested for being executable.
|
||||||
|
DRINSTALLPARTS=0
|
||||||
|
for i in $DRACUT_INSTALL ; do
|
||||||
|
DRINSTALLPARTS=$(($DRINSTALLPARTS+1))
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $DRINSTALLPARTS = 1 ]] && ! [[ -x $DRACUT_INSTALL ]]; then
|
||||||
dfatal "dracut-install not found!"
|
dfatal "dracut-install not found!"
|
||||||
exit 10
|
exit 10
|
||||||
fi
|
fi
|
||||||
|
@ -176,15 +191,15 @@ fi
|
||||||
if [[ $hostonly == "-h" ]]; then
|
if [[ $hostonly == "-h" ]]; then
|
||||||
if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f "$DRACUT_KERNEL_MODALIASES" ]]; then
|
if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f "$DRACUT_KERNEL_MODALIASES" ]]; then
|
||||||
export DRACUT_KERNEL_MODALIASES="${DRACUT_TMPDIR}/modaliases"
|
export DRACUT_KERNEL_MODALIASES="${DRACUT_TMPDIR}/modaliases"
|
||||||
$DRACUT_INSTALL ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
|
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
|
[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
|
||||||
inst_dir() {
|
inst_dir() {
|
||||||
[[ -e ${initdir}/"$1" ]] && return 0 # already there
|
[[ -e ${initdir}/"$1" ]] && return 0 # already there
|
||||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@"
|
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@"
|
||||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@" || :
|
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@" || :
|
||||||
}
|
}
|
||||||
|
|
||||||
inst() {
|
inst() {
|
||||||
|
@ -194,8 +209,8 @@ inst() {
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||||
}
|
}
|
||||||
|
|
||||||
inst_simple() {
|
inst_simple() {
|
||||||
|
@ -206,8 +221,8 @@ inst_simple() {
|
||||||
fi
|
fi
|
||||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||||
[[ -e $1 ]] || return 1 # no source
|
[[ -e $1 ]] || return 1 # no source
|
||||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"
|
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"
|
||||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || :
|
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || :
|
||||||
}
|
}
|
||||||
|
|
||||||
inst_symlink() {
|
inst_symlink() {
|
||||||
|
@ -218,15 +233,15 @@ inst_symlink() {
|
||||||
fi
|
fi
|
||||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||||
[[ -L $1 ]] || return 1
|
[[ -L $1 ]] || return 1
|
||||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||||
}
|
}
|
||||||
|
|
||||||
inst_multiple() {
|
inst_multiple() {
|
||||||
local _ret
|
local _ret
|
||||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
||||||
_ret=$?
|
_ret=$?
|
||||||
(($_ret != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
(($_ret != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||||
return $_ret
|
return $_ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,8 +258,9 @@ dracut_instmods() {
|
||||||
done
|
done
|
||||||
|
|
||||||
$DRACUT_INSTALL \
|
$DRACUT_INSTALL \
|
||||||
|
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
|
||||||
${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@"
|
${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@"
|
||||||
(($? != 0)) && (($_silent == 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || :
|
(($? != 0)) && (($_silent == 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || :
|
||||||
}
|
}
|
||||||
|
|
||||||
inst_library() {
|
inst_library() {
|
||||||
|
@ -255,24 +271,24 @@ inst_library() {
|
||||||
fi
|
fi
|
||||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||||
[[ -e $1 ]] || return 1 # no source
|
[[ -e $1 ]] || return 1 # no source
|
||||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||||
}
|
}
|
||||||
|
|
||||||
inst_binary() {
|
inst_binary() {
|
||||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
||||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
|
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
|
||||||
}
|
}
|
||||||
|
|
||||||
inst_script() {
|
inst_script() {
|
||||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
||||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
|
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
|
||||||
}
|
}
|
||||||
|
|
||||||
inst_fsck_help() {
|
inst_fsck_help() {
|
||||||
local _helper="/run/dracut/fsck/fsck_help_$1.txt"
|
local _helper="/run/dracut/fsck/fsck_help_$1.txt"
|
||||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper
|
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper
|
||||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
|
(($? != 0)) && derror $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use with form hostonly="$(optional_hostonly)" inst_xxxx <args>
|
# Use with form hostonly="$(optional_hostonly)" inst_xxxx <args>
|
||||||
|
@ -369,12 +385,12 @@ inst_rule_group_owner() {
|
||||||
|
|
||||||
for i in $(sed -nr 's/.*OWNER=?"([^ "]+).*/\1/p' "$1"); do
|
for i in $(sed -nr 's/.*OWNER=?"([^ "]+).*/\1/p' "$1"); do
|
||||||
if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2>/dev/null; then
|
if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2>/dev/null; then
|
||||||
grep -E "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
grep -E "^$i:" $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
for i in $(sed -nr 's/.*GROUP=?"([^ "]+).*/\1/p' "$1"); do
|
for i in $(sed -nr 's/.*GROUP=?"([^ "]+).*/\1/p' "$1"); do
|
||||||
if ! grep -Eq "^$i:" "$initdir/etc/group" 2>/dev/null; then
|
if ! grep -Eq "^$i:" "$initdir/etc/group" 2>/dev/null; then
|
||||||
grep -E "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group"
|
grep -E "^$i:" $dracutsysrootdir/etc/group 2>/dev/null >> "$initdir/etc/group"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -394,7 +410,7 @@ inst_rules() {
|
||||||
inst_dir "$_target"
|
inst_dir "$_target"
|
||||||
for _rule in "$@"; do
|
for _rule in "$@"; do
|
||||||
if [ "${_rule#/}" = "$_rule" ]; then
|
if [ "${_rule#/}" = "$_rule" ]; then
|
||||||
for r in ${udevdir}/rules.d ${hostonly:+/etc/udev/rules.d}; do
|
for r in $dracutsysrootdir${udevdir}/rules.d ${hostonly:+$dracutsysrootdir/etc/udev/rules.d}; do
|
||||||
[[ -e $r/$_rule ]] || continue
|
[[ -e $r/$_rule ]] || continue
|
||||||
_found="$r/$_rule"
|
_found="$r/$_rule"
|
||||||
inst_rule_programs "$_found"
|
inst_rule_programs "$_found"
|
||||||
|
@ -403,7 +419,7 @@ inst_rules() {
|
||||||
inst_simple "$_found"
|
inst_simple "$_found"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
for r in '' $dracutbasedir/rules.d/; do
|
for r in '' $dracutsysrootdir$dracutbasedir/rules.d/; do
|
||||||
# skip rules without an absolute path
|
# skip rules without an absolute path
|
||||||
[[ "${r}$_rule" != /* ]] && continue
|
[[ "${r}$_rule" != /* ]] && continue
|
||||||
[[ -f ${r}$_rule ]] || continue
|
[[ -f ${r}$_rule ]] || continue
|
||||||
|
@ -525,7 +541,7 @@ inst_libdir_file() {
|
||||||
for _i in "$@"; do
|
for _i in "$@"; do
|
||||||
for _f in "$_dir"/$_i; do
|
for _f in "$_dir"/$_i; do
|
||||||
[[ "$_f" =~ $_pattern ]] || continue
|
[[ "$_f" =~ $_pattern ]] || continue
|
||||||
[[ -e "$_f" ]] && _files+="$_f "
|
[[ -e "$dracutsysrootdir$_f" ]] && _files+="$_f "
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
@ -533,7 +549,7 @@ inst_libdir_file() {
|
||||||
for _dir in $libdirs; do
|
for _dir in $libdirs; do
|
||||||
for _i in "$@"; do
|
for _i in "$@"; do
|
||||||
for _f in "$_dir"/$_i; do
|
for _f in "$_dir"/$_i; do
|
||||||
[[ -e "$_f" ]] && _files+="$_f "
|
[[ -e "$dracutsysrootdir$_f" ]] && _files+="$_f "
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
@ -947,6 +963,7 @@ instmods() {
|
||||||
|
|
||||||
$DRACUT_INSTALL \
|
$DRACUT_INSTALL \
|
||||||
${initdir:+-D "$initdir"} \
|
${initdir:+-D "$initdir"} \
|
||||||
|
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
|
||||||
${loginstall:+-L "$loginstall"} \
|
${loginstall:+-L "$loginstall"} \
|
||||||
${hostonly:+-H} \
|
${hostonly:+-H} \
|
||||||
${omit_drivers:+-N "$omit_drivers"} \
|
${omit_drivers:+-N "$omit_drivers"} \
|
||||||
|
@ -960,6 +977,7 @@ instmods() {
|
||||||
derror "FAILED: " \
|
derror "FAILED: " \
|
||||||
$DRACUT_INSTALL \
|
$DRACUT_INSTALL \
|
||||||
${initdir:+-D "$initdir"} \
|
${initdir:+-D "$initdir"} \
|
||||||
|
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
|
||||||
${loginstall:+-L "$loginstall"} \
|
${loginstall:+-L "$loginstall"} \
|
||||||
${hostonly:+-H} \
|
${hostonly:+-H} \
|
||||||
${omit_drivers:+-N "$omit_drivers"} \
|
${omit_drivers:+-N "$omit_drivers"} \
|
||||||
|
|
170
dracut.sh
170
dracut.sh
|
@ -37,7 +37,7 @@ readonly dracut_cmd="$(readlink -f $0)"
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
[[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut
|
||||||
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
|
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
|
||||||
. $dracutbasedir/dracut-version.sh
|
. $dracutbasedir/dracut-version.sh
|
||||||
fi
|
fi
|
||||||
|
@ -62,7 +62,7 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
long_usage() {
|
long_usage() {
|
||||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
[[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut
|
||||||
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
|
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
|
||||||
. $dracutbasedir/dracut-version.sh
|
. $dracutbasedir/dracut-version.sh
|
||||||
fi
|
fi
|
||||||
|
@ -140,6 +140,7 @@ Creates initial ramdisk images for preloading modules
|
||||||
from. Default: /etc/dracut.conf.d
|
from. Default: /etc/dracut.conf.d
|
||||||
--tmpdir [DIR] Temporary directory to be used instead of default
|
--tmpdir [DIR] Temporary directory to be used instead of default
|
||||||
/var/tmp.
|
/var/tmp.
|
||||||
|
-r, --sysroot [DIR] Specify sysroot directory to collect files from.
|
||||||
-l, --local Local mode. Use modules from the current working
|
-l, --local Local mode. Use modules from the current working
|
||||||
directory instead of the system-wide installed in
|
directory instead of the system-wide installed in
|
||||||
/usr/lib/dracut/modules.d.
|
/usr/lib/dracut/modules.d.
|
||||||
|
@ -635,7 +636,7 @@ if [[ $regenerate_all == "yes" ]]; then
|
||||||
unset dracut_args[$i]
|
unset dracut_args[$i]
|
||||||
done
|
done
|
||||||
|
|
||||||
cd /lib/modules
|
cd $dracutsysrootdir/lib/modules
|
||||||
for i in *; do
|
for i in *; do
|
||||||
[[ -f $i/modules.dep ]] || [[ -f $i/modules.dep.bin ]] || continue
|
[[ -f $i/modules.dep ]] || [[ -f $i/modules.dep.bin ]] || continue
|
||||||
"$dracut_cmd" --kver="$i" "${dracut_args[@]}"
|
"$dracut_cmd" --kver="$i" "${dracut_args[@]}"
|
||||||
|
@ -669,14 +670,14 @@ export DRACUT_LOG_LEVEL=warning
|
||||||
debug=yes
|
debug=yes
|
||||||
}
|
}
|
||||||
|
|
||||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
[[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut
|
||||||
|
|
||||||
# if we were not passed a config file, try the default one
|
# if we were not passed a config file, try the default one
|
||||||
if [[ ! -f $conffile ]]; then
|
if [[ ! -f $conffile ]]; then
|
||||||
if [[ $allowlocal ]]; then
|
if [[ $allowlocal ]]; then
|
||||||
conffile="$dracutbasedir/dracut.conf"
|
conffile="$dracutbasedir/dracut.conf"
|
||||||
else
|
else
|
||||||
conffile="/etc/dracut.conf"
|
conffile="$dracutsysrootdir/etc/dracut.conf"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -684,7 +685,7 @@ if [[ ! -d $confdir ]]; then
|
||||||
if [[ $allowlocal ]]; then
|
if [[ $allowlocal ]]; then
|
||||||
confdir="$dracutbasedir/dracut.conf.d"
|
confdir="$dracutbasedir/dracut.conf.d"
|
||||||
else
|
else
|
||||||
confdir="/etc/dracut.conf.d"
|
confdir="$dracutsysrootdir/etc/dracut.conf.d"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -700,8 +701,8 @@ DRACUT_PATH=${DRACUT_PATH:-/sbin /bin /usr/sbin /usr/bin}
|
||||||
|
|
||||||
for i in $DRACUT_PATH; do
|
for i in $DRACUT_PATH; do
|
||||||
rl=$i
|
rl=$i
|
||||||
if [ -L "$i" ]; then
|
if [ -L "$dracutsysrootdir$i" ]; then
|
||||||
rl=$(readlink -f $i)
|
rl=$(readlink -f $dracutsysrootdir$i)
|
||||||
fi
|
fi
|
||||||
if [[ "$NPATH" != *:$rl* ]] ; then
|
if [[ "$NPATH" != *:$rl* ]] ; then
|
||||||
NPATH+=":$rl"
|
NPATH+=":$rl"
|
||||||
|
@ -748,10 +749,10 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||||
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
|
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
|
||||||
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
|
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
|
||||||
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
|
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
|
||||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
[[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut
|
||||||
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates:/lib/firmware:/lib/firmware/$kernel"
|
[[ $fw_dir ]] || fw_dir="$dracutsysrootdir/lib/firmware/updates:$dracutsysrootdir/lib/firmware:$dracutsysrootdir/lib/firmware/$kernel"
|
||||||
[[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
|
[[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
|
||||||
[[ $tmpdir ]] || tmpdir=/var/tmp
|
[[ $tmpdir ]] || tmpdir=$dracutsysrootdir/var/tmp
|
||||||
[[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS
|
[[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS
|
||||||
[[ $compress_l ]] && compress=$compress_l
|
[[ $compress_l ]] && compress=$compress_l
|
||||||
[[ $show_modules_l ]] && show_modules=$show_modules_l
|
[[ $show_modules_l ]] && show_modules=$show_modules_l
|
||||||
|
@ -768,7 +769,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||||
|
|
||||||
if ! [[ $outfile ]]; then
|
if ! [[ $outfile ]]; then
|
||||||
if [[ $machine_id != "no" ]]; then
|
if [[ $machine_id != "no" ]]; then
|
||||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
[[ -f $dracutsysrootdir/etc/machine-id ]] && read MACHINE_ID < $dracutsysrootdir/etc/machine-id
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $uefi == "yes" ]]; then
|
if [[ $uefi == "yes" ]]; then
|
||||||
|
@ -782,27 +783,34 @@ if ! [[ $outfile ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BUILD_ID=$(cat /etc/os-release /usr/lib/os-release \
|
BUILD_ID=$(cat $dracutsysrootdir/etc/os-release $dracutsysrootdir/usr/lib/os-release \
|
||||||
| while read -r line || [[ $line ]]; do \
|
| while read -r line || [[ $line ]]; do \
|
||||||
[[ $line =~ BUILD_ID\=* ]] && eval "$line" && echo "$BUILD_ID" && break; \
|
[[ $line =~ BUILD_ID\=* ]] && eval "$line" && echo "$BUILD_ID" && break; \
|
||||||
done)
|
done)
|
||||||
if [[ -d /efi ]] && mountpoint -q /efi; then
|
if [[ -z $dracutsysrootdir ]]; then
|
||||||
efidir=/efi/EFI
|
if [[ -d /efi ]] && mountpoint -q /efi; then
|
||||||
|
efidir=/efi/EFI
|
||||||
|
else
|
||||||
|
efidir=/boot/EFI
|
||||||
|
if [[ -d $dracutsysrootdir/boot/efi/EFI ]]; then
|
||||||
|
efidir=/boot/efi/EFI
|
||||||
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
efidir=/boot/EFI
|
efidir=/boot/EFI
|
||||||
if [[ -d /boot/efi/EFI ]] && mountpoint -q /boot/efi; then
|
if [[ -d $dracutsysrootdir/boot/efi/EFI ]]; then
|
||||||
efidir=/boot/efi/EFI
|
efidir=/boot/efi/EFI
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
mkdir -p "$efidir/Linux"
|
mkdir -p "$dracutsysrootdir$efidir/Linux"
|
||||||
outfile="$efidir/Linux/linux-$kernel${MACHINE_ID:+-${MACHINE_ID}}${BUILD_ID:+-${BUILD_ID}}.efi"
|
outfile="$dracutsysrootdir$efidir/Linux/linux-$kernel${MACHINE_ID:+-${MACHINE_ID}}${BUILD_ID:+-${BUILD_ID}}.efi"
|
||||||
else
|
else
|
||||||
if [[ -e "/boot/vmlinuz-$kernel" ]]; then
|
if [[ -e "$dracutsysrootdir/boot/vmlinuz-$kernel" ]]; then
|
||||||
outfile="/boot/initramfs-$kernel.img"
|
outfile="/boot/initramfs-$kernel.img"
|
||||||
elif [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
|
elif [[ $MACHINE_ID ]] && ( [[ -d $dracutsysrootdir/boot/${MACHINE_ID} ]] || [[ -L $dracutsysrootdir/boot/${MACHINE_ID} ]] ); then
|
||||||
outfile="/boot/${MACHINE_ID}/$kernel/initrd"
|
outfile="$dracutsysrootdir/boot/${MACHINE_ID}/$kernel/initrd"
|
||||||
else
|
else
|
||||||
outfile="/boot/initramfs-$kernel.img"
|
outfile="$dracutsysrootdir/boot/initramfs-$kernel.img"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -822,13 +830,24 @@ if [[ -n "$logfile" ]];then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# handle compression options.
|
# handle compression options.
|
||||||
if [[ $_no_compress_l = "cat" ]]; then
|
DRACUT_COMPRESS_BZIP2=${DRACUT_COMPRESS_BZIP2:-bzip2}
|
||||||
compress="cat"
|
DRACUT_COMPRESS_LBZIP2=${DRACUT_COMPRESS_LBZIP2:-lbzip2}
|
||||||
|
DRACUT_COMPRESS_LZMA=${DRACUT_COMPRESS_LZMA:-lzma}
|
||||||
|
DRACUT_COMPRESS_XZ=${DRACUT_COMPRESS_XZ:-xz}
|
||||||
|
DRACUT_COMPRESS_GZIP=${DRACUT_COMPRESS_GZIP:-gzip}
|
||||||
|
DRACUT_COMPRESS_PIGZ=${DRACUT_COMPRESS_PIGZ:-pigz}
|
||||||
|
DRACUT_COMPRESS_LZOP=${DRACUT_COMPRESS_LZOP:-lzop}
|
||||||
|
DRACUT_COMPRESS_ZSTD=${DRACUT_COMPRESS_ZSTD:-zstd}
|
||||||
|
DRACUT_COMPRESS_LZ4=${DRACUT_COMPRESS_LZ4:-lz4}
|
||||||
|
DRACUT_COMPRESS_CAT=${DRACUT_COMPRESS_CAT:-cat}
|
||||||
|
|
||||||
|
if [[ $_no_compress_l = "$DRACUT_COMPRESS_CAT" ]]; then
|
||||||
|
compress="$DRACUT_COMPRESS_CAT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [[ $compress ]]; then
|
if ! [[ $compress ]]; then
|
||||||
# check all known compressors, if none specified
|
# check all known compressors, if none specified
|
||||||
for i in pigz gzip lz4 lzop zstd lzma xz lbzip2 bzip2 cat; do
|
for i in $DRACUT_COMPRESS_PIGZ $DRACUT_COMPRESS_GZIP $DRACUT_COMPRESS_LZ4 $DRACUT_COMPRESS_LZOP $ $DRACUT_COMPRESS_ZSTD $DRACUT_COMPRESS_LZMA $DRACUT_COMPRESS_XZ $DRACUT_COMPRESS_LBZIP2 $OMPRESS_BZIP2 $DRACUT_COMPRESS_CAT; do
|
||||||
command -v "$i" &>/dev/null || continue
|
command -v "$i" &>/dev/null || continue
|
||||||
compress="$i"
|
compress="$i"
|
||||||
break
|
break
|
||||||
|
@ -841,35 +860,35 @@ fi
|
||||||
# choose the right arguments for the compressor
|
# choose the right arguments for the compressor
|
||||||
case $compress in
|
case $compress in
|
||||||
bzip2|lbzip2)
|
bzip2|lbzip2)
|
||||||
if [[ "$compress" = lbzip2 ]] || command -v lbzip2 &>/dev/null; then
|
if [[ "$compress" = lbzip2 ]] || command -v $DRACUT_COMPRESS_LBZIP2 &>/dev/null; then
|
||||||
compress="lbzip2 -9"
|
compress="$DRACUT_COMPRESS_LBZIP2 -9"
|
||||||
else
|
else
|
||||||
compress="bzip2 -9"
|
compress="$DRACUT_COMPRESS_BZIP2 -9"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
lzma)
|
lzma)
|
||||||
compress="lzma -9 -T0"
|
compress="$DRACUT_COMPRESS_LZMA -9 -T0"
|
||||||
;;
|
;;
|
||||||
xz)
|
xz)
|
||||||
compress="xz --check=crc32 --lzma2=dict=1MiB -T0"
|
compress="$DRACUT_COMPRESS_XZ --check=crc32 --lzma2=dict=1MiB -T0"
|
||||||
;;
|
;;
|
||||||
gzip|pigz)
|
gzip|pigz)
|
||||||
if [[ "$compress" = pigz ]] || command -v pigz &>/dev/null; then
|
if [[ "$compress" = pigz ]] || command -v $DRACUT_COMPRESS_PIGZ &>/dev/null; then
|
||||||
compress="pigz -9 -n -T -R"
|
compress="$DRACUT_COMPRESS_PIGZ -9 -n -T -R"
|
||||||
elif command -v gzip &>/dev/null && gzip --help 2>&1 | grep -q rsyncable; then
|
elif command -v gzip &>/dev/null && $DRACUT_COMPRESS_GZIP --help 2>&1 | grep -q rsyncable; then
|
||||||
compress="gzip -n -9 --rsyncable"
|
compress="$DRACUT_COMPRESS_GZIP -n -9 --rsyncable"
|
||||||
else
|
else
|
||||||
compress="gzip -n -9"
|
compress="$DRACUT_COMPRESS_GZIP -n -9"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
lzo|lzop)
|
lzo|lzop)
|
||||||
compress="lzop -9"
|
compress="$DRACUT_COMPRESS_LZOP -9"
|
||||||
;;
|
;;
|
||||||
lz4)
|
lz4)
|
||||||
compress="lz4 -l -9"
|
compress="$DRACUT_COMPRESS_LZ4 -l -9"
|
||||||
;;
|
;;
|
||||||
zstd)
|
zstd)
|
||||||
compress="zstd -15 -q -T0"
|
compress="$DRACUT_COMPRESS_ZSTD -15 -q -T0"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -920,7 +939,7 @@ if [[ $early_microcode = yes ]] || ( [[ $acpi_override = yes ]] && [[ -d $acpi_t
|
||||||
mkdir "$early_cpio_dir"
|
mkdir "$early_cpio_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export DRACUT_RESOLVE_LAZY="1"
|
[[ -n "$dracutsysrootdir" ]] || export DRACUT_RESOLVE_LAZY="1"
|
||||||
|
|
||||||
if [[ $print_cmdline ]]; then
|
if [[ $print_cmdline ]]; then
|
||||||
stdloglvl=0
|
stdloglvl=0
|
||||||
|
@ -949,8 +968,8 @@ if [[ $no_kernel != yes ]] && ! [[ -d $srcmods ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [[ $print_cmdline ]]; then
|
if ! [[ $print_cmdline ]]; then
|
||||||
inst /bin/sh
|
inst $DRACUT_TESTBIN
|
||||||
if ! $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R "$initdir/bin/sh" &>/dev/null; then
|
if ! $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R "$DRACUT_TESTBIN" &>/dev/null; then
|
||||||
unset DRACUT_RESOLVE_LAZY
|
unset DRACUT_RESOLVE_LAZY
|
||||||
export DRACUT_RESOLVE_DEPS=1
|
export DRACUT_RESOLVE_DEPS=1
|
||||||
fi
|
fi
|
||||||
|
@ -1093,8 +1112,8 @@ if [[ ! $print_cmdline ]]; then
|
||||||
|
|
||||||
if ! [[ -s $uefi_stub ]]; then
|
if ! [[ -s $uefi_stub ]]; then
|
||||||
for uefi_stub in \
|
for uefi_stub in \
|
||||||
"${systemdutildir}/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub" \
|
$dracutsysrootdir"${systemdutildir}/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub" \
|
||||||
"/usr/lib/gummiboot/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"; do
|
"$dracutsysrootdir/usr/lib/gummiboot/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"; do
|
||||||
[[ -s $uefi_stub ]] || continue
|
[[ -s $uefi_stub ]] || continue
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
|
@ -1105,7 +1124,7 @@ if [[ ! $print_cmdline ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [[ $kernel_image ]]; then
|
if ! [[ $kernel_image ]]; then
|
||||||
for kernel_image in "/lib/modules/$kernel/vmlinuz" "/boot/vmlinuz-$kernel"; do
|
for kernel_image in "$dracutsysrootdir/lib/modules/$kernel/vmlinuz" "$dracutsysrootdir/boot/vmlinuz-$kernel"; do
|
||||||
[[ -s "$kernel_image" ]] || continue
|
[[ -s "$kernel_image" ]] || continue
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
|
@ -1218,7 +1237,7 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
||||||
"/boot/zipl" \
|
"/boot/zipl" \
|
||||||
;
|
;
|
||||||
do
|
do
|
||||||
mp=$(readlink -f "$mp")
|
mp=$(readlink -f "$dracutsysrootdir$mp")
|
||||||
mountpoint "$mp" >/dev/null 2>&1 || continue
|
mountpoint "$mp" >/dev/null 2>&1 || continue
|
||||||
_dev=$(find_block_device "$mp")
|
_dev=$(find_block_device "$mp")
|
||||||
_bdev=$(readlink -f "/dev/block/$_dev")
|
_bdev=$(readlink -f "/dev/block/$_dev")
|
||||||
|
@ -1233,7 +1252,8 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -f /proc/swaps ]] && [[ -f /etc/fstab ]]; then
|
# TODO - with sysroot, /proc/swaps is not relevant
|
||||||
|
if [[ -f /proc/swaps ]] && [[ -f $dracutsysrootdir/etc/fstab ]]; then
|
||||||
while read dev type rest || [ -n "$dev" ]; do
|
while read dev type rest || [ -n "$dev" ]; do
|
||||||
[[ -b $dev ]] || continue
|
[[ -b $dev ]] || continue
|
||||||
[[ "$type" == "partition" ]] || continue
|
[[ "$type" == "partition" ]] || continue
|
||||||
|
@ -1247,7 +1267,7 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
||||||
_d=$(expand_persistent_dev "$_d")
|
_d=$(expand_persistent_dev "$_d")
|
||||||
[[ "$_d" -ef "$dev" ]] || continue
|
[[ "$_d" -ef "$dev" ]] || continue
|
||||||
|
|
||||||
if [[ -f /etc/crypttab ]]; then
|
if [[ -f $dracutsysrootdir/etc/crypttab ]]; then
|
||||||
while read _mapper _a _p _o || [ -n "$_mapper" ]; do
|
while read _mapper _a _p _o || [ -n "$_mapper" ]; do
|
||||||
[[ $_mapper = \#* ]] && continue
|
[[ $_mapper = \#* ]] && continue
|
||||||
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
|
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
|
||||||
|
@ -1256,19 +1276,19 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
||||||
[[ "$_p" == /* ]] && [[ -f $_p ]] && continue 2
|
[[ "$_p" == /* ]] && [[ -f $_p ]] && continue 2
|
||||||
# skip mkswap swap
|
# skip mkswap swap
|
||||||
[[ $_o == *swap* ]] && continue 2
|
[[ $_o == *swap* ]] && continue 2
|
||||||
done < /etc/crypttab
|
done < $dracutsysrootdir/etc/crypttab
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_dev="$(readlink -f "$dev")"
|
_dev="$(readlink -f "$dev")"
|
||||||
push_host_devs "$_dev"
|
push_host_devs "$_dev"
|
||||||
swap_devs+=("$_dev")
|
swap_devs+=("$_dev")
|
||||||
break
|
break
|
||||||
done < /etc/fstab
|
done < $dracutsysrootdir/etc/fstab
|
||||||
done < /proc/swaps
|
done < /proc/swaps
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# collect all "x-initrd.mount" entries from /etc/fstab
|
# collect all "x-initrd.mount" entries from /etc/fstab
|
||||||
if [[ -f /etc/fstab ]]; then
|
if [[ -f $dracutsysrootdir/etc/fstab ]]; then
|
||||||
while read _d _m _t _o _r || [ -n "$_d" ]; do
|
while read _d _m _t _o _r || [ -n "$_d" ]; do
|
||||||
[[ "$_d" == \#* ]] && continue
|
[[ "$_d" == \#* ]] && continue
|
||||||
[[ $_d ]] || continue
|
[[ $_d ]] || continue
|
||||||
|
@ -1283,7 +1303,7 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
||||||
push_host_devs "$i"
|
push_host_devs "$i"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
done < /etc/fstab
|
done < $dracutsysrootdir/etc/fstab
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1328,29 +1348,29 @@ for dev in "${!host_fs_types[@]}"; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
[[ -d $udevdir ]] \
|
[[ -d $dracutsysrootdir$udevdir ]] \
|
||||||
|| udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
|
|| udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
|
||||||
if ! [[ -d "$udevdir" ]]; then
|
if ! [[ -d "$dracutsysrootdir$udevdir" ]]; then
|
||||||
[[ -e /lib/udev/ata_id ]] && udevdir=/lib/udev
|
[[ -e $dracutsysrootdir/lib/udev/ata_id ]] && udevdir=/lib/udev
|
||||||
[[ -e /usr/lib/udev/ata_id ]] && udevdir=/usr/lib/udev
|
[[ -e $dracutsysrootdir/usr/lib/udev/ata_id ]] && udevdir=/usr/lib/udev
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -d $systemdsystemunitdir ]] \
|
[[ -d $dracutsysrootdir$systemdsystemunitdir ]] \
|
||||||
|| systemdsystemunitdir=$(pkg-config systemd --variable=systemdsystemunitdir 2>/dev/null)
|
|| systemdsystemunitdir=$(pkg-config systemd --variable=systemdsystemunitdir 2>/dev/null)
|
||||||
|
|
||||||
[[ -d "$systemdsystemunitdir" ]] || systemdsystemunitdir=${systemdutildir}/system
|
[[ -d "$dracutsysrootdir$systemdsystemunitdir" ]] || systemdsystemunitdir=${systemdutildir}/system
|
||||||
|
|
||||||
[[ -d $systemdsystemconfdir ]] \
|
[[ -d $dracutsysrootdir$systemdsystemconfdir ]] \
|
||||||
|| systemdsystemconfdir=$(pkg-config systemd --variable=systemdsystemconfdir 2>/dev/null)
|
|| systemdsystemconfdir=$(pkg-config systemd --variable=systemdsystemconfdir 2>/dev/null)
|
||||||
|
|
||||||
[[ -d "$systemdsystemconfdir" ]] || systemdsystemconfdir=/etc/systemd/system
|
[[ -d "$dracutsysrootdir$systemdsystemconfdir" ]] || systemdsystemconfdir=/etc/systemd/system
|
||||||
|
|
||||||
[[ -d $tmpfilesdir ]] \
|
[[ -d $dracutsysrootdir$tmpfilesdir ]] \
|
||||||
|| tmpfilesdir=$(pkg-config systemd --variable=tmpfilesdir 2>/dev/null)
|
|| tmpfilesdir=$(pkg-config systemd --variable=tmpfilesdir 2>/dev/null)
|
||||||
|
|
||||||
if ! [[ -d "$tmpfilesdir" ]]; then
|
if ! [[ -d "$dracutsysrootdir$tmpfilesdir" ]]; then
|
||||||
[[ -d /lib/tmpfiles.d ]] && tmpfilesdir=/lib/tmpfiles.d
|
[[ -d $dracutsysrootdir/lib/tmpfiles.d ]] && tmpfilesdir=/lib/tmpfiles.d
|
||||||
[[ -d /usr/lib/tmpfiles.d ]] && tmpfilesdir=/usr/lib/tmpfiles.d
|
[[ -d $dracutsysrootdir/usr/lib/tmpfiles.d ]] && tmpfilesdir=/usr/lib/tmpfiles.d
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export initdir dracutbasedir \
|
export initdir dracutbasedir \
|
||||||
|
@ -1399,7 +1419,7 @@ fi
|
||||||
# Create some directory structure first
|
# Create some directory structure first
|
||||||
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
|
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
|
||||||
|
|
||||||
[[ -h /lib ]] || mkdir -m 0755 -p "${initdir}${prefix}/lib"
|
[[ -h $dracutsysrootdir/lib ]] || mkdir -m 0755 -p "${initdir}${prefix}/lib"
|
||||||
[[ $prefix ]] && ln -sfn "${prefix#/}/lib" "$initdir/lib"
|
[[ $prefix ]] && ln -sfn "${prefix#/}/lib" "$initdir/lib"
|
||||||
|
|
||||||
if [[ $prefix ]]; then
|
if [[ $prefix ]]; then
|
||||||
|
@ -1569,7 +1589,7 @@ if [[ $kernel_only != yes ]]; then
|
||||||
cat "$f" >> "${initdir}/etc/fstab"
|
cat "$f" >> "${initdir}/etc/fstab"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $systemdutildir ]]; then
|
if [[ $dracutsysrootdir$systemdutildir ]]; then
|
||||||
if [ -d ${initdir}/$systemdutildir ]; then
|
if [ -d ${initdir}/$systemdutildir ]; then
|
||||||
mkdir -p ${initdir}/etc/conf.d
|
mkdir -p ${initdir}/etc/conf.d
|
||||||
{
|
{
|
||||||
|
@ -1583,7 +1603,7 @@ if [[ $kernel_only != yes ]]; then
|
||||||
if [[ $DRACUT_RESOLVE_LAZY ]] && [[ $DRACUT_INSTALL ]]; then
|
if [[ $DRACUT_RESOLVE_LAZY ]] && [[ $DRACUT_INSTALL ]]; then
|
||||||
dinfo "*** Resolving executable dependencies ***"
|
dinfo "*** Resolving executable dependencies ***"
|
||||||
find "$initdir" -type f -perm /0111 -not -path '*.ko' -print0 \
|
find "$initdir" -type f -perm /0111 -not -path '*.ko' -print0 \
|
||||||
| xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R ${DRACUT_FIPS_MODE:+-f} --
|
| xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R ${DRACUT_FIPS_MODE:+-f} --
|
||||||
dinfo "*** Resolving executable dependencies done ***"
|
dinfo "*** Resolving executable dependencies done ***"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1593,7 +1613,7 @@ if [[ $kernel_only != yes ]]; then
|
||||||
|
|
||||||
# libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
|
# libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
|
||||||
for _dir in $libdirs; do
|
for _dir in $libdirs; do
|
||||||
for _f in "$_dir/libpthread.so"*; do
|
for _f in "$dracutsysrootdir$_dir/libpthread.so"*; do
|
||||||
[[ -e "$_f" ]] || continue
|
[[ -e "$_f" ]] || continue
|
||||||
inst_libdir_file "libgcc_s.so*"
|
inst_libdir_file "libgcc_s.so*"
|
||||||
break 2
|
break 2
|
||||||
|
@ -1623,9 +1643,9 @@ for ((i=0; i < ${#include_src[@]}; i++)); do
|
||||||
mkdir -m 0755 -p "$object_destdir"
|
mkdir -m 0755 -p "$object_destdir"
|
||||||
chmod --reference="$objectname" "$object_destdir"
|
chmod --reference="$objectname" "$object_destdir"
|
||||||
fi
|
fi
|
||||||
$DRACUT_CP -t "$object_destdir" "$objectname"/*
|
$DRACUT_CP -t "$object_destdir" "$dracutsysrootdir$objectname"/*
|
||||||
else
|
else
|
||||||
$DRACUT_CP -t "$destdir" "$objectname"
|
$DRACUT_CP -t "$destdir" "$dracutsysrootdir$objectname"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
elif [[ -e $src ]]; then
|
elif [[ -e $src ]]; then
|
||||||
|
@ -1638,10 +1658,10 @@ done
|
||||||
|
|
||||||
if [[ $kernel_only != yes ]]; then
|
if [[ $kernel_only != yes ]]; then
|
||||||
# make sure that library links are correct and up to date
|
# make sure that library links are correct and up to date
|
||||||
for f in /etc/ld.so.conf /etc/ld.so.conf.d/*; do
|
for f in $dracutsysrootdir/etc/ld.so.conf $dracutsysrootdir/etc/ld.so.conf.d/*; do
|
||||||
[[ -f $f ]] && inst_simple "$f"
|
[[ -f $f ]] && inst_simple "${f#$dracutsysrootdir}"
|
||||||
done
|
done
|
||||||
if ! ldconfig -r "$initdir"; then
|
if ! $DRACUT_LDCONFIG -r "$initdir" -f /etc/ld.so.conf; then
|
||||||
if [[ $EUID = 0 ]]; then
|
if [[ $EUID = 0 ]]; then
|
||||||
derror "ldconfig exited ungracefully"
|
derror "ldconfig exited ungracefully"
|
||||||
else
|
else
|
||||||
|
@ -1958,8 +1978,8 @@ if [[ $uefi = yes ]]; then
|
||||||
dinfo "Using UEFI kernel cmdline:"
|
dinfo "Using UEFI kernel cmdline:"
|
||||||
dinfo $(tr -d '\000' < "$uefi_outdir/cmdline.txt")
|
dinfo $(tr -d '\000' < "$uefi_outdir/cmdline.txt")
|
||||||
|
|
||||||
[[ -s /usr/lib/os-release ]] && uefi_osrelease="/usr/lib/os-release"
|
[[ -s $dracutsysrootdir/usr/lib/os-release ]] && uefi_osrelease="$dracutsysrootdir/usr/lib/os-release"
|
||||||
[[ -s /etc/os-release ]] && uefi_osrelease="/etc/os-release"
|
[[ -s $dracutsysrootdir/etc/os-release ]] && uefi_osrelease="$dracutsysrootdir/etc/os-release"
|
||||||
|
|
||||||
if objcopy \
|
if objcopy \
|
||||||
${uefi_osrelease:+--add-section .osrel=$uefi_osrelease --change-section-vma .osrel=0x20000} \
|
${uefi_osrelease:+--add-section .osrel=$uefi_osrelease --change-section-vma .osrel=0x20000} \
|
||||||
|
@ -2004,7 +2024,7 @@ command -v restorecon &>/dev/null && restorecon -- "$outfile"
|
||||||
# and there's no reason to sync, and *definitely* no reason to fsfreeze.
|
# and there's no reason to sync, and *definitely* no reason to fsfreeze.
|
||||||
# Another case where this happens is rpm-ostree, which performs its own sync/fsfreeze
|
# Another case where this happens is rpm-ostree, which performs its own sync/fsfreeze
|
||||||
# globally. See e.g. https://github.com/ostreedev/ostree/commit/8642ef5ab3fec3ac8eb8f193054852f83a8bc4d0
|
# globally. See e.g. https://github.com/ostreedev/ostree/commit/8642ef5ab3fec3ac8eb8f193054852f83a8bc4d0
|
||||||
if test -d /run/systemd/system; then
|
if test -d $dracutsysrootdir/run/systemd/system; then
|
||||||
if ! sync "$outfile" 2> /dev/null; then
|
if ! sync "$outfile" 2> /dev/null; then
|
||||||
dinfo "dracut: sync operation on newly created initramfs $outfile failed"
|
dinfo "dracut: sync operation on newly created initramfs $outfile failed"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -60,10 +60,13 @@ static bool arg_resolvelazy = false;
|
||||||
static bool arg_resolvedeps = false;
|
static bool arg_resolvedeps = false;
|
||||||
static bool arg_hostonly = false;
|
static bool arg_hostonly = false;
|
||||||
static char *destrootdir = NULL;
|
static char *destrootdir = NULL;
|
||||||
|
static char *sysrootdir = NULL;
|
||||||
|
static size_t sysrootdirlen = 0;
|
||||||
static char *kerneldir = NULL;
|
static char *kerneldir = NULL;
|
||||||
static size_t kerneldirlen = 0;
|
static size_t kerneldirlen = 0;
|
||||||
static char **firmwaredirs = NULL;
|
static char **firmwaredirs = NULL;
|
||||||
static char **pathdirs;
|
static char **pathdirs;
|
||||||
|
static char *ldd = NULL;
|
||||||
static char *logdir = NULL;
|
static char *logdir = NULL;
|
||||||
static char *logfile = NULL;
|
static char *logfile = NULL;
|
||||||
FILE *logfile_f = NULL;
|
FILE *logfile_f = NULL;
|
||||||
|
@ -398,6 +401,75 @@ static int library_install(const char *src, const char *lib)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *get_real_file(const char *src, bool fullyresolve)
|
||||||
|
{
|
||||||
|
char linktarget[PATH_MAX + 1];
|
||||||
|
ssize_t linksz;
|
||||||
|
_cleanup_free_ char *fullsrcpath;
|
||||||
|
char *abspath = NULL;
|
||||||
|
struct stat sb;
|
||||||
|
|
||||||
|
if (sysrootdirlen) {
|
||||||
|
if (strncmp(src, sysrootdir, sysrootdirlen) == 0)
|
||||||
|
fullsrcpath = strdup(src);
|
||||||
|
else if (asprintf(&fullsrcpath, "%s/%s", (sysrootdirlen ? sysrootdir : ""), (src[0] == '/' ? src+1 : src)) < 0)
|
||||||
|
_exit(EXIT_FAILURE);
|
||||||
|
} else
|
||||||
|
fullsrcpath = strdup(src);
|
||||||
|
|
||||||
|
log_debug("get_real_file('%s')", fullsrcpath);
|
||||||
|
|
||||||
|
if (lstat(fullsrcpath, &sb) < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
switch (sb.st_mode & S_IFMT) {
|
||||||
|
case S_IFDIR:
|
||||||
|
case S_IFREG:
|
||||||
|
return strdup(fullsrcpath);
|
||||||
|
case S_IFLNK:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
linksz = readlink(fullsrcpath, linktarget, sizeof(linktarget));
|
||||||
|
if (linksz < 0)
|
||||||
|
return NULL;
|
||||||
|
linktarget[linksz] = '\0';
|
||||||
|
|
||||||
|
log_debug("get_real_file: readlink('%s') returns '%s'", fullsrcpath, linktarget);
|
||||||
|
|
||||||
|
if (linktarget[0] == '/') {
|
||||||
|
if (asprintf(&abspath, "%s%s", (sysrootdirlen ? sysrootdir : ""), linktarget) < 0)
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
_cleanup_free_ char *fullsrcdir = strdup(fullsrcpath);
|
||||||
|
|
||||||
|
if (!fullsrcdir) {
|
||||||
|
log_error("Out of memory!");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
fullsrcdir[dir_len(fullsrcdir)] = '\0';
|
||||||
|
|
||||||
|
if (asprintf(&abspath, "%s/%s", fullsrcdir, linktarget) < 0)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fullyresolve) {
|
||||||
|
struct stat st;
|
||||||
|
if (lstat(abspath, &st) < 0) {
|
||||||
|
if (errno != ENOENT)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (S_ISLNK(st.st_mode))
|
||||||
|
return get_real_file(abspath, fullyresolve);
|
||||||
|
}
|
||||||
|
|
||||||
|
log_debug("get_real_file('%s') => '%s'", src, abspath);
|
||||||
|
return abspath;
|
||||||
|
}
|
||||||
|
|
||||||
static int resolve_deps(const char *src)
|
static int resolve_deps(const char *src)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -406,6 +478,12 @@ static int resolve_deps(const char *src)
|
||||||
size_t linesize = LINE_MAX;
|
size_t linesize = LINE_MAX;
|
||||||
_cleanup_pclose_ FILE *fptr = NULL;
|
_cleanup_pclose_ FILE *fptr = NULL;
|
||||||
_cleanup_free_ char *cmd = NULL;
|
_cleanup_free_ char *cmd = NULL;
|
||||||
|
_cleanup_free_ char *fullsrcpath = NULL;
|
||||||
|
|
||||||
|
fullsrcpath = get_real_file(src, true);
|
||||||
|
log_debug("resolve_deps('%s') -> get_real_file('%s', true) = '%s'", src, src, fullsrcpath);
|
||||||
|
if (!fullsrcpath)
|
||||||
|
return 0;
|
||||||
|
|
||||||
buf = malloc(LINE_MAX);
|
buf = malloc(LINE_MAX);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
|
@ -413,7 +491,7 @@ static int resolve_deps(const char *src)
|
||||||
|
|
||||||
if (strstr(src, ".so") == 0) {
|
if (strstr(src, ".so") == 0) {
|
||||||
_cleanup_close_ int fd = -1;
|
_cleanup_close_ int fd = -1;
|
||||||
fd = open(src, O_RDONLY | O_CLOEXEC);
|
fd = open(fullsrcpath, O_RDONLY | O_CLOEXEC);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
|
@ -437,12 +515,14 @@ static int resolve_deps(const char *src)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* run ldd */
|
/* run ldd */
|
||||||
ret = asprintf(&cmd, "ldd %s 2>&1", src);
|
ret = asprintf(&cmd, "%s %s 2>&1", ldd, fullsrcpath);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
log_error("Out of memory!");
|
log_error("Out of memory!");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_debug("%s", cmd);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
fptr = popen(cmd, "r");
|
fptr = popen(cmd, "r");
|
||||||
|
@ -461,6 +541,13 @@ static int resolve_deps(const char *src)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* errors from cross-compiler-ldd */
|
||||||
|
if (strstr(buf, "unable to find sysroot") || strstr(buf, "command not found")) {
|
||||||
|
log_error("%s", buf);
|
||||||
|
ret += 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* musl ldd */
|
/* musl ldd */
|
||||||
if (strstr(buf, "Not a valid dynamic program"))
|
if (strstr(buf, "Not a valid dynamic program"))
|
||||||
break;
|
break;
|
||||||
|
@ -597,16 +684,68 @@ static bool check_hashmap(Hashmap *hm, const char *item)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst)
|
static int dracut_mkdir(const char *src) {
|
||||||
|
_cleanup_free_ char *parent = NULL;
|
||||||
|
struct stat sb;
|
||||||
|
|
||||||
|
parent = strdup(src);
|
||||||
|
if (!parent)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
parent[dir_len(parent)] = '\0';
|
||||||
|
|
||||||
|
if (stat(parent, &sb) == 0) {
|
||||||
|
if (!S_ISDIR(sb.st_mode)) {
|
||||||
|
log_error("%s exists but is not a directory!", parent);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mkdir(src, 0755);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errno != ENOENT) {
|
||||||
|
log_error("ERROR: stat '%s': %m", src);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dracut_mkdir(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir, bool resolvedeps, bool hashdst)
|
||||||
{
|
{
|
||||||
struct stat sb, db;
|
struct stat sb, db;
|
||||||
|
_cleanup_free_ char *fullsrcpath = NULL;
|
||||||
_cleanup_free_ char *fulldstpath = NULL;
|
_cleanup_free_ char *fulldstpath = NULL;
|
||||||
_cleanup_free_ char *fulldstdir = NULL;
|
_cleanup_free_ char *fulldstdir = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
bool src_exists = true;
|
bool src_islink = false;
|
||||||
|
bool src_isdir = false;
|
||||||
|
mode_t src_mode = 0;
|
||||||
|
bool dst_exists = true;
|
||||||
char *i = NULL;
|
char *i = NULL;
|
||||||
|
_cleanup_free_ char *src;
|
||||||
|
_cleanup_free_ char *dst;
|
||||||
|
|
||||||
log_debug("dracut_install('%s', '%s')", src, dst);
|
if (sysrootdirlen) {
|
||||||
|
if (strncmp(orig_src, sysrootdir, sysrootdirlen) == 0) {
|
||||||
|
src = strdup(orig_src + sysrootdirlen);
|
||||||
|
fullsrcpath = strdup(orig_src);
|
||||||
|
} else {
|
||||||
|
src = strdup(orig_src);
|
||||||
|
if (asprintf(&fullsrcpath, "%s%s", sysrootdir, src) < 0)
|
||||||
|
_exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
if (strncmp(orig_dst, sysrootdir, sysrootdirlen) == 0)
|
||||||
|
dst = strdup(orig_dst + sysrootdirlen);
|
||||||
|
else
|
||||||
|
dst = strdup(orig_dst);
|
||||||
|
} else {
|
||||||
|
src = strdup(orig_src);
|
||||||
|
fullsrcpath = strdup(src);
|
||||||
|
dst = strdup(orig_dst);
|
||||||
|
}
|
||||||
|
|
||||||
|
log_debug("dracut_install('%s', '%s', %d, %d, %d)", src, dst, isdir, resolvedeps, hashdst);
|
||||||
|
|
||||||
if (check_hashmap(items_failed, src)) {
|
if (check_hashmap(items_failed, src)) {
|
||||||
log_debug("hash hit items_failed for '%s'", src);
|
log_debug("hash hit items_failed for '%s'", src);
|
||||||
|
@ -618,22 +757,19 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lstat(src, &sb) < 0) {
|
if (lstat(fullsrcpath, &sb) < 0) {
|
||||||
src_exists = false;
|
|
||||||
if (!isdir) {
|
if (!isdir) {
|
||||||
i = strdup(src);
|
i = strdup(src);
|
||||||
hashmap_put(items_failed, i, i);
|
hashmap_put(items_failed, i, i);
|
||||||
/* src does not exist */
|
/* src does not exist */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
src_islink = S_ISLNK(sb.st_mode);
|
||||||
|
src_isdir = S_ISDIR(sb.st_mode);
|
||||||
|
src_mode = sb.st_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = strdup(dst);
|
|
||||||
if (!i)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
hashmap_put(items, i, i);
|
|
||||||
|
|
||||||
ret = asprintf(&fulldstpath, "%s/%s", destrootdir, (dst[0]=='/' ? (dst+1) : dst));
|
ret = asprintf(&fulldstpath, "%s/%s", destrootdir, (dst[0]=='/' ? (dst+1) : dst));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
log_error("Out of memory!");
|
log_error("Out of memory!");
|
||||||
|
@ -642,15 +778,18 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||||
|
|
||||||
ret = stat(fulldstpath, &sb);
|
ret = stat(fulldstpath, &sb);
|
||||||
|
|
||||||
if (ret != 0 && (errno != ENOENT)) {
|
if (ret != 0) {
|
||||||
log_error("ERROR: stat '%s': %m", fulldstpath);
|
dst_exists = false;
|
||||||
return 1;
|
if (errno != ENOENT) {
|
||||||
|
log_error("ERROR: stat '%s': %m", fulldstpath);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
if (resolvedeps && S_ISREG(sb.st_mode) && (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
|
if (resolvedeps && S_ISREG(sb.st_mode) && (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
|
||||||
log_debug("'%s' already exists, but checking for any deps", fulldstpath);
|
log_debug("'%s' already exists, but checking for any deps", fulldstpath);
|
||||||
ret = resolve_deps(src);
|
ret = resolve_deps(fullsrcpath + sysrootdirlen);
|
||||||
} else
|
} else
|
||||||
log_debug("'%s' already exists", fulldstpath);
|
log_debug("'%s' already exists", fulldstpath);
|
||||||
|
|
||||||
|
@ -660,6 +799,10 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||||
|
|
||||||
/* check destination directory */
|
/* check destination directory */
|
||||||
fulldstdir = strdup(fulldstpath);
|
fulldstdir = strdup(fulldstpath);
|
||||||
|
if (!fulldstdir) {
|
||||||
|
log_error("Out of memory!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
fulldstdir[dir_len(fulldstdir)] = '\0';
|
fulldstdir[dir_len(fulldstdir)] = '\0';
|
||||||
|
|
||||||
ret = stat(fulldstdir, &db);
|
ret = stat(fulldstdir, &db);
|
||||||
|
@ -686,24 +829,34 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isdir && !src_exists) {
|
if (src_isdir) {
|
||||||
|
if (dst_exists) {
|
||||||
|
if (S_ISDIR(sb.st_mode)) {
|
||||||
|
log_debug("dest dir '%s' already exists", fulldstpath);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
log_error("dest dir '%s' already exists but is not a directory", fulldstpath);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
log_info("mkdir '%s'", fulldstpath);
|
log_info("mkdir '%s'", fulldstpath);
|
||||||
ret = mkdir(fulldstpath, 0755);
|
ret = dracut_mkdir(fulldstpath);
|
||||||
|
if (ret == 0) {
|
||||||
|
i = strdup(dst);
|
||||||
|
if (!i)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
hashmap_put(items, i, i);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ready to install src */
|
/* ready to install src */
|
||||||
|
|
||||||
if (S_ISDIR(sb.st_mode)) {
|
if (src_islink) {
|
||||||
log_info("mkdir '%s'", fulldstpath);
|
|
||||||
ret = mkdir(fulldstpath, sb.st_mode | S_IWUSR);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (S_ISLNK(sb.st_mode)) {
|
|
||||||
_cleanup_free_ char *abspath = NULL;
|
_cleanup_free_ char *abspath = NULL;
|
||||||
|
|
||||||
abspath = realpath(src, NULL);
|
abspath = get_real_file(src, false);
|
||||||
|
|
||||||
if (abspath == NULL)
|
if (abspath == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -721,7 +874,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||||
if (lstat(fulldstpath, &sb) != 0) {
|
if (lstat(fulldstpath, &sb) != 0) {
|
||||||
_cleanup_free_ char *absdestpath = NULL;
|
_cleanup_free_ char *absdestpath = NULL;
|
||||||
|
|
||||||
ret = asprintf(&absdestpath, "%s/%s", destrootdir, (abspath[0]=='/' ? (abspath+1) : abspath));
|
ret = asprintf(&absdestpath, "%s/%s", destrootdir, (abspath[0]=='/' ? (abspath+1) : abspath) + sysrootdirlen);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
log_error("Out of memory!");
|
log_error("Out of memory!");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -738,9 +891,9 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
|
if (src_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
|
||||||
if (resolvedeps)
|
if (resolvedeps)
|
||||||
ret += resolve_deps(src);
|
ret += resolve_deps(fullsrcpath + sysrootdirlen);
|
||||||
if (arg_hmac) {
|
if (arg_hmac) {
|
||||||
/* copy .hmac files also */
|
/* copy .hmac files also */
|
||||||
hmac_install(src, dst, NULL);
|
hmac_install(src, dst, NULL);
|
||||||
|
@ -748,14 +901,28 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug("dracut_install ret = %d", ret);
|
log_debug("dracut_install ret = %d", ret);
|
||||||
log_info("cp '%s' '%s'", src, fulldstpath);
|
|
||||||
|
|
||||||
if (arg_hostonly && !arg_module)
|
if (arg_hostonly && !arg_module)
|
||||||
mark_hostonly(dst);
|
mark_hostonly(dst);
|
||||||
|
|
||||||
ret += cp(src, fulldstpath);
|
if (isdir) {
|
||||||
if (ret == 0 && logfile_f)
|
log_info("mkdir '%s'", fulldstpath);
|
||||||
dracut_log_cp(src);
|
ret += dracut_mkdir(fulldstpath);
|
||||||
|
} else {
|
||||||
|
log_info("cp '%s' '%s'", fullsrcpath, fulldstpath);
|
||||||
|
ret += cp(fullsrcpath, fulldstpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == 0) {
|
||||||
|
i = strdup(dst);
|
||||||
|
if (!i)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
hashmap_put(items, i, i);
|
||||||
|
|
||||||
|
if (logfile_f)
|
||||||
|
dracut_log_cp(src);
|
||||||
|
}
|
||||||
|
|
||||||
log_debug("dracut_install ret = %d", ret);
|
log_debug("dracut_install ret = %d", ret);
|
||||||
|
|
||||||
|
@ -771,11 +938,11 @@ static void item_free(char *i)
|
||||||
static void usage(int status)
|
static void usage(int status)
|
||||||
{
|
{
|
||||||
/* */
|
/* */
|
||||||
printf("Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...\n"
|
printf("Usage: %s -D DESTROOTDIR [-r SYSROOTDIR] [OPTION]... -a SOURCE...\n"
|
||||||
"or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST\n"
|
"or: %s -D DESTROOTDIR [-r SYSROOTDIR] [OPTION]... SOURCE DEST\n"
|
||||||
"or: %s -D DESTROOTDIR [OPTION]... -m KERNELMODULE [KERNELMODULE …]\n"
|
"or: %s -D DESTROOTDIR [-r SYSROOTDIR] [OPTION]... -m KERNELMODULE [KERNELMODULE …]\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Install SOURCE to DEST in DESTROOTDIR with all needed dependencies.\n"
|
"Install SOURCE (from rootfs or SYSROOTDIR) to DEST in DESTROOTDIR with all needed dependencies.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" KERNELMODULE can have the format:\n"
|
" KERNELMODULE can have the format:\n"
|
||||||
" <absolute path> with a leading /\n"
|
" <absolute path> with a leading /\n"
|
||||||
|
@ -783,6 +950,7 @@ static void usage(int status)
|
||||||
" <module name>\n"
|
" <module name>\n"
|
||||||
"\n"
|
"\n"
|
||||||
" -D --destrootdir Install all files to DESTROOTDIR as the root\n"
|
" -D --destrootdir Install all files to DESTROOTDIR as the root\n"
|
||||||
|
" -r --sysrootdir Install all files from SYSROOTDIR\n"
|
||||||
" -a --all Install all SOURCE arguments to DESTROOTDIR\n"
|
" -a --all Install all SOURCE arguments to DESTROOTDIR\n"
|
||||||
" -o --optional If SOURCE does not exist, do not fail\n"
|
" -o --optional If SOURCE does not exist, do not fail\n"
|
||||||
" -d --dir SOURCE is a directory\n"
|
" -d --dir SOURCE is a directory\n"
|
||||||
|
@ -842,6 +1010,7 @@ static int parse_argv(int argc, char *argv[])
|
||||||
{"module", no_argument, NULL, 'm'},
|
{"module", no_argument, NULL, 'm'},
|
||||||
{"fips", no_argument, NULL, 'f'},
|
{"fips", no_argument, NULL, 'f'},
|
||||||
{"destrootdir", required_argument, NULL, 'D'},
|
{"destrootdir", required_argument, NULL, 'D'},
|
||||||
|
{"sysrootdir", required_argument, NULL, 'r'},
|
||||||
{"logdir", required_argument, NULL, 'L'},
|
{"logdir", required_argument, NULL, 'L'},
|
||||||
{"mod-filter-path", required_argument, NULL, 'p'},
|
{"mod-filter-path", required_argument, NULL, 'p'},
|
||||||
{"mod-filter-nopath", required_argument, NULL, 'P'},
|
{"mod-filter-nopath", required_argument, NULL, 'P'},
|
||||||
|
@ -855,7 +1024,7 @@ static int parse_argv(int argc, char *argv[])
|
||||||
{NULL, 0, NULL, 0}
|
{NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "madfhlL:oD:HRp:P:s:S:N:", options, NULL)) != -1) {
|
while ((c = getopt_long(argc, argv, "madfhlL:oD:Hr:Rp:P:s:S:N:v", options, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case ARG_VERSION:
|
case ARG_VERSION:
|
||||||
puts(PROGRAM_VERSION_STRING);
|
puts(PROGRAM_VERSION_STRING);
|
||||||
|
@ -894,6 +1063,10 @@ static int parse_argv(int argc, char *argv[])
|
||||||
case 'D':
|
case 'D':
|
||||||
destrootdir = strdup(optarg);
|
destrootdir = strdup(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'r':
|
||||||
|
sysrootdir = strdup(optarg);
|
||||||
|
sysrootdirlen = strlen(sysrootdir);
|
||||||
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
if (regcomp(&mod_filter_path, optarg, REG_NOSUB|REG_EXTENDED) != 0) {
|
if (regcomp(&mod_filter_path, optarg, REG_NOSUB|REG_EXTENDED) != 0) {
|
||||||
log_error("Module path filter %s is not a regular expression", optarg);
|
log_error("Module path filter %s is not a regular expression", optarg);
|
||||||
|
@ -1022,6 +1195,7 @@ static char **find_binary(const char *src)
|
||||||
{
|
{
|
||||||
char **ret = NULL;
|
char **ret = NULL;
|
||||||
char **q;
|
char **q;
|
||||||
|
char *fullsrcpath;
|
||||||
char *newsrc = NULL;
|
char *newsrc = NULL;
|
||||||
|
|
||||||
STRV_FOREACH(q, pathdirs) {
|
STRV_FOREACH(q, pathdirs) {
|
||||||
|
@ -1034,15 +1208,28 @@ static char **find_binary(const char *src)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stat(newsrc, &sb) != 0) {
|
fullsrcpath = get_real_file(newsrc, false);
|
||||||
log_debug("stat(%s) != 0", newsrc);
|
|
||||||
|
if (!fullsrcpath) {
|
||||||
|
log_debug("get_real_file(%s) not found", newsrc);
|
||||||
free(newsrc);
|
free(newsrc);
|
||||||
newsrc = NULL;
|
newsrc = NULL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lstat(fullsrcpath, &sb) != 0) {
|
||||||
|
log_debug("stat(%s) != 0", fullsrcpath);
|
||||||
|
free(newsrc);
|
||||||
|
newsrc = NULL;
|
||||||
|
free(fullsrcpath);
|
||||||
|
fullsrcpath = NULL;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
strv_push(&ret, newsrc);
|
strv_push(&ret, newsrc);
|
||||||
|
|
||||||
|
free(fullsrcpath);
|
||||||
|
fullsrcpath = NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -1271,12 +1458,12 @@ static int install_dependent_modules(struct kmod_list *modlist)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = dracut_install(path, &path[kerneldirlen], false, false, true);
|
ret = dracut_install(&path[kerneldirlen], &path[kerneldirlen], false, false, true);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
|
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
|
||||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL;
|
_cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL;
|
||||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL;
|
_cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL;
|
||||||
log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]);
|
log_debug("dracut_install '%s' '%s' OK", &path[kerneldirlen], &path[kerneldirlen]);
|
||||||
install_firmware(mod);
|
install_firmware(mod);
|
||||||
modlist = kmod_module_get_dependencies(mod);
|
modlist = kmod_module_get_dependencies(mod);
|
||||||
ret = install_dependent_modules(modlist);
|
ret = install_dependent_modules(modlist);
|
||||||
|
@ -1286,7 +1473,7 @@ static int install_dependent_modules(struct kmod_list *modlist)
|
||||||
ret = install_dependent_modules(modpre);
|
ret = install_dependent_modules(modpre);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
|
log_error("dracut_install '%s' '%s' ERROR", &path[kerneldirlen], &path[kerneldirlen]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1328,9 +1515,9 @@ static int install_module(struct kmod_module *mod)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug("dracut_install '%s' '%s'", path, &path[kerneldirlen]);
|
log_debug("dracut_install '%s' '%s'", &path[kerneldirlen], &path[kerneldirlen]);
|
||||||
|
|
||||||
ret = dracut_install(path, &path[kerneldirlen], false, false, true);
|
ret = dracut_install(&path[kerneldirlen], &path[kerneldirlen], false, false, true);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
log_debug("dracut_install '%s' OK", kmod_module_get_name(mod));
|
log_debug("dracut_install '%s' OK", kmod_module_get_name(mod));
|
||||||
} else if (!arg_optional) {
|
} else if (!arg_optional) {
|
||||||
|
@ -1738,7 +1925,13 @@ int main(int argc, char **argv)
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
path = getenv("PATH");
|
log_debug("Program arguments:");
|
||||||
|
for (r = 0; r < argc; r++)
|
||||||
|
log_debug("%s", argv[r]);
|
||||||
|
|
||||||
|
path = getenv("DRACUT_INSTALL_PATH");
|
||||||
|
if (path == NULL)
|
||||||
|
path = getenv("PATH");
|
||||||
|
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
log_error("PATH is not set");
|
log_error("PATH is not set");
|
||||||
|
@ -1747,6 +1940,11 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
log_debug("PATH=%s", path);
|
log_debug("PATH=%s", path);
|
||||||
|
|
||||||
|
ldd = getenv("DRACUT_LDD");
|
||||||
|
if (ldd == NULL)
|
||||||
|
ldd = "ldd";
|
||||||
|
log_debug("LDD=%s", ldd);
|
||||||
|
|
||||||
pathdirs = strv_split(path, ":");
|
pathdirs = strv_split(path, ":");
|
||||||
|
|
||||||
umask(0022);
|
umask(0022);
|
||||||
|
|
|
@ -41,86 +41,10 @@ struct Hashmap {
|
||||||
|
|
||||||
struct hashmap_entry *iterate_list_head, *iterate_list_tail;
|
struct hashmap_entry *iterate_list_head, *iterate_list_tail;
|
||||||
unsigned n_entries;
|
unsigned n_entries;
|
||||||
|
|
||||||
bool from_pool;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BY_HASH(h) ((struct hashmap_entry**) ((uint8_t*) (h) + ALIGN(sizeof(Hashmap))))
|
#define BY_HASH(h) ((struct hashmap_entry**) ((uint8_t*) (h) + ALIGN(sizeof(Hashmap))))
|
||||||
|
|
||||||
struct pool {
|
|
||||||
struct pool *next;
|
|
||||||
unsigned n_tiles;
|
|
||||||
unsigned n_used;
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct pool *first_hashmap_pool = NULL;
|
|
||||||
static void *first_hashmap_tile = NULL;
|
|
||||||
|
|
||||||
static struct pool *first_entry_pool = NULL;
|
|
||||||
static void *first_entry_tile = NULL;
|
|
||||||
|
|
||||||
static void* allocate_tile(struct pool **first_pool, void **first_tile, size_t tile_size) {
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
if (*first_tile) {
|
|
||||||
void *r;
|
|
||||||
|
|
||||||
r = *first_tile;
|
|
||||||
*first_tile = * (void**) (*first_tile);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_unlikely_(!*first_pool) || _unlikely_((*first_pool)->n_used >= (*first_pool)->n_tiles)) {
|
|
||||||
unsigned n;
|
|
||||||
size_t size;
|
|
||||||
struct pool *p;
|
|
||||||
|
|
||||||
n = *first_pool ? (*first_pool)->n_tiles : 0;
|
|
||||||
n = MAX(512U, n * 2);
|
|
||||||
size = PAGE_ALIGN(ALIGN(sizeof(struct pool)) + n*tile_size);
|
|
||||||
n = (size - ALIGN(sizeof(struct pool))) / tile_size;
|
|
||||||
|
|
||||||
p = malloc(size);
|
|
||||||
if (!p)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
p->next = *first_pool;
|
|
||||||
p->n_tiles = n;
|
|
||||||
p->n_used = 0;
|
|
||||||
|
|
||||||
*first_pool = p;
|
|
||||||
}
|
|
||||||
|
|
||||||
i = (*first_pool)->n_used++;
|
|
||||||
|
|
||||||
return ((uint8_t*) (*first_pool)) + ALIGN(sizeof(struct pool)) + i*tile_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void deallocate_tile(void **first_tile, void *p) {
|
|
||||||
* (void**) p = *first_tile;
|
|
||||||
*first_tile = p;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef __OPTIMIZE__
|
|
||||||
|
|
||||||
static void drop_pool(struct pool *p) {
|
|
||||||
while (p) {
|
|
||||||
struct pool *n;
|
|
||||||
n = p->next;
|
|
||||||
free(p);
|
|
||||||
p = n;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((destructor)) static void cleanup_pool(void) {
|
|
||||||
/* Be nice to valgrind */
|
|
||||||
|
|
||||||
drop_pool(first_hashmap_pool);
|
|
||||||
drop_pool(first_entry_pool);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned string_hash_func(const void *p) {
|
unsigned string_hash_func(const void *p) {
|
||||||
unsigned hash = 5381;
|
unsigned hash = 5381;
|
||||||
const signed char *c;
|
const signed char *c;
|
||||||
|
@ -146,26 +70,15 @@ int trivial_compare_func(const void *a, const void *b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func) {
|
Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func) {
|
||||||
bool b;
|
|
||||||
Hashmap *h;
|
Hashmap *h;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
b = is_main_thread();
|
|
||||||
|
|
||||||
size = ALIGN(sizeof(Hashmap)) + NBUCKETS * sizeof(struct hashmap_entry*);
|
size = ALIGN(sizeof(Hashmap)) + NBUCKETS * sizeof(struct hashmap_entry*);
|
||||||
|
|
||||||
if (b) {
|
h = malloc0(size);
|
||||||
h = allocate_tile(&first_hashmap_pool, &first_hashmap_tile, size);
|
|
||||||
if (!h)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
memset(h, 0, size);
|
if (!h)
|
||||||
} else {
|
return NULL;
|
||||||
h = malloc0(size);
|
|
||||||
|
|
||||||
if (!h)
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
h->hash_func = hash_func ? hash_func : trivial_hash_func;
|
h->hash_func = hash_func ? hash_func : trivial_hash_func;
|
||||||
h->compare_func = compare_func ? compare_func : trivial_compare_func;
|
h->compare_func = compare_func ? compare_func : trivial_compare_func;
|
||||||
|
@ -173,8 +86,6 @@ Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func) {
|
||||||
h->n_entries = 0;
|
h->n_entries = 0;
|
||||||
h->iterate_list_head = h->iterate_list_tail = NULL;
|
h->iterate_list_head = h->iterate_list_tail = NULL;
|
||||||
|
|
||||||
h->from_pool = b;
|
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +156,8 @@ static void unlink_entry(Hashmap *h, struct hashmap_entry *e, unsigned hash) {
|
||||||
h->n_entries--;
|
h->n_entries--;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void remove_entry(Hashmap *h, struct hashmap_entry *e) {
|
static void remove_entry(Hashmap *h, struct hashmap_entry **ep) {
|
||||||
|
struct hashmap_entry *e = *ep;
|
||||||
unsigned hash;
|
unsigned hash;
|
||||||
|
|
||||||
assert(h);
|
assert(h);
|
||||||
|
@ -255,10 +167,8 @@ static void remove_entry(Hashmap *h, struct hashmap_entry *e) {
|
||||||
|
|
||||||
unlink_entry(h, e, hash);
|
unlink_entry(h, e, hash);
|
||||||
|
|
||||||
if (h->from_pool)
|
free(e);
|
||||||
deallocate_tile(&first_entry_tile, e);
|
*ep = NULL;
|
||||||
else
|
|
||||||
free(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hashmap_free(Hashmap*h) {
|
void hashmap_free(Hashmap*h) {
|
||||||
|
@ -268,10 +178,7 @@ void hashmap_free(Hashmap*h) {
|
||||||
|
|
||||||
hashmap_clear(h);
|
hashmap_clear(h);
|
||||||
|
|
||||||
if (h->from_pool)
|
free(h);
|
||||||
deallocate_tile(&first_hashmap_tile, h);
|
|
||||||
else
|
|
||||||
free(h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hashmap_free_free(Hashmap *h) {
|
void hashmap_free_free(Hashmap *h) {
|
||||||
|
@ -287,8 +194,10 @@ void hashmap_clear(Hashmap *h) {
|
||||||
if (!h)
|
if (!h)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (h->iterate_list_head)
|
while (h->iterate_list_head) {
|
||||||
remove_entry(h, h->iterate_list_head);
|
struct hashmap_entry *e = h->iterate_list_head;
|
||||||
|
remove_entry(h, &e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct hashmap_entry *hash_scan(Hashmap *h, unsigned hash, const void *key) {
|
static struct hashmap_entry *hash_scan(Hashmap *h, unsigned hash, const void *key) {
|
||||||
|
@ -319,10 +228,7 @@ int hashmap_put(Hashmap *h, const void *key, void *value) {
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (h->from_pool)
|
e = new(struct hashmap_entry, 1);
|
||||||
e = allocate_tile(&first_entry_pool, &first_entry_tile, sizeof(struct hashmap_entry));
|
|
||||||
else
|
|
||||||
e = new(struct hashmap_entry, 1);
|
|
||||||
|
|
||||||
if (!e)
|
if (!e)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -381,7 +287,7 @@ void* hashmap_remove(Hashmap *h, const void *key) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
data = e->value;
|
data = e->value;
|
||||||
remove_entry(h, e);
|
remove_entry(h, &e);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -426,7 +332,7 @@ int hashmap_remove_and_replace(Hashmap *h, const void *old_key, const void *new_
|
||||||
|
|
||||||
if ((k = hash_scan(h, new_hash, new_key)))
|
if ((k = hash_scan(h, new_hash, new_key)))
|
||||||
if (e != k)
|
if (e != k)
|
||||||
remove_entry(h, k);
|
remove_entry(h, &k);
|
||||||
|
|
||||||
unlink_entry(h, e, old_hash);
|
unlink_entry(h, e, old_hash);
|
||||||
|
|
||||||
|
@ -453,7 +359,7 @@ void* hashmap_remove_value(Hashmap *h, const void *key, void *value) {
|
||||||
if (e->value != value)
|
if (e->value != value)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
remove_entry(h, e);
|
remove_entry(h, &e);
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -579,6 +485,7 @@ void* hashmap_last(Hashmap *h) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void* hashmap_steal_first(Hashmap *h) {
|
void* hashmap_steal_first(Hashmap *h) {
|
||||||
|
struct hashmap_entry *e;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
if (!h)
|
if (!h)
|
||||||
|
@ -587,13 +494,15 @@ void* hashmap_steal_first(Hashmap *h) {
|
||||||
if (!h->iterate_list_head)
|
if (!h->iterate_list_head)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
data = h->iterate_list_head->value;
|
e = h->iterate_list_head;
|
||||||
remove_entry(h, h->iterate_list_head);
|
data = e->value;
|
||||||
|
remove_entry(h, &e);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* hashmap_steal_first_key(Hashmap *h) {
|
void* hashmap_steal_first_key(Hashmap *h) {
|
||||||
|
struct hashmap_entry *e;
|
||||||
void *key;
|
void *key;
|
||||||
|
|
||||||
if (!h)
|
if (!h)
|
||||||
|
@ -602,8 +511,9 @@ void* hashmap_steal_first_key(Hashmap *h) {
|
||||||
if (!h->iterate_list_head)
|
if (!h->iterate_list_head)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
key = (void*) h->iterate_list_head->key;
|
e = h->iterate_list_head;
|
||||||
remove_entry(h, h->iterate_list_head);
|
key = (void*) e->key;
|
||||||
|
remove_entry(h, &e);
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
@ -694,22 +604,6 @@ int hashmap_move_one(Hashmap *h, Hashmap *other, const void *key) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Hashmap *hashmap_copy(Hashmap *h) {
|
|
||||||
Hashmap *copy;
|
|
||||||
|
|
||||||
assert(h);
|
|
||||||
|
|
||||||
if (!(copy = hashmap_new(h->hash_func, h->compare_func)))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (hashmap_merge(copy, h) < 0) {
|
|
||||||
hashmap_free(copy);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
char **hashmap_get_strv(Hashmap *h) {
|
char **hashmap_get_strv(Hashmap *h) {
|
||||||
char **sv;
|
char **sv;
|
||||||
Iterator it;
|
Iterator it;
|
||||||
|
|
|
@ -46,7 +46,6 @@ int trivial_compare_func(const void *a, const void *b);
|
||||||
Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func);
|
Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func);
|
||||||
void hashmap_free(Hashmap *h);
|
void hashmap_free(Hashmap *h);
|
||||||
void hashmap_free_free(Hashmap *h);
|
void hashmap_free_free(Hashmap *h);
|
||||||
Hashmap *hashmap_copy(Hashmap *h);
|
|
||||||
int hashmap_ensure_allocated(Hashmap **h, hash_func_t hash_func, compare_func_t compare_func);
|
int hashmap_ensure_allocated(Hashmap **h, hash_func_t hash_func, compare_func_t compare_func);
|
||||||
|
|
||||||
int hashmap_put(Hashmap *h, const void *key, void *value);
|
int hashmap_put(Hashmap *h, const void *key, void *value);
|
||||||
|
|
|
@ -264,14 +264,21 @@ int log_set_max_level_from_string(const char *e) {
|
||||||
void log_parse_environment(void) {
|
void log_parse_environment(void) {
|
||||||
const char *e;
|
const char *e;
|
||||||
|
|
||||||
if ((e = getenv("DRACUT_LOG_TARGET")))
|
if ((e = getenv("DRACUT_INSTALL_LOG_TARGET"))) {
|
||||||
if (log_set_target_from_string(e) < 0)
|
if (log_set_target_from_string(e) < 0)
|
||||||
log_warning("Failed to parse log target %s. Ignoring.", e);
|
log_warning("Failed to parse log target %s. Ignoring.", e);
|
||||||
|
} else if ((e = getenv("DRACUT_LOG_TARGET"))) {
|
||||||
|
if (log_set_target_from_string(e) < 0)
|
||||||
|
log_warning("Failed to parse log target %s. Ignoring.", e);
|
||||||
|
}
|
||||||
|
|
||||||
if ((e = getenv("DRACUT_LOG_LEVEL")))
|
if ((e = getenv("DRACUT_INSTALL_LOG_LEVEL"))) {
|
||||||
if (log_set_max_level_from_string(e) < 0)
|
if (log_set_max_level_from_string(e) < 0)
|
||||||
log_warning("Failed to parse log level %s. Ignoring.", e);
|
log_warning("Failed to parse log level %s. Ignoring.", e);
|
||||||
|
} else if ((e = getenv("DRACUT_LOG_LEVEL"))) {
|
||||||
|
if (log_set_max_level_from_string(e) < 0)
|
||||||
|
log_warning("Failed to parse log level %s. Ignoring.", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogTarget log_get_target(void) {
|
LogTarget log_get_target(void) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ default_kernel_images() {
|
||||||
local regex kernel_image kernel_version version_version initrd_image
|
local regex kernel_image kernel_version version_version initrd_image
|
||||||
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
|
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
|
||||||
|
|
||||||
case "$(uname -m)" in
|
case "${DRACUT_ARCH:-$(uname -m)}" in
|
||||||
s390|s390x)
|
s390|s390x)
|
||||||
regex='image'
|
regex='image'
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -164,7 +164,7 @@ default_kernel_images() {
|
||||||
local regex kernel_image kernel_version version_version initrd_image
|
local regex kernel_image kernel_version version_version initrd_image
|
||||||
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
|
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
|
||||||
|
|
||||||
case "$(uname -m)" in
|
case "${DRACUT_ARCH:-$(uname -m)}" in
|
||||||
s390|s390x)
|
s390|s390x)
|
||||||
regex='image'
|
regex='image'
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
getSystemdVersion() {
|
getSystemdVersion() {
|
||||||
SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
|
[ -z "$SYSTEMD_VERSION" ] && SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
|
||||||
# Check if the systemd version is a valid number
|
# Check if the systemd version is a valid number
|
||||||
if ! [[ $SYSTEMD_VERSION =~ ^[0-9]+$ ]]; then
|
if ! [[ $SYSTEMD_VERSION =~ ^[0-9]+$ ]]; then
|
||||||
dfatal "systemd version is not a number ($SYSTEMD_VERSION)"
|
dfatal "systemd version is not a number ($SYSTEMD_VERSION)"
|
||||||
|
@ -163,7 +163,7 @@ install() {
|
||||||
|
|
||||||
modules_load_get() {
|
modules_load_get() {
|
||||||
local _line i
|
local _line i
|
||||||
for i in "$1"/*.conf; do
|
for i in "$dracutsysrootdir$1"/*.conf; do
|
||||||
[[ -f $i ]] || continue
|
[[ -f $i ]] || continue
|
||||||
while read _line || [ -n "$_line" ]; do
|
while read _line || [ -n "$_line" ]; do
|
||||||
case $_line in
|
case $_line in
|
||||||
|
@ -208,17 +208,17 @@ install() {
|
||||||
|
|
||||||
# install adm user/group for journald
|
# install adm user/group for journald
|
||||||
inst_multiple nologin
|
inst_multiple nologin
|
||||||
grep '^systemd-journal:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
grep '^systemd-journal:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||||
grep '^adm:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
grep '^adm:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||||
grep '^systemd-journal:' /etc/group >> "$initdir/etc/group"
|
grep '^systemd-journal:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||||
grep '^wheel:' /etc/group >> "$initdir/etc/group"
|
grep '^wheel:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||||
grep '^adm:' /etc/group >> "$initdir/etc/group"
|
grep '^adm:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||||
grep '^utmp:' /etc/group >> "$initdir/etc/group"
|
grep '^utmp:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||||
grep '^root:' /etc/group >> "$initdir/etc/group"
|
grep '^root:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||||
|
|
||||||
# we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
|
# we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
|
||||||
grep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
grep '^systemd-network:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||||
grep '^systemd-network:' /etc/group >> "$initdir/etc/group"
|
grep '^systemd-network:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||||
|
|
||||||
ln_r $systemdutildir/systemd "/init"
|
ln_r $systemdutildir/systemd "/init"
|
||||||
ln_r $systemdutildir/systemd "/sbin/init"
|
ln_r $systemdutildir/systemd "/sbin/init"
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# called by dracut
|
# called by dracut
|
||||||
check() {
|
check() {
|
||||||
# hwclock does not exist on S390(x), bail out silently then
|
# hwclock does not exist on S390(x), bail out silently then
|
||||||
local _arch=$(uname -m)
|
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] && return 1
|
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] && return 1
|
||||||
|
|
||||||
[ -e /etc/localtime -a -e /etc/adjtime ] || return 1
|
[ -e /etc/localtime -a -e /etc/adjtime ] || return 1
|
||||||
|
|
|
@ -48,12 +48,12 @@ install() {
|
||||||
|
|
||||||
# inst_dir /var/lib/systemd/clock
|
# inst_dir /var/lib/systemd/clock
|
||||||
|
|
||||||
grep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
grep '^systemd-network:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||||
grep '^systemd-network:' /etc/group >> "$initdir/etc/group"
|
grep '^systemd-network:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||||
# grep '^systemd-timesync:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
# grep '^systemd-timesync:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||||
# grep '^systemd-timesync:' /etc/group >> "$initdir/etc/group"
|
# grep '^systemd-timesync:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||||
|
|
||||||
_arch=$(uname -m)
|
_arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
||||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*" \
|
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*" \
|
||||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_myhostname.so.*" \
|
{"tls/$_arch/",tls/,"$_arch/",}"libnss_myhostname.so.*" \
|
||||||
|
|
|
@ -12,8 +12,8 @@ check() {
|
||||||
# do not include module in hostonly mode,
|
# do not include module in hostonly mode,
|
||||||
# if no keys are present
|
# if no keys are present
|
||||||
if [[ $hostonly ]]; then
|
if [[ $hostonly ]]; then
|
||||||
x=$(echo /lib/modules/keys/*)
|
x=$(echo $dracutsysrootdir/lib/modules/keys/*)
|
||||||
[[ "${x}" = "/lib/modules/keys/*" ]] && return 255
|
[[ "${x}" = "$dracutsysrootdir/lib/modules/keys/*" ]] && return 255
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
@ -31,8 +31,8 @@ install() {
|
||||||
|
|
||||||
inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"
|
inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"
|
||||||
|
|
||||||
for x in /lib/modules/keys/* ; do
|
for x in $dracutsysrootdir/lib/modules/keys/* ; do
|
||||||
[[ "${x}" = "/lib/modules/keys/*" ]] && break
|
[[ "${x}" = "$dracutsysrootdir/lib/modules/keys/*" ]] && break
|
||||||
inst_simple "${x}"
|
inst_simple "${x#$dracutsysrootdir}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ install() {
|
||||||
if dracut_module_included "systemd"; then
|
if dracut_module_included "systemd"; then
|
||||||
unset FONT
|
unset FONT
|
||||||
unset KEYMAP
|
unset KEYMAP
|
||||||
[[ -f /etc/vconsole.conf ]] && . /etc/vconsole.conf
|
[[ -f $dracutsysrootdir/etc/vconsole.conf ]] && . $dracutsysrootdir/etc/vconsole.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
|
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
|
||||||
|
@ -32,8 +32,8 @@ install() {
|
||||||
local MAPS=$1
|
local MAPS=$1
|
||||||
local MAPNAME=${1%.map*}
|
local MAPNAME=${1%.map*}
|
||||||
local map
|
local map
|
||||||
[[ ! -f $MAPS ]] && \
|
[[ ! -f $dracutsysrootdir$MAPS ]] && \
|
||||||
MAPS=$(find ${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\*)
|
MAPS=$(find $dracutsysrootdir${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\*)
|
||||||
|
|
||||||
for map in $MAPS; do
|
for map in $MAPS; do
|
||||||
KEYMAPS="$KEYMAPS $map "
|
KEYMAPS="$KEYMAPS $map "
|
||||||
|
@ -44,7 +44,7 @@ install() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
for INCL in $($cmd "^include " $map | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
|
for INCL in $($cmd "^include " $map | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
|
||||||
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
|
for FN in $(find $dracutsysrootdir${kbddir}/keymaps -type f -name $INCL\*); do
|
||||||
strstr "$KEYMAPS" " $FN " || findkeymap $FN
|
strstr "$KEYMAPS" " $FN " || findkeymap $FN
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
@ -87,8 +87,8 @@ install() {
|
||||||
for map in ${item[1]//,/ }
|
for map in ${item[1]//,/ }
|
||||||
do
|
do
|
||||||
map=(${map//-/ })
|
map=(${map//-/ })
|
||||||
if [[ -f "${item[0]}" ]]; then
|
if [[ -f "$dracutsysrootdir${item[0]}" ]]; then
|
||||||
value=$(grep "^${map[0]}=" "${item[0]}")
|
value=$(grep "^${map[0]}=" "$dracutsysrootdir${item[0]}")
|
||||||
value=${value#*=}
|
value=${value#*=}
|
||||||
echo "${map[1]:-${map[0]}}=${value}"
|
echo "${map[1]:-${map[0]}}=${value}"
|
||||||
fi
|
fi
|
||||||
|
@ -116,9 +116,10 @@ install() {
|
||||||
install_all_kbd() {
|
install_all_kbd() {
|
||||||
local rel f
|
local rel f
|
||||||
|
|
||||||
for _src in $(eval echo ${kbddir}/{${KBDSUBDIRS}}); do
|
for __src in $(eval echo $dracutsysrootdir${kbddir}/{${KBDSUBDIRS}}); do
|
||||||
|
_src=${__src#$dracutsysrootdir}
|
||||||
inst_dir "$_src"
|
inst_dir "$_src"
|
||||||
$DRACUT_CP -L -t "${initdir}/${_src}" "$_src"/*
|
$DRACUT_CP -L -t "${initdir}/${_src}" "$__src"/*
|
||||||
done
|
done
|
||||||
|
|
||||||
# remove unnecessary files
|
# remove unnecessary files
|
||||||
|
@ -139,8 +140,8 @@ install() {
|
||||||
local map
|
local map
|
||||||
|
|
||||||
eval $(gather_vars ${i18n_vars})
|
eval $(gather_vars ${i18n_vars})
|
||||||
[ -f $I18N_CONF ] && . $I18N_CONF
|
[ -f $dracutsysrootdir$I18N_CONF ] && . $dracutsysrootdir$I18N_CONF
|
||||||
[ -f $VCONFIG_CONF ] && . $VCONFIG_CONF
|
[ -f $dracutsysrootdir$VCONFIG_CONF ] && . $dracutsysrootdir$VCONFIG_CONF
|
||||||
|
|
||||||
shopt -q -s nocasematch
|
shopt -q -s nocasematch
|
||||||
if [[ ${UNICODE} ]]
|
if [[ ${UNICODE} ]]
|
||||||
|
@ -222,14 +223,14 @@ install() {
|
||||||
inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni
|
inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if dracut_module_included "systemd" && [[ -f ${I18N_CONF} ]]; then
|
if dracut_module_included "systemd" && [[ -f $dracutsysrootdir${I18N_CONF} ]]; then
|
||||||
inst_simple ${I18N_CONF}
|
inst_simple ${I18N_CONF}
|
||||||
else
|
else
|
||||||
mksubdirs ${initdir}${I18N_CONF}
|
mksubdirs ${initdir}${I18N_CONF}
|
||||||
print_vars LC_ALL LANG >> ${initdir}${I18N_CONF}
|
print_vars LC_ALL LANG >> ${initdir}${I18N_CONF}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if dracut_module_included "systemd" && [[ -f ${VCONFIG_CONF} ]]; then
|
if dracut_module_included "systemd" && [[ -f $dracutsysrootdir${VCONFIG_CONF} ]]; then
|
||||||
inst_simple ${VCONFIG_CONF}
|
inst_simple ${VCONFIG_CONF}
|
||||||
else
|
else
|
||||||
mksubdirs ${initdir}${VCONFIG_CONF}
|
mksubdirs ${initdir}${VCONFIG_CONF}
|
||||||
|
@ -242,16 +243,16 @@ install() {
|
||||||
checks() {
|
checks() {
|
||||||
for kbddir in ${kbddir} /usr/lib/kbd /lib/kbd /usr/share /usr/share/kbd
|
for kbddir in ${kbddir} /usr/lib/kbd /lib/kbd /usr/share /usr/share/kbd
|
||||||
do
|
do
|
||||||
[[ -d "${kbddir}" ]] && \
|
[[ -d "$dracutsysrootdir${kbddir}" ]] && \
|
||||||
for dir in ${KBDSUBDIRS//,/ }
|
for dir in ${KBDSUBDIRS//,/ }
|
||||||
do
|
do
|
||||||
[[ -d "${kbddir}/${dir}" ]] && continue
|
[[ -d "$dracutsysrootdir${kbddir}/${dir}" ]] && continue
|
||||||
false
|
false
|
||||||
done && break
|
done && break
|
||||||
kbddir=''
|
kbddir=''
|
||||||
done
|
done
|
||||||
|
|
||||||
[[ -f $I18N_CONF && -f $VCONFIG_CONF ]] || \
|
[[ -f $dracutsysrootdir$I18N_CONF && -f $dracutsysrootdir$VCONFIG_CONF ]] || \
|
||||||
[[ ! ${hostonly} || ${i18n_vars} ]] || {
|
[[ ! ${hostonly} || ${i18n_vars} ]] || {
|
||||||
derror 'i18n_vars not set! Please set up i18n_vars in ' \
|
derror 'i18n_vars not set! Please set up i18n_vars in ' \
|
||||||
'configuration file.'
|
'configuration file.'
|
||||||
|
|
|
@ -82,7 +82,7 @@ install() {
|
||||||
)
|
)
|
||||||
done
|
done
|
||||||
|
|
||||||
_arch=$(uname -m)
|
_arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
|
|
||||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
||||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
|
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
|
||||||
|
|
|
@ -8,7 +8,7 @@ check() {
|
||||||
# called by dracut
|
# called by dracut
|
||||||
depends() {
|
depends() {
|
||||||
echo -n "kernel-network-modules "
|
echo -n "kernel-network-modules "
|
||||||
if ! dracut_module_included "network-legacy" && [ -x "/usr/libexec/nm-initrd-generator" ] ; then
|
if ! dracut_module_included "network-legacy" && [ -x "$dracutsysrootdir/usr/libexec/nm-initrd-generator" ] ; then
|
||||||
echo "network-manager"
|
echo "network-manager"
|
||||||
else
|
else
|
||||||
echo "network-legacy"
|
echo "network-legacy"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
check() {
|
check() {
|
||||||
[[ -d /etc/sysconfig/network-scripts ]] && return 0
|
[[ -d $dracutsysrootdir/etc/sysconfig/network-scripts ]] && return 0
|
||||||
return 255
|
return 255
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,14 +26,14 @@ install() {
|
||||||
inst_libdir_file "libsqlite3.so*"
|
inst_libdir_file "libsqlite3.so*"
|
||||||
|
|
||||||
for _dir in $libdirs; do
|
for _dir in $libdirs; do
|
||||||
[[ -d $_dir ]] || continue
|
[[ -d $dracutsysrootdir$_dir ]] || continue
|
||||||
for _lib in $_dir/libcurl.so.*; do
|
for _lib in $dracutsysrootdir$_dir/libcurl.so.*; do
|
||||||
[[ -e $_lib ]] || continue
|
[[ -e $_lib ]] || continue
|
||||||
[[ $_nssckbi ]] || _nssckbi=$(grep -F --binary-files=text -z libnssckbi $_lib)
|
[[ $_nssckbi ]] || _nssckbi=$(grep -F --binary-files=text -z libnssckbi $_lib)
|
||||||
_crt=$(grep -F --binary-files=text -z .crt $_lib)
|
_crt=$(grep -F --binary-files=text -z .crt $_lib)
|
||||||
[[ $_crt ]] || continue
|
[[ $_crt ]] || continue
|
||||||
[[ $_crt == /*/* ]] || continue
|
[[ $_crt == /*/* ]] || continue
|
||||||
if ! inst "$_crt"; then
|
if ! inst "${_crt#$dracutsysrootdir}"; then
|
||||||
dwarn "Couldn't install '$_crt' SSL CA cert bundle; HTTPS might not work."
|
dwarn "Couldn't install '$_crt' SSL CA cert bundle; HTTPS might not work."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
@ -49,23 +49,23 @@ install() {
|
||||||
_found=1
|
_found=1
|
||||||
inst_libdir_file "libnssckbi.so*" || _found=
|
inst_libdir_file "libnssckbi.so*" || _found=
|
||||||
for _dir in $libdirs; do
|
for _dir in $libdirs; do
|
||||||
[[ -e $_dir/libnssckbi.so ]] || continue
|
[[ -e $dracutsysrootdir$_dir/libnssckbi.so ]] || continue
|
||||||
# this looks for directory-ish strings in the file
|
# this looks for directory-ish strings in the file
|
||||||
for _p11roots in $(grep -o --binary-files=text "/[[:alpha:]][[:print:]]*" $_dir/libnssckbi.so) ; do
|
for _p11roots in $(grep -o --binary-files=text "/[[:alpha:]][[:print:]]*" $dracutsysrootdir$_dir/libnssckbi.so) ; do
|
||||||
# the string can be a :-separated list of dirs
|
# the string can be a :-separated list of dirs
|
||||||
for _p11root in $(echo "$_p11roots" | tr ':' '\n') ; do
|
for _p11root in $(echo "$_p11roots" | tr ':' '\n') ; do
|
||||||
# check if it's actually a directory (there are
|
# check if it's actually a directory (there are
|
||||||
# several false positives in the results)
|
# several false positives in the results)
|
||||||
[[ -d "$_p11root" ]] || continue
|
[[ -d "$dracutsysrootdir$_p11root" ]] || continue
|
||||||
# check if it has some specific subdirs that all
|
# check if it has some specific subdirs that all
|
||||||
# p11-kit trust dirs have
|
# p11-kit trust dirs have
|
||||||
[[ -d "${_p11root}/anchors" ]] || continue
|
[[ -d "$dracutsysrootdir${_p11root}/anchors" ]] || continue
|
||||||
[[ -d "${_p11root}/blacklist" ]] || continue
|
[[ -d "$dracutsysrootdir${_p11root}/blacklist" ]] || continue
|
||||||
# so now we know it's really a p11-kit trust dir;
|
# so now we know it's really a p11-kit trust dir;
|
||||||
# install everything in it
|
# install everything in it
|
||||||
for _p11item in $(find "$_p11root") ; do
|
for _p11item in $(find "$dracutsysrootdir$_p11root") ; do
|
||||||
if ! inst "$_p11item" ; then
|
if ! inst "${_p11item#$dracutsysrootdir}" ; then
|
||||||
dwarn "Couldn't install '$_p11item' from p11-kit trust dir '$_p11root'; HTTPS might not work."
|
dwarn "Couldn't install '${_p11item#$dracutsysrootdir}' from p11-kit trust dir '${_p11root#$dracutsysrootdir}'; HTTPS might not work."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -15,7 +15,7 @@ installkernel() {
|
||||||
local _modname
|
local _modname
|
||||||
# Include KMS capable drm drivers
|
# Include KMS capable drm drivers
|
||||||
|
|
||||||
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
|
if [[ "${DRACUT_ARCH:-$(uname -m)}" == arm* || "${DRACUT_ARCH:-$(uname -m)}" == aarch64 ]]; then
|
||||||
# arm/aarch64 specific modules needed by drm
|
# arm/aarch64 specific modules needed by drm
|
||||||
instmods \
|
instmods \
|
||||||
"=drivers/gpu/drm/i2c" \
|
"=drivers/gpu/drm/i2c" \
|
||||||
|
|
|
@ -52,7 +52,7 @@ install() {
|
||||||
_splash_res=${DRACUT_GENSPLASH_RES}
|
_splash_res=${DRACUT_GENSPLASH_RES}
|
||||||
elif [[ ${hostonly} ]]; then
|
elif [[ ${hostonly} ]]; then
|
||||||
# Settings from config only in hostonly
|
# Settings from config only in hostonly
|
||||||
[[ -e /etc/conf.d/splash ]] && source /etc/conf.d/splash
|
[[ -e $dracutsysrootdir/etc/conf.d/splash ]] && source $dracutsysrootdir/etc/conf.d/splash
|
||||||
[[ ! ${_splash_theme} ]] && _splash_theme=default
|
[[ ! ${_splash_theme} ]] && _splash_theme=default
|
||||||
[[ ${_splash_res} ]] && _opts+=" -r ${_splash_res}"
|
[[ ${_splash_res} ]] && _opts+=" -r ${_splash_res}"
|
||||||
else
|
else
|
||||||
|
|
|
@ -6,7 +6,7 @@ pkglib_dir() {
|
||||||
_dirs+=" /usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
|
_dirs+=" /usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
|
||||||
fi
|
fi
|
||||||
for _dir in $_dirs; do
|
for _dir in $_dirs; do
|
||||||
if [ -x $_dir/plymouth-populate-initrd ]; then
|
if [ -x $dracutsysrootdir$_dir/plymouth-populate-initrd ]; then
|
||||||
echo $_dir
|
echo $_dir
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
@ -29,12 +29,12 @@ depends() {
|
||||||
# called by dracut
|
# called by dracut
|
||||||
install() {
|
install() {
|
||||||
PKGLIBDIR=$(pkglib_dir)
|
PKGLIBDIR=$(pkglib_dir)
|
||||||
if grep -q nash ${PKGLIBDIR}/plymouth-populate-initrd \
|
if grep -q nash $dracutsysrootdir${PKGLIBDIR}/plymouth-populate-initrd \
|
||||||
|| [ ! -x ${PKGLIBDIR}/plymouth-populate-initrd ]; then
|
|| [ ! -x $dracutsysrootdir${PKGLIBDIR}/plymouth-populate-initrd ]; then
|
||||||
. "$moddir"/plymouth-populate-initrd.sh
|
. "$moddir"/plymouth-populate-initrd.sh
|
||||||
else
|
else
|
||||||
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
|
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
|
||||||
${PKGLIBDIR}/plymouth-populate-initrd -t "$initdir"
|
$dracutsysrootdir${PKGLIBDIR}/plymouth-populate-initrd -t "$initdir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
|
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
|
||||||
|
|
|
@ -17,25 +17,25 @@ if [[ $hostonly ]]; then
|
||||||
"/usr/share/plymouth/themes/details/details.plymouth" \
|
"/usr/share/plymouth/themes/details/details.plymouth" \
|
||||||
"/usr/share/plymouth/themes/text/text.plymouth" \
|
"/usr/share/plymouth/themes/text/text.plymouth" \
|
||||||
|
|
||||||
if [[ -d /usr/share/plymouth/themes/${PLYMOUTH_THEME} ]]; then
|
if [[ -d $dracutsysrootdir/usr/share/plymouth/themes/${PLYMOUTH_THEME} ]]; then
|
||||||
for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/* ; do
|
for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/* ; do
|
||||||
[[ -f "$x" ]] || break
|
[[ -f "$dracutsysrootdir$x" ]] || break
|
||||||
inst $x
|
inst $x
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -L /usr/share/plymouth/themes/default.plymouth ]; then
|
if [ -L $dracutsysrootdir/usr/share/plymouth/themes/default.plymouth ]; then
|
||||||
inst /usr/share/plymouth/themes/default.plymouth
|
inst /usr/share/plymouth/themes/default.plymouth
|
||||||
# Install plugin for this theme
|
# Install plugin for this theme
|
||||||
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c || [ -n "$b" ]; do echo $b; done;)
|
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" $dracutsysrootdir/usr/share/plymouth/themes/default.plymouth | while read a b c || [ -n "$b" ]; do echo $b; done;)
|
||||||
inst_libdir_file "plymouth/${PLYMOUTH_PLUGIN}.so"
|
inst_libdir_file "plymouth/${PLYMOUTH_PLUGIN}.so"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
for x in /usr/share/plymouth/themes/{text,details}/* ; do
|
for x in $dracutsysrootdir/usr/share/plymouth/themes/{text,details}/* ; do
|
||||||
[[ -f "$x" ]] || continue
|
[[ -f "$x" ]] || continue
|
||||||
THEME_DIR=$(dirname "$x")
|
THEME_DIR=$(dirname "${x#$dracutsysrootdir}")
|
||||||
mkdir -m 0755 -p "${initdir}/$THEME_DIR"
|
mkdir -m 0755 -p "${initdir}/$THEME_DIR"
|
||||||
inst_multiple "$x"
|
inst_multiple "${x#$dracutsysrootdir}"
|
||||||
done
|
done
|
||||||
(
|
(
|
||||||
cd ${initdir}/usr/share/plymouth/themes;
|
cd ${initdir}/usr/share/plymouth/themes;
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
check() {
|
check() {
|
||||||
arch=$(uname -m)
|
arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
||||||
return 255
|
return 255
|
||||||
}
|
}
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
depends() {
|
depends() {
|
||||||
arch=$(uname -m)
|
arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
||||||
echo znet zfcp dasd dasd_mod
|
echo znet zfcp dasd dasd_mod
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# called by dracut
|
# called by dracut
|
||||||
check() {
|
check() {
|
||||||
# do not add this module by default
|
# do not add this module by default
|
||||||
local arch=$(uname -m)
|
local arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ install() {
|
||||||
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
|
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $hostonly ]] && [[ -f /etc/crypttab ]]; then
|
if [[ $hostonly ]] && [[ -f $dracutsysrootdir/etc/crypttab ]]; then
|
||||||
# filter /etc/crypttab for the devices we need
|
# filter /etc/crypttab for the devices we need
|
||||||
while read _mapper _dev _luksfile _luksoptions || [ -n "$_mapper" ]; do
|
while read _mapper _dev _luksfile _luksoptions || [ -n "$_mapper" ]; do
|
||||||
[[ $_mapper = \#* ]] && continue
|
[[ $_mapper = \#* ]] && continue
|
||||||
|
@ -113,7 +113,7 @@ install() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
done < /etc/crypttab > $initdir/etc/crypttab
|
done < $dracutsysrootdir/etc/crypttab > $initdir/etc/crypttab
|
||||||
mark_hostonly /etc/crypttab
|
mark_hostonly /etc/crypttab
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ installkernel() {
|
||||||
virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
|
virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
|
||||||
"=drivers/pcmcia" =ide nvme vmd nfit
|
"=drivers/pcmcia" =ide nvme vmd nfit
|
||||||
|
|
||||||
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
|
if [[ "${DRACUT_ARCH:-$(uname -m)}" == arm* || "${DRACUT_ARCH:-$(uname -m)}" == aarch64 ]]; then
|
||||||
# arm/aarch64 specific modules
|
# arm/aarch64 specific modules
|
||||||
_blockfuncs+='|dw_mc_probe|dw_mci_pltfm_register'
|
_blockfuncs+='|dw_mc_probe|dw_mci_pltfm_register'
|
||||||
instmods \
|
instmods \
|
||||||
|
|
|
@ -13,7 +13,7 @@ depends() {
|
||||||
# called by dracut
|
# called by dracut
|
||||||
installkernel() {
|
installkernel() {
|
||||||
# Include wired net drivers, excluding wireless
|
# Include wired net drivers, excluding wireless
|
||||||
local _arch=$(uname -m)
|
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open'
|
local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open'
|
||||||
local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
|
local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ install() {
|
||||||
inst_rules "$moddir/64-lvm.rules"
|
inst_rules "$moddir/64-lvm.rules"
|
||||||
|
|
||||||
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
|
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
|
||||||
if [ -f /etc/lvm/lvm.conf ]; then
|
if [ -f $dracutsysrootdir/etc/lvm/lvm.conf ]; then
|
||||||
inst_simple -H /etc/lvm/lvm.conf
|
inst_simple -H /etc/lvm/lvm.conf
|
||||||
# FIXME: near-term hack to establish read-only locking;
|
# FIXME: near-term hack to establish read-only locking;
|
||||||
# use command-line lvm.conf editor once it is available
|
# use command-line lvm.conf editor once it is available
|
||||||
|
@ -70,7 +70,7 @@ install() {
|
||||||
|
|
||||||
export LVM_SUPPRESS_FD_WARNINGS=1
|
export LVM_SUPPRESS_FD_WARNINGS=1
|
||||||
# Also install any files needed for LVM system id support.
|
# Also install any files needed for LVM system id support.
|
||||||
if [ -f /etc/lvm/lvmlocal.conf ]; then
|
if [ -f $dracutsysrootdir/etc/lvm/lvmlocal.conf ]; then
|
||||||
inst_simple -H /etc/lvm/lvmlocal.conf
|
inst_simple -H /etc/lvm/lvmlocal.conf
|
||||||
fi
|
fi
|
||||||
eval $(lvm dumpconfig global/system_id_source &>/dev/null)
|
eval $(lvm dumpconfig global/system_id_source &>/dev/null)
|
||||||
|
|
|
@ -104,16 +104,16 @@ install() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
|
if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
|
||||||
if [ -f /etc/mdadm.conf ]; then
|
if [ -f $dracutsysrootdir/etc/mdadm.conf ]; then
|
||||||
inst -H /etc/mdadm.conf
|
inst -H /etc/mdadm.conf
|
||||||
else
|
else
|
||||||
[ -f /etc/mdadm/mdadm.conf ] && inst -H /etc/mdadm/mdadm.conf /etc/mdadm.conf
|
[ -f $dracutsysrootdir/etc/mdadm/mdadm.conf ] && inst -H /etc/mdadm/mdadm.conf /etc/mdadm.conf
|
||||||
fi
|
fi
|
||||||
if [ -d /etc/mdadm.conf.d ]; then
|
if [ -d $dracutsysrootdir/etc/mdadm.conf.d ]; then
|
||||||
local f
|
local f
|
||||||
inst_dir /etc/mdadm.conf.d
|
inst_dir /etc/mdadm.conf.d
|
||||||
for f in /etc/mdadm.conf.d/*.conf; do
|
for f in /etc/mdadm.conf.d/*.conf; do
|
||||||
[ -f "$f" ] || continue
|
[ -f "$dracutsysrootdir$f" ] || continue
|
||||||
inst -H "$f"
|
inst -H "$f"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -127,13 +127,13 @@ install() {
|
||||||
inst_script "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
|
inst_script "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
|
||||||
inst_script "$moddir/mdraid_start.sh" /sbin/mdraid_start
|
inst_script "$moddir/mdraid_start.sh" /sbin/mdraid_start
|
||||||
if dracut_module_included "systemd"; then
|
if dracut_module_included "systemd"; then
|
||||||
if [ -e $systemdsystemunitdir/mdmon@.service ]; then
|
if [ -e $dracutsysrootdir$systemdsystemunitdir/mdmon@.service ]; then
|
||||||
inst_simple $systemdsystemunitdir/mdmon@.service
|
inst_simple $systemdsystemunitdir/mdmon@.service
|
||||||
fi
|
fi
|
||||||
if [ -e $systemdsystemunitdir/mdadm-last-resort@.service ]; then
|
if [ -e $dracutsysrootdir$systemdsystemunitdir/mdadm-last-resort@.service ]; then
|
||||||
inst_simple $systemdsystemunitdir/mdadm-last-resort@.service
|
inst_simple $systemdsystemunitdir/mdadm-last-resort@.service
|
||||||
fi
|
fi
|
||||||
if [ -e $systemdsystemunitdir/mdadm-last-resort@.timer ]; then
|
if [ -e $dracutsysrootdir$systemdsystemunitdir/mdadm-last-resort@.timer ]; then
|
||||||
inst_simple $systemdsystemunitdir/mdadm-last-resort@.timer
|
inst_simple $systemdsystemunitdir/mdadm-last-resort@.timer
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -52,7 +52,7 @@ cmdline() {
|
||||||
# called by dracut
|
# called by dracut
|
||||||
installkernel() {
|
installkernel() {
|
||||||
local _ret
|
local _ret
|
||||||
local _arch=$(uname -m)
|
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
local _funcs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target'
|
local _funcs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target'
|
||||||
local _s390
|
local _s390
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ install() {
|
||||||
inst_multiple gpg-agent
|
inst_multiple gpg-agent
|
||||||
inst_multiple gpg-connect-agent
|
inst_multiple gpg-connect-agent
|
||||||
inst_multiple /usr/libexec/scdaemon
|
inst_multiple /usr/libexec/scdaemon
|
||||||
cp "$(sc_public_key)" "${initdir}/root/"
|
cp "$dracutsysrootdir$(sc_public_key)" "${initdir}/root/"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ sc_supported() {
|
||||||
require_binaries gpg-agent &&
|
require_binaries gpg-agent &&
|
||||||
require_binaries gpg-connect-agent &&
|
require_binaries gpg-connect-agent &&
|
||||||
require_binaries /usr/libexec/scdaemon &&
|
require_binaries /usr/libexec/scdaemon &&
|
||||||
(ldd /usr/libexec/scdaemon | grep libusb > /dev/null); then
|
($DRACUT_LDD $dracutsysrootdir/usr/libexec/scdaemon | grep libusb > /dev/null); then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
|
@ -54,7 +54,7 @@ sc_supported() {
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_requested() {
|
sc_requested() {
|
||||||
if [ -f "$(sc_public_key)" ]; then
|
if [ -f "$dracutsysrootdir$(sc_public_key)" ]; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
check() {
|
check() {
|
||||||
local _arch=$(uname -m)
|
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
# Only for systems on s390 using indirect booting via userland grub
|
# Only for systems on s390 using indirect booting via userland grub
|
||||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||||
# /boot/zipl contains a first stage kernel used to launch grub in initrd
|
# /boot/zipl contains a first stage kernel used to launch grub in initrd
|
||||||
|
|
|
@ -41,7 +41,7 @@ install() {
|
||||||
|
|
||||||
inst_libdir_file 'libcap-ng.so*'
|
inst_libdir_file 'libcap-ng.so*'
|
||||||
|
|
||||||
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
|
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' $dracutsysrootdir/etc/nsswitch.conf \
|
||||||
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
|
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
|
||||||
_nsslibs=${_nsslibs#|}
|
_nsslibs=${_nsslibs#|}
|
||||||
_nsslibs=${_nsslibs%|}
|
_nsslibs=${_nsslibs%|}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
check() {
|
check() {
|
||||||
local _arch=$(uname -m)
|
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||||
require_binaries normalize_dasd_arg || return 1
|
require_binaries normalize_dasd_arg || return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
check() {
|
check() {
|
||||||
local _arch=$(uname -m)
|
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||||
require_binaries grep sed seq
|
require_binaries grep sed seq
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ cmdline() {
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
check() {
|
check() {
|
||||||
local _arch=$(uname -m)
|
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
local found=0
|
local found=0
|
||||||
local bdev
|
local bdev
|
||||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
check() {
|
check() {
|
||||||
local _arch=$(uname -m)
|
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,6 @@ install() {
|
||||||
tcpdump cp dd less hostname mkdir systemd-analyze \
|
tcpdump cp dd less hostname mkdir systemd-analyze \
|
||||||
fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.f2fs fsck.vfat e2fsck
|
fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.f2fs fsck.vfat e2fsck
|
||||||
|
|
||||||
grep '^tcpdump:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
grep '^tcpdump:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ cmdline() {
|
||||||
# called by dracut
|
# called by dracut
|
||||||
install() {
|
install() {
|
||||||
inst_multiple ip dcbtool fipvlan lldpad readlink lldptool fcoemon fcoeadm
|
inst_multiple ip dcbtool fipvlan lldpad readlink lldptool fcoemon fcoeadm
|
||||||
if [ -e "/etc/hba.conf" ]; then
|
if [ -e "$dracutsysrootdir/etc/hba.conf" ]; then
|
||||||
inst_libdir_file 'libhbalinux.so*'
|
inst_libdir_file 'libhbalinux.so*'
|
||||||
inst_simple "/etc/hba.conf"
|
inst_simple "/etc/hba.conf"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
check() {
|
check() {
|
||||||
test -f /etc/fstab.sys || [[ -n $add_fstab || -n $fstab_lines ]]
|
test -f $dracutsysrootdir/etc/fstab.sys || [[ -n $add_fstab || -n $fstab_lines ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
|
@ -12,6 +12,6 @@ depends() {
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
install() {
|
install() {
|
||||||
[ -f /etc/fstab.sys ] && inst_simple /etc/fstab.sys
|
[ -f $dracutsysrootdir/etc/fstab.sys ] && inst_simple /etc/fstab.sys
|
||||||
inst_hook pre-pivot 00 "$moddir/mount-sys.sh"
|
inst_hook pre-pivot 00 "$moddir/mount-sys.sh"
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ depends() {
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
installkernel() {
|
installkernel() {
|
||||||
local _arch=$(uname -m)
|
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
local _funcs='iscsi_register_transport'
|
local _funcs='iscsi_register_transport'
|
||||||
|
|
||||||
instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi qedi
|
instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi qedi
|
||||||
|
|
|
@ -86,7 +86,7 @@ install() {
|
||||||
[[ $_netconf ]] && printf "%s\n" "$_netconf" >> "${initdir}/etc/cmdline.d/95nfs.conf"
|
[[ $_netconf ]] && printf "%s\n" "$_netconf" >> "${initdir}/etc/cmdline.d/95nfs.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /lib/modprobe.d/nfs.conf ]; then
|
if [ -f $dracutsysrootdir/lib/modprobe.d/nfs.conf ]; then
|
||||||
inst_multiple /lib/modprobe.d/nfs.conf
|
inst_multiple /lib/modprobe.d/nfs.conf
|
||||||
else
|
else
|
||||||
[ -d $initdir/etc/modprobe.d/ ] || mkdir $initdir/etc/modprobe.d
|
[ -d $initdir/etc/modprobe.d/ ] || mkdir $initdir/etc/modprobe.d
|
||||||
|
@ -95,7 +95,7 @@ install() {
|
||||||
|
|
||||||
inst_libdir_file 'libnfsidmap_nsswitch.so*' 'libnfsidmap/*.so' 'libnfsidmap*.so*'
|
inst_libdir_file 'libnfsidmap_nsswitch.so*' 'libnfsidmap/*.so' 'libnfsidmap*.so*'
|
||||||
|
|
||||||
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
|
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' $dracutsysrootdir/etc/nsswitch.conf \
|
||||||
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
|
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
|
||||||
_nsslibs=${_nsslibs#|}
|
_nsslibs=${_nsslibs#|}
|
||||||
_nsslibs=${_nsslibs%|}
|
_nsslibs=${_nsslibs%|}
|
||||||
|
@ -113,13 +113,13 @@ install() {
|
||||||
|
|
||||||
# Rather than copy the passwd file in, just set a user for rpcbind
|
# Rather than copy the passwd file in, just set a user for rpcbind
|
||||||
# We'll save the state and restart the daemon from the root anyway
|
# We'll save the state and restart the daemon from the root anyway
|
||||||
grep -E '^nfsnobody:|^rpc:|^rpcuser:' /etc/passwd >> "$initdir/etc/passwd"
|
grep -E '^nfsnobody:|^rpc:|^rpcuser:' $dracutsysrootdir/etc/passwd >> "$initdir/etc/passwd"
|
||||||
grep -E '^nogroup:|^rpc:|^nobody:' /etc/group >> "$initdir/etc/group"
|
grep -E '^nogroup:|^rpc:|^nobody:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||||
|
|
||||||
# rpc user needs to be able to write to this directory to save the warmstart
|
# rpc user needs to be able to write to this directory to save the warmstart
|
||||||
# file
|
# file
|
||||||
chmod 770 "$initdir/var/lib/rpcbind"
|
chmod 770 "$initdir/var/lib/rpcbind"
|
||||||
grep -q '^rpc:' /etc/passwd \
|
grep -q '^rpc:' $dracutsysrootdir/etc/passwd \
|
||||||
&& grep -q '^rpc:' /etc/group
|
&& grep -q '^rpc:' $dracutsysrootdir/etc/group
|
||||||
dracut_need_initqueue
|
dracut_need_initqueue
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
check() {
|
check() {
|
||||||
local _arch=$(uname -m)
|
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
local _online=0
|
local _online=0
|
||||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||||
require_binaries /usr/lib/udev/collect || return 1
|
require_binaries /usr/lib/udev/collect || return 1
|
||||||
|
|
|
@ -34,7 +34,7 @@ install() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if systemd is included and has the hibernate-resume tool, use it and nothing else
|
# if systemd is included and has the hibernate-resume tool, use it and nothing else
|
||||||
if dracut_module_included "systemd" && [[ -x $systemdutildir/systemd-hibernate-resume ]]; then
|
if dracut_module_included "systemd" && [[ -x $dracutsysrootdir$systemdutildir/systemd-hibernate-resume ]]; then
|
||||||
inst_multiple -o \
|
inst_multiple -o \
|
||||||
$systemdutildir/system-generators/systemd-hibernate-resume-generator \
|
$systemdutildir/system-generators/systemd-hibernate-resume-generator \
|
||||||
$systemdsystemunitdir/systemd-hibernate-resume@.service \
|
$systemdsystemunitdir/systemd-hibernate-resume@.service \
|
||||||
|
@ -45,9 +45,9 @@ install() {
|
||||||
# Optional uswsusp support
|
# Optional uswsusp support
|
||||||
for _bin in /usr/sbin/resume /usr/lib/suspend/resume /usr/lib/uswsusp/resume
|
for _bin in /usr/sbin/resume /usr/lib/suspend/resume /usr/lib/uswsusp/resume
|
||||||
do
|
do
|
||||||
[[ -x "${_bin}" ]] && {
|
[[ -x "$dracutsysrootdir${_bin}" ]] && {
|
||||||
inst "${_bin}" /usr/sbin/resume
|
inst "${_bin}" /usr/sbin/resume
|
||||||
[[ $hostonly ]] && [[ -f /etc/suspend.conf ]] && inst -H /etc/suspend.conf
|
[[ $hostonly ]] && [[ -f $dracutsysrootdir/etc/suspend.conf ]] && inst -H /etc/suspend.conf
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
|
|
|
@ -10,7 +10,7 @@ check() {
|
||||||
require_binaries ssh scp || return 1
|
require_binaries ssh scp || return 1
|
||||||
|
|
||||||
if [[ $sshkey ]]; then
|
if [[ $sshkey ]]; then
|
||||||
[ ! -f $sshkey ] && {
|
[ ! -f $dracutsysrootdir$sshkey ] && {
|
||||||
derror "ssh key: $sshkey is not found!"
|
derror "ssh key: $sshkey is not found!"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ depends() {
|
||||||
|
|
||||||
inst_sshenv()
|
inst_sshenv()
|
||||||
{
|
{
|
||||||
if [ -d /root/.ssh ]; then
|
if [ -d $dracutsysrootdir/root/.ssh ]; then
|
||||||
inst_dir /root/.ssh
|
inst_dir /root/.ssh
|
||||||
chmod 700 ${initdir}/root/.ssh
|
chmod 700 ${initdir}/root/.ssh
|
||||||
fi
|
fi
|
||||||
|
@ -35,13 +35,13 @@ inst_sshenv()
|
||||||
# Copy over ssh key and knowhosts if needed
|
# Copy over ssh key and knowhosts if needed
|
||||||
[[ $sshkey ]] && {
|
[[ $sshkey ]] && {
|
||||||
inst_simple $sshkey
|
inst_simple $sshkey
|
||||||
[[ -f /root/.ssh/known_hosts ]] && inst_simple /root/.ssh/known_hosts
|
[[ -f $dracutsysrootdir/root/.ssh/known_hosts ]] && inst_simple /root/.ssh/known_hosts
|
||||||
[[ -f /etc/ssh/ssh_known_hosts ]] && inst_simple /etc/ssh/ssh_known_hosts
|
[[ -f $dracutsysrootdir/etc/ssh/ssh_known_hosts ]] && inst_simple /etc/ssh/ssh_known_hosts
|
||||||
}
|
}
|
||||||
|
|
||||||
# Copy over root and system-wide ssh configs.
|
# Copy over root and system-wide ssh configs.
|
||||||
[[ -f /root/.ssh/config ]] && inst_simple /root/.ssh/config
|
[[ -f $dracutsysrootdir/root/.ssh/config ]] && inst_simple /root/.ssh/config
|
||||||
if [[ -f /etc/ssh/ssh_config ]]; then
|
if [[ -f $dracutsysrootdir/etc/ssh/ssh_config ]]; then
|
||||||
inst_simple /etc/ssh/ssh_config
|
inst_simple /etc/ssh/ssh_config
|
||||||
sed -i -e 's/\(^[[:space:]]*\)ProxyCommand/\1# ProxyCommand/' ${initdir}/etc/ssh/ssh_config
|
sed -i -e 's/\(^[[:space:]]*\)ProxyCommand/\1# ProxyCommand/' ${initdir}/etc/ssh/ssh_config
|
||||||
while read key val || [ -n "$key" ]; do
|
while read key val || [ -n "$key" ]; do
|
||||||
|
@ -55,7 +55,7 @@ inst_sshenv()
|
||||||
fi
|
fi
|
||||||
inst_simple "$val"
|
inst_simple "$val"
|
||||||
fi
|
fi
|
||||||
done < /etc/ssh/ssh_config
|
done < $dracutsysrootdir/etc/ssh/ssh_config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
@ -68,7 +68,7 @@ install() {
|
||||||
inst_multiple ssh scp
|
inst_multiple ssh scp
|
||||||
inst_sshenv
|
inst_sshenv
|
||||||
|
|
||||||
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
|
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' $dracutsysrootdir/etc/nsswitch.conf \
|
||||||
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
|
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
|
||||||
_nsslibs=${_nsslibs#|}
|
_nsslibs=${_nsslibs#|}
|
||||||
_nsslibs=${_nsslibs%|}
|
_nsslibs=${_nsslibs%|}
|
||||||
|
|
|
@ -5,13 +5,13 @@ install() {
|
||||||
local _terminfodir
|
local _terminfodir
|
||||||
# terminfo bits make things work better if you fall into interactive mode
|
# terminfo bits make things work better if you fall into interactive mode
|
||||||
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
|
||||||
[ -f ${_terminfodir}/l/linux ] && break
|
[ -f $dracutsysrootdir${_terminfodir}/l/linux ] && break
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -d ${_terminfodir} ]; then
|
if [ -d $dracutsysrootdir${_terminfodir} ]; then
|
||||||
for i in "l/linux" "v/vt100" "v/vt102" "v/vt220"; do
|
for i in "l/linux" "v/vt100" "v/vt102" "v/vt220"; do
|
||||||
inst_dir "$_terminfodir/${i%/*}"
|
inst_dir "$_terminfodir/${i%/*}"
|
||||||
$DRACUT_CP -L -t "${initdir}/${_terminfodir}/${i%/*}" "$_terminfodir/$i"
|
$DRACUT_CP -L -t "${initdir}/${_terminfodir}/${i%/*}" "$dracutsysrootdir$_terminfodir/$i"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ install() {
|
||||||
|
|
||||||
[ -d ${initdir}/$systemdutildir ] || mkdir -p ${initdir}/$systemdutildir
|
[ -d ${initdir}/$systemdutildir ] || mkdir -p ${initdir}/$systemdutildir
|
||||||
for _i in ${systemdutildir}/systemd-udevd ${udevdir}/udevd /sbin/udevd; do
|
for _i in ${systemdutildir}/systemd-udevd ${udevdir}/udevd /sbin/udevd; do
|
||||||
[ -x "$_i" ] || continue
|
[ -x "$dracutsysrootdir$_i" ] || continue
|
||||||
inst "$_i"
|
inst "$_i"
|
||||||
|
|
||||||
if ! [[ -f ${initdir}${systemdutildir}/systemd-udevd ]]; then
|
if ! [[ -f ${initdir}${systemdutildir}/systemd-udevd ]]; then
|
||||||
|
@ -64,7 +64,7 @@ install() {
|
||||||
{
|
{
|
||||||
for i in cdrom tape dialout floppy; do
|
for i in cdrom tape dialout floppy; do
|
||||||
if ! grep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then
|
if ! grep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then
|
||||||
if ! grep "^$i:" /etc/group 2>/dev/null; then
|
if ! grep "^$i:" $dracutsysrootdir/etc/group 2>/dev/null; then
|
||||||
case $i in
|
case $i in
|
||||||
cdrom) echo "$i:x:11:";;
|
cdrom) echo "$i:x:11:";;
|
||||||
dialout) echo "$i:x:18:";;
|
dialout) echo "$i:x:18:";;
|
||||||
|
@ -96,7 +96,7 @@ install() {
|
||||||
|
|
||||||
inst_multiple -o /etc/pcmcia/config.opts
|
inst_multiple -o /etc/pcmcia/config.opts
|
||||||
|
|
||||||
[ -f /etc/arch-release ] && \
|
[ -f $dracutsysrootdir/etc/arch-release ] && \
|
||||||
inst_script "$moddir/load-modules.sh" /lib/udev/load-modules.sh
|
inst_script "$moddir/load-modules.sh" /lib/udev/load-modules.sh
|
||||||
|
|
||||||
inst_libdir_file "libnss_files*"
|
inst_libdir_file "libnss_files*"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
check() {
|
check() {
|
||||||
arch=$(uname -m)
|
arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
||||||
|
|
||||||
require_binaries zfcp_cio_free grep sed seq || return 1
|
require_binaries zfcp_cio_free grep sed seq || return 1
|
||||||
|
|
|
@ -38,7 +38,7 @@ cmdline() {
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
check() {
|
check() {
|
||||||
local _arch=$(uname -m)
|
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
local _ccw
|
local _ccw
|
||||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||||
require_binaries /usr/lib/udev/collect || return 1
|
require_binaries /usr/lib/udev/collect || return 1
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# called by dracut
|
# called by dracut
|
||||||
check() {
|
check() {
|
||||||
arch=$(uname -m)
|
arch=${DRACUT_ARCH:-$(uname -m)}
|
||||||
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
||||||
|
|
||||||
require_binaries znet_cio_free grep sed seq readlink || return 1
|
require_binaries znet_cio_free grep sed seq readlink || return 1
|
||||||
|
|
|
@ -16,8 +16,8 @@ install() {
|
||||||
local _d
|
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 \
|
||||||
inst $(command -v modprobe) /sbin/modprobe
|
modprobe
|
||||||
|
|
||||||
inst_multiple -o findmnt less kmod
|
inst_multiple -o findmnt less kmod
|
||||||
|
|
||||||
|
@ -30,9 +30,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:' /etc/passwd >> "$initdir/etc/passwd"
|
grep '^nobody:' $dracutsysrootdir/etc/passwd >> "$initdir/etc/passwd"
|
||||||
|
|
||||||
[[ $hostonly ]] && grep '^root:' /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"
|
||||||
|
@ -72,9 +72,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 /etc/os-release ]; then
|
if [ -e $dracutsysrootdir/etc/os-release ]; then
|
||||||
. /etc/os-release
|
. $dracutsysrootdir/etc/os-release
|
||||||
grep -hE -ve '^VERSION=' -ve '^PRETTY_NAME' /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
|
||||||
|
|
|
@ -81,7 +81,7 @@ install() {
|
||||||
_helpers="$fscks"
|
_helpers="$fscks"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$_helpers" == *e2fsck* ]] && [ -e /etc/e2fsck.conf ]; then
|
if [[ "$_helpers" == *e2fsck* ]] && [ -e $dracutsysrootdir/etc/e2fsck.conf ]; then
|
||||||
inst_simple /etc/e2fsck.conf
|
inst_simple /etc/e2fsck.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue