]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut: check for EUID instead of UID
authorHarald Hoyer <harald@redhat.com>
Wed, 18 Jan 2017 10:04:36 +0000 (11:04 +0100)
committerHarald Hoyer <harald@redhat.com>
Wed, 18 Jan 2017 10:04:36 +0000 (11:04 +0100)
dracut-init.sh
dracut.sh

index ac3dd82b6134af5f2b9bd0fe597ab832ded180ab..239fb68478f4e449fe9579324678fa0a843b759b 100644 (file)
@@ -19,7 +19,7 @@
 #
 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"
 else
     export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr"
index cd3dcfb267889ce5ca87e5a035a78af65ce6c2b9..a94401f67ff8223d75bcb0cecf9569c1b907adc7 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -1388,7 +1388,7 @@ if [[ $kernel_only != yes ]]; then
     for _d in $hookdirs; do
         mkdir -m 0755 -p ${initdir}/lib/dracut/hooks/$_d
     done
-    if [[ "$UID" = "0" ]]; then
+    if [[ "$EUID" = "0" ]]; then
         [ -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/console ] || mknod ${initdir}/dev/console c 5 1
@@ -1574,7 +1574,7 @@ if [[ $kernel_only != yes ]]; then
         [[ -f $f ]] && inst_simple "$f"
     done
     if ! ldconfig -r "$initdir"; then
-        if [[ $UID = 0 ]]; then
+        if [[ $EUID = 0 ]]; then
             derror "ldconfig exited ungracefully"
         else
             derror "ldconfig might need uid=0 (root) for chroot()"
@@ -1583,7 +1583,7 @@ if [[ $kernel_only != yes ]]; then
 fi
 
 PRELINK_BIN="$(command -v prelink)"
-if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
+if [[ $EUID = 0 ]] && [[ $PRELINK_BIN ]]; then
     if [[ $DRACUT_FIPS_MODE ]]; then
         dinfo "*** Installing prelink files ***"
         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
 
-[[ "$UID" != 0 ]] && cpio_owner_root="-R 0:0"
+[[ "$EUID" != 0 ]] && cpio_owner_root="-R 0:0"
 
 if [[ $create_early_cpio = yes ]]; then
     echo 1 > "$early_cpio_dir/d/early_cpio"