scripts/gen_initramfs_list.sh: teach INITRAMFS_ROOT_UID and INITRAMFS_ROOT_GID that...
authorRob Landley <rob@landley.net>
Thu, 6 Jul 2017 22:35:43 +0000 (15:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 6 Jul 2017 23:24:29 +0000 (16:24 -0700)
Teach INITRAMFS_ROOT_UID and INITRAMFS_ROOT_GID that -1 means "current user".

Link: http://lkml.kernel.org/r/2df3a9fb-4378-fa16-679d-99e788926c05@landley.net
Signed-off-by: Rob Landley <rob@landley.net>
Cc: Michal Marek <mmarek@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/gen_initramfs_list.sh
usr/Kconfig

index 0055b07b03b68cafd0bc3c400ee23b686632efbf..cb470fdee7337c52e2c0d097a6b09e86d9d4a349 100755 (executable)
@@ -271,10 +271,12 @@ while [ $# -gt 0 ]; do
        case "$arg" in
                "-u")   # map $1 to uid=0 (root)
                        root_uid="$1"
+                       [ "$root_uid" = "-1" ] && root_uid=$(id -u || echo 0)
                        shift
                        ;;
                "-g")   # map $1 to gid=0 (root)
                        root_gid="$1"
+                       [ "$root_gid" = "-1" ] && root_gid=$(id -g || echo 0)
                        shift
                        ;;
                "-d")   # display default initramfs list
index ad0543e21760562d94bc0a44676700b1179c1787..1edb2e936559ee45ddeb2c9062c0ca65d47cf1f8 100644 (file)
@@ -36,10 +36,8 @@ config INITRAMFS_ROOT_UID
        depends on INITRAMFS_SOURCE!=""
        default "0"
        help
-         This setting is only meaningful if the INITRAMFS_SOURCE is
-         contains a directory.  Setting this user ID (UID) to something
-         other than "0" will cause all files owned by that UID to be
-         owned by user root in the initial ramdisk image.
+         If INITRAMFS_SOURCE points to a directory, files owned by this UID
+         (-1 = current user) will be owned by root in the resulting image.
 
          If you are not sure, leave it set to "0".
 
@@ -48,10 +46,8 @@ config INITRAMFS_ROOT_GID
        depends on INITRAMFS_SOURCE!=""
        default "0"
        help
-         This setting is only meaningful if the INITRAMFS_SOURCE is
-         contains a directory.  Setting this group ID (GID) to something
-         other than "0" will cause all files owned by that GID to be
-         owned by group root in the initial ramdisk image.
+         If INITRAMFS_SOURCE points to a directory, files owned by this GID
+         (-1 = current group) will be owned by root in the resulting image.
 
          If you are not sure, leave it set to "0".