On Mon, Jun 6, 2011 at 5:30 PM, Dave Reisner <d@falconindy.com> wrote:
This is a departure from using gen_init_cpio, which proved to be a huge bottleneck in performance. Tests for existance change from being a call to grep, to a simple shell test.
In the process, we have to modify the behavior of the -s option, and we lose the -a option.
Signed-off-by: Dave Reisner <d@falconindy.com>
Ack. Comments inline. -t
@@ -93,28 +93,23 @@ add_full_dir ()
add_dir () { - #skip root directory and "." for relative directories... i.e. /foo/bar/./blah - if [ -n "${1}" -a "${1}" != "/" -a "${1}" != "." ]; then - if ! grep -q "dir ${1} " "${FILELIST}"; then - add_dir $(get_dirname "${1}") - msg " adding dir ${1}" - echo "dir ${1} 755 0 0" >> "${FILELIST}" - fi + if [[ ! -e "$TMPDIR/root/$1" ]]; then + msg " adding dir ${1}" + command install -dm755 "$TMPDIR/root/$1" fi }
-# what the hell does this do?
Maybe an replacement comment to explain?
add_symlink () { local fil dest dir - if [ -h ${1} ]; then + if [[ -h $1 ]]; then fil="${1##$BASEDIR}" dest="${2##$BASEDIR}" add_dir $(get_dirname "${dest}") add_dir $(get_dirname "${fil}") - if ! grep -q "slink ${fil} " "${FILELIST}"; then + if [[ ! -e "$TMPDIR/root/$dest" ]]; then msg " adding link ${fil} -> ${dest}" - echo "slink ${fil} ${dest} $(stat -c '%a' ${1}) 0 0" >> "${FILELIST}" + ln -s "$dest" "$TMPDIR/root/$fil" fi fi #fail quietly
@@ -49,7 +48,7 @@ usage () echo "${APPNAME}: usage" echo " -c CONFIG Use CONFIG file. default: /etc/mkinitcpio.conf" echo " -k KERNELVERSION Use KERNELVERSION. default: $(uname -r)" - echo " -s NAME Save filelist. default: no" + echo " -s Save build directory. default: no" echo " -b BASEDIR Use BASEDIR. default: /" echo " -g IMAGE Generate a cpio image as IMAGE. default: no" echo " -a NAME Append to an existing filelist. default: no"
This should be deleted too, no?