dracut: check for EUID instead of UID

master
Harald Hoyer 2017-01-18 11:04:36 +01:00
parent 076fcd1652
commit 647b521fc7
2 changed files with 5 additions and 5 deletions

View File

@ -19,7 +19,7 @@
# #
export LC_MESSAGES=C export LC_MESSAGES=C


if [[ "$UID" = "0" ]]; then if [[ "$EUID" = "0" ]]; then
export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,xattr,links -dfr" export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,xattr,links -dfr"
else else
export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr" export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr"

View File

@ -1388,7 +1388,7 @@ if [[ $kernel_only != yes ]]; then
for _d in $hookdirs; do for _d in $hookdirs; do
mkdir -m 0755 -p ${initdir}/lib/dracut/hooks/$_d mkdir -m 0755 -p ${initdir}/lib/dracut/hooks/$_d
done done
if [[ "$UID" = "0" ]]; then if [[ "$EUID" = "0" ]]; then
[ -c ${initdir}/dev/null ] || mknod ${initdir}/dev/null c 1 3 [ -c ${initdir}/dev/null ] || mknod ${initdir}/dev/null c 1 3
[ -c ${initdir}/dev/kmsg ] || mknod ${initdir}/dev/kmsg c 1 11 [ -c ${initdir}/dev/kmsg ] || mknod ${initdir}/dev/kmsg c 1 11
[ -c ${initdir}/dev/console ] || mknod ${initdir}/dev/console c 5 1 [ -c ${initdir}/dev/console ] || mknod ${initdir}/dev/console c 5 1
@ -1574,7 +1574,7 @@ if [[ $kernel_only != yes ]]; then
[[ -f $f ]] && inst_simple "$f" [[ -f $f ]] && inst_simple "$f"
done done
if ! ldconfig -r "$initdir"; then if ! ldconfig -r "$initdir"; then
if [[ $UID = 0 ]]; then if [[ $EUID = 0 ]]; then
derror "ldconfig exited ungracefully" derror "ldconfig exited ungracefully"
else else
derror "ldconfig might need uid=0 (root) for chroot()" derror "ldconfig might need uid=0 (root) for chroot()"
@ -1583,7 +1583,7 @@ if [[ $kernel_only != yes ]]; then
fi fi


PRELINK_BIN="$(command -v prelink)" PRELINK_BIN="$(command -v prelink)"
if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then if [[ $EUID = 0 ]] && [[ $PRELINK_BIN ]]; then
if [[ $DRACUT_FIPS_MODE ]]; then if [[ $DRACUT_FIPS_MODE ]]; then
dinfo "*** Installing prelink files ***" dinfo "*** Installing prelink files ***"
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
@ -1717,7 +1717,7 @@ if [[ $DRACUT_REPRODUCIBLE ]]; then
fi fi
fi fi


[[ "$UID" != 0 ]] && cpio_owner_root="-R 0:0" [[ "$EUID" != 0 ]] && cpio_owner_root="-R 0:0"


if [[ $create_early_cpio = yes ]]; then if [[ $create_early_cpio = yes ]]; then
echo 1 > "$early_cpio_dir/d/early_cpio" echo 1 > "$early_cpio_dir/d/early_cpio"