Lines Matching +full:a +full:- +full:za +full:- +full:z

2 # Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org>
7 # Generate a cpio packed initramfs. It uses gen_init_cpio to generate
13 set -e
18 $0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ...
19 -o <file> Create compressed initramfs file named <file> using
21 -u <uid> User ID to map to user ID 0 (root).
22 <uid> is only meaningful if <cpio_source> is a
24 -g <gid> Group ID to map to group ID 0 (root).
25 <gid> is only meaningful if <cpio_source> is a
28 If <cpio_source> is a .cpio file it will be used
30 -d Output the default cpio list.
32 All options except -o and -l may be repeated and are interpreted
33 sequentially and immediately. -u and -g states are preserved across
34 <cpio_source> options so an explicit "-u 0 -g 0" is required
40 # $1 - field number; rest is argument string
51 cat <<-EOF >> ${output}
52 # This is a very simple, default initramfs
66 if [ -L "${argv1}" ]; then
68 elif [ -f "${argv1}" ]; then
70 elif [ -d "${argv1}" ]; then
72 elif [ -b "${argv1}" -o -c "${argv1}" ]; then
74 elif [ -p "${argv1}" ]; then
76 elif [ -S "${argv1}" ]; then
91 if [ -e "$1" ]; then
92 my_mtime=$(find "$1" -printf "%T@\n" | sort -r | head -n 1)
100 if [ -L "$1" ]; then
106 # for each file print a line in following format
113 name=$(echo "$name" | sed -e 's://*:/:g')
119 [ "$root_uid" = "squash" ] && uid=0 || [ "$uid" -eq "$root_uid" ] && uid=0
120 [ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0
131 local dev=`LC_ALL=C ls -l "${location}"`
136 [ -b "${location}" ] && dev="b" || dev="c"
156 printf "If the filename validly begins with '-', " >&2
172 # process one directory (incl sub-directories)
176 srcdir=$(echo "$1" | sed -e 's://*:/:g')
177 dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | LANG=C sort)
180 if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then
191 # if a directory is specified then add all files in given direcotry to fs
192 # if a regular file is specified assume it is in gen_initramfs format
195 if [ -f "$1" ]; then
198 if [ $2 -eq 0 -a ${is_cpio} = "cpio" ]; then
200 echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed"
201 [ ! -z ${dep_list} ] && echo "$1"
204 if [ -z ${dep_list} ]; then
215 elif [ -d "$1" ]; then
232 compr="gzip -n -9 -f"
236 "-l") # files included in initramfs - used by kbuild
241 "-o") # generate compressed cpio image named $1
244 cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)"
246 echo "$output_file" | grep -q "\.gz$" \
247 && [ -x "`which gzip 2> /dev/null`" ] \
248 && compr="gzip -n -9 -f"
249 echo "$output_file" | grep -q "\.bz2$" \
250 && [ -x "`which bzip2 2> /dev/null`" ] \
251 && compr="bzip2 -9 -f"
252 echo "$output_file" | grep -q "\.lzma$" \
253 && [ -x "`which lzma 2> /dev/null`" ] \
254 && compr="lzma -9 -f"
255 echo "$output_file" | grep -q "\.xz$" \
256 && [ -x "`which xz 2> /dev/null`" ] \
257 && compr="xz --check=crc32 --lzma2=dict=1MiB"
258 echo "$output_file" | grep -q "\.lzo$" \
259 && [ -x "`which lzop 2> /dev/null`" ] \
260 && compr="lzop -9 -f"
261 echo "$output_file" | grep -q "\.lz4$" \
262 && [ -x "`which lz4 2> /dev/null`" ] \
263 && compr="lz4 -l -9 -f"
264 echo "$output_file" | grep -q "\.cpio$" && compr="cat"
268 while [ $# -gt 0 ]; do
272 "-u") # map $1 to uid=0 (root)
274 [ "$root_uid" = "-1" ] && root_uid=$(id -u || echo 0)
277 "-g") # map $1 to gid=0 (root)
279 [ "$root_gid" = "-1" ] && root_gid=$(id -g || echo 0)
282 "-d") # display default initramfs list
286 "-h")
292 "-"*)
295 *) # input file/dir - process it
305 if [ ! -z ${output_file} ]; then
306 if [ -z ${cpio_file} ]; then
308 if test -n "$KBUILD_BUILD_TIMESTAMP"; then
309 timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)"
310 if test -n "$timestamp"; then
311 timestamp="-t $timestamp"
314 cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)"
323 (cat ${cpio_tfile} | ${compr} - > ${output_file}) \
324 || (rm -f ${output_file} ; false)
326 [ -z ${cpio_file} ] && rm ${cpio_tfile}