From 7a2398ccd5341e56172e23489ebaffde61273e38 Mon Sep 17 00:00:00 2001 From: Thayne Harbaugh Date: Fri, 7 Jan 2005 21:42:25 -0800 Subject: [PATCH] gen_init_cpio symlink, pipe and socket support This patch makes gen_init_cpio more complete by adding symlink, pipe and socket support. It updates scripts/gen_initramfs_list.sh to support the new types. The patch applies to the recent mm series that already have the updated gen_init_cpio and gen_initramfs_list.sh. From: William Lee Irwin III The rest of gen_init_cpio.c seems to cast the result of strlen() to handle this situation, so this patch follows suit while killing off size_t -related printk() warnings. Signed-off-by: William Irwin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/gen_initramfs_list.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index 2a697c37135e..79ccbd7cf27f 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh @@ -9,8 +9,6 @@ # # The output is suitable for gen_init_cpio as found in usr/Makefile. # -# TODO: Add support for symlinks, sockets and pipes when gen_init_cpio -# supports them. simple_initramfs() { cat <<-EOF @@ -25,12 +23,19 @@ simple_initramfs() { filetype() { local argv1="$1" - if [ -f "${argv1}" ]; then + # symlink test must come before file test + if [ -L "${argv1}" ]; then + echo "slink" + elif [ -f "${argv1}" ]; then echo "file" elif [ -d "${argv1}" ]; then echo "dir" elif [ -b "${argv1}" -o -c "${argv1}" ]; then echo "nod" + elif [ -p "${argv1}" ]; then + echo "pipe" + elif [ -S "${argv1}" ]; then + echo "sock" else echo "invalid" fi @@ -52,6 +57,8 @@ print_mtime() { parse() { local location="$1" local name="${location/${srcdir}//}" + # change '//' into '/' + name="${name//\/\///}" local mode="$2" local uid="$3" local gid="$4" @@ -79,6 +86,11 @@ parse() { fi str="${ftype} ${name} ${str} ${dev_type} ${maj} ${min}" ;; + "slink") + local target=$(LC_ALL=C ls -l "${location}" | \ + gawk '{print $11}') + str="${ftype} ${name} ${target} ${str}" + ;; *) str="${ftype} ${name} ${str}" ;; -- cgit v1.2.3