X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fgen_initramfs_list.sh;h=5f3415f28736a386d84b77ae4fa9e2f179958221;hb=b726e923ea4d216027e466aa602d914e4b4a63af;hp=43f75d6e4d9629a963806d6b4108d2dbd7164d01;hpb=9cdd79c9b99873d600d397fda012fc3f57cc2776;p=linux-2.6-omap-h63xx.git diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index 43f75d6e4d9..5f3415f2873 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh @@ -19,11 +19,11 @@ $0 [-o ] [-u ] [-g ] {-d | } ... -o Create gzipped initramfs file named using gen_init_cpio and gzip -u User ID to map to user ID 0 (root). - is only meaningful if - is a directory. + is only meaningful if is a + directory. "squash" forces all files to uid 0. -g Group ID to map to group ID 0 (root). - is only meaningful if - is a directory. + is only meaningful if is a + directory. "squash" forces all files to gid 0. File list or directory for cpio archive. If is a .cpio file it will be used as direct input to initramfs. @@ -113,8 +113,8 @@ parse() { local gid="$4" local ftype=$(filetype "${location}") # remap uid/gid to 0 if necessary - [ "$uid" -eq "$root_uid" ] && uid=0 - [ "$gid" -eq "$root_gid" ] && gid=0 + [ "$root_uid" = "squash" ] && uid=0 || [ "$uid" -eq "$root_uid" ] && uid=0 + [ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0 local str="${mode} ${uid} ${gid}" [ "${ftype}" == "invalid" ] && return 0 @@ -135,7 +135,7 @@ parse() { str="${ftype} ${name} ${str} ${dev} ${maj} ${min}" ;; "slink") - local target=`field 11 $(LC_ALL=C ls -l "${location}")` + local target=`readlink "${location}"` str="${ftype} ${name} ${target} ${str}" ;; *) @@ -171,7 +171,7 @@ dir_filelist() { ${dep_list}header "$1" srcdir=$(echo "$1" | sed -e 's://*:/:g') - dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" 2>/dev/null) + dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n") # If $dirlist is only one line, then the directory is empty if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then @@ -191,9 +191,10 @@ input_file() { source="$1" if [ -f "$1" ]; then ${dep_list}header "$1" - is_cpio="$(echo "$1" | sed 's/^.*\.cpio/cpio/')" + is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\?/cpio/')" if [ $2 -eq 0 -a ${is_cpio} == "cpio" ]; then cpio_file=$1 + echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed" [ ! -z ${dep_list} ] && echo "$1" return 0 fi @@ -223,6 +224,7 @@ cpio_file= cpio_list= output="/dev/stdout" output_file="" +is_cpio_compressed= arg="$1" case "$arg" in @@ -282,7 +284,11 @@ if [ ! -z ${output_file} ]; then cpio_tfile=${cpio_file} fi rm ${cpio_list} - cat ${cpio_tfile} | gzip -f -9 - > ${output_file} + if [ "${is_cpio_compressed}" = "compressed" ]; then + cat ${cpio_tfile} > ${output_file} + else + cat ${cpio_tfile} | gzip -f -9 - > ${output_file} + fi [ -z ${cpio_file} ] && rm ${cpio_tfile} fi exit 0