initial import
[patches.git] / linux-squash-initramfs-owners.patch
CommitLineData
5e993f12 1diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
2index 683eb12..684fb9c 100644
3--- a/scripts/gen_initramfs_list.sh
4+++ b/scripts/gen_initramfs_list.sh
5@@ -19,11 +19,11 @@ $0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ...
6 -o <file> Create gzipped initramfs file named <file> using
7 gen_init_cpio and gzip
8 -u <uid> User ID to map to user ID 0 (root).
9- <uid> is only meaningful if <cpio_source>
10- is a directory.
11+ <uid> is only meaningful if <cpio_source> is a
12+ directory. "squash" forces all files to uid 0.
13 -g <gid> Group ID to map to group ID 0 (root).
14- <gid> is only meaningful if <cpio_source>
15- is a directory.
16+ <gid> is only meaningful if <cpio_source> is a
17+ directory. "squash" forces all files to gid 0.
18 <cpio_source> File list or directory for cpio archive.
19 If <cpio_source> is a .cpio file it will be used
20 as direct input to initramfs.
21@@ -113,8 +113,8 @@ parse() {
22 local gid="$4"
23 local ftype=$(filetype "${location}")
24 # remap uid/gid to 0 if necessary
25- [ "$uid" -eq "$root_uid" ] && uid=0
26- [ "$gid" -eq "$root_gid" ] && gid=0
27+ [ "$root_uid" = "squash" ] && uid=0 || [ "$uid" -eq "$root_uid" ] && uid=0
28+ [ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0
29 local str="${mode} ${uid} ${gid}"
30
31 [ "${ftype}" == "invalid" ] && return 0