SVN: geninitrd/trunk/geninitrd
glen
glen at pld-linux.org
Thu Oct 25 16:15:34 CEST 2007
Author: glen
Date: Thu Oct 25 16:15:34 2007
New Revision: 8871
Modified:
geninitrd/trunk/geninitrd
Log:
- fix inst_exec() using inst()
Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd (original)
+++ geninitrd/trunk/geninitrd Thu Oct 25 16:15:34 2007
@@ -284,15 +284,25 @@
# it will operate recursively (copying directories)
# and will symlink destinations if source is symlink.
inst() {
- if [ "$#" -lt "2" ];then
- die 'Usage: inst <file> $MNTIMAGE<destination>'
+ if [ $# -lt 2 ]; then
+ die 'Usage: inst <file> [<file>] $MNTIMAGE<destination>'
fi
- debug "cp $1 $MNTIMAGE$2"
- cp -HR "$1" "$MNTIMAGE$2"
+
+ local src i=0 c=$(($# - 1))
+ while [ $i -lt $c ]; do
+ src="$src $1"
+ i=$((i + 1))
+ shift
+ done
+ local dest=$1
+ set -- $src
+
+ debug "cp $* $MNTIMAGE$dest"
+ cp -HR "$@" "$MNTIMAGE$dest"
}
inst_d() {
- if [ "$#" = "0" ];then
+ if [ $# = 0 ]; then
die 'Usage: inst_d $MNTIMAGE<destination> $MNTIMAGE<destination>'
fi
for dir in "$@"; do
@@ -302,6 +312,9 @@
# install executable and it's shared libraries
inst_exec() {
+ if [ $# -lt 2 ]; then
+ die 'Usage: inst_exec <file> [, <file>] $MNTIMAGE<destination>'
+ fi
local src i=0 c=$(($# - 1))
while [ $i -lt $c ]; do
src="$src $1"
@@ -313,11 +326,13 @@
inst "$@" $dest
- local lib libs=$(ldd "$@" | awk '/linux-gate\.so/{next} NF == 2 {print $1} /=/{print $3}' | sort -u)
+ local lib libdir libs=$(ldd "$@" | awk '/statically|linux-gate\.so/{next} NF == 2 {print $1} /=/{print $3}' | sort -u)
for lib in $libs; do
- local libdir=/$(echo "$lib" | cut -d/ -f2)/
- inst_d $libdir
- inst $lib $libdir
+ libdir=/$(echo "$lib" | cut -d/ -f2)/
+ if [ ! -f "$MNTIMAGE/$libdir/${lib##*/}" ]; then
+ inst_d $libdir
+ inst_exec $lib $libdir
+ fi
done
}
More information about the pld-cvs-commit
mailing list