summaryrefslogtreecommitdiffstats
path: root/scripts/mk-images
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2009-04-07 10:51:24 -1000
committerDavid Cantrell <dcantrell@redhat.com>2009-04-08 09:11:42 -1000
commitcd333fa45091c36629f05f75233cdbcf44e26bf7 (patch)
treedea499d98cd734932fdaf1d01c6099c982c230d1 /scripts/mk-images
parente42c2e35b12ebbb468f3123e32a24a3a8455df1b (diff)
downloadanaconda-cd333fa45091c36629f05f75233cdbcf44e26bf7.tar.gz
anaconda-cd333fa45091c36629f05f75233cdbcf44e26bf7.tar.xz
anaconda-cd333fa45091c36629f05f75233cdbcf44e26bf7.zip
Preserve symlinks and only collect deps on ELF executables.
The mount and umount commands will have a bunch of symlinks, so if the command we are installing is a symlink, preserve it. Only use -s on install(1) if the command we are installing is an ELF executable. Since there's a check for that, use it to fire off get_dso_deps() for only ELF executables.
Diffstat (limited to 'scripts/mk-images')
-rwxr-xr-xscripts/mk-images55
1 files changed, 33 insertions, 22 deletions
diff --git a/scripts/mk-images b/scripts/mk-images
index e669a0b6c..e1b278bd0 100755
--- a/scripts/mk-images
+++ b/scripts/mk-images
@@ -354,31 +354,42 @@ instbin() {
DIR=$3
DEST=$4
- install -s -m 755 $ROOT/$BIN $DIR/$DEST
- get_dso_deps $ROOT "$BIN"
- local DEPS="$DSO_DEPS"
- mkdir -p $DIR/$LIBDIR
+ iself="$(file $ROOT/$BIN | grep ELF | grep executable)"
- for x in $DEPS ; do
- cp -Lfp $ROOT/$x $DIR/$LIBDIR
- done
-
- pushd $DIR/$LIBDIR
- if [ -f ld-linux.so.2 -a ! -L ld-linux.so.2 ]; then
- rm -f ld-linux.so.2
- linker="$(ls -1 ld-*.*.*.so)"
- if [ -z "$linker" ]; then
- linker="$(ls -1 ld-*.*.so)"
- fi
- found=$(echo $linker | wc -l)
- if [ $found -ne 1 ]; then
- echo "Found too many dynamic linkers:" >&2
- echo $linker >&2
- exit 1
+ if [ -l $ROOT/$BIN ]; then
+ cp -a $ROOT/$BIN $DIR/$DEST
+ else
+ if [ -z "$iself" ]; then
+ install -m 755 $ROOT/$BIN $DIR/$DEST
+ else
+ install -s -m 755 $ROOT/$BIN $DIR/$DEST
+
+ get_dso_deps $ROOT "$BIN"
+ local DEPS="$DSO_DEPS"
+ mkdir -p $DIR/$LIBDIR
+
+ for x in $DEPS ; do
+ cp -Lfp $ROOT/$x $DIR/$LIBDIR
+ done
+
+ pushd $DIR/$LIBDIR
+ if [ -f ld-linux.so.2 -a ! -L ld-linux.so.2 ]; then
+ rm -f ld-linux.so.2
+ linker="$(ls -1 ld-*.*.*.so)"
+ if [ -z "$linker" ]; then
+ linker="$(ls -1 ld-*.*.so)"
+ fi
+ found=$(echo $linker | wc -l)
+ if [ $found -ne 1 ]; then
+ echo "Found too many dynamic linkers:" >&2
+ echo $linker >&2
+ exit 1
+ fi
+ ln -s $linker ld-linux.so.2
+ fi
+ popd
fi
- ln -s $linker ld-linux.so.2
fi
- popd
}
setupShellEnvironment() {