2 # Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org>
3 # Released under the terms of the GNU GPL
5 # A script to generate newline separated entries (to stdout) from a directory's
6 # contents suitable for use as a cpio_list for gen_init_cpio.
8 # Arguements: $1 -- the source directory
10 # TODO: Add support for symlinks, sockets and pipes when gen_init_cpio
14 echo "Usage: $0 initramfs-source-dir"
18 srcdir=$(echo "$1" | sed -e 's://*:/:g')
20 if [ "$#" -gt 1 -o ! -d "${srcdir}" ]; then
27 if [ -f "${argv1}" ]; then
29 elif [ -d "${argv1}" ]; then
31 elif [ -b "${argv1}" -o -c "${argv1}" ]; then
41 local name="${location/${srcdir}//}"
45 local ftype=$(filetype "${location}")
46 local str="${mode} ${uid} ${gid}"
48 [ "${ftype}" == "invalid" ] && return 0
49 [ "${location}" == "${srcdir}" ] && return 0
53 str="${ftype} ${name} ${location} ${str}"
57 local maj=$(LC_ALL=C ls -l "${location}" | \
58 gawk '{sub(/,/, "", $5); print $5}')
59 local min=$(LC_ALL=C ls -l "${location}" | \
62 if [ -b "${location}" ]; then
67 str="${ftype} ${name} ${str} ${dev_type} ${maj} ${min}"
70 str="${ftype} ${name} ${str}"
79 find "${srcdir}" -printf "%p %m %U %G\n" | \