#!/bin/bash if test ! -d $1 { echo "usage: gen_initramfs_list.sh dirname" > !2 exit 1 } global LEN := $[echo $1 | wc -c] find $1 | while read i { global PERM := $[stat -c %a $i] global NAME := $[echo $i | cut -b $(LEN)-] test -z $NAME && continue if test -L $i { echo "slink $NAME $[readlink $i] $PERM 0 0" } elif test -f $i { echo "file $NAME $i $PERM 0 0" } elif test -d $i { echo "dir $NAME $PERM 0 0" } }