]> git.pld-linux.org Git - packages/anaconda.git/blame - anaconda-scrubtree
- live with old llh
[packages/anaconda.git] / anaconda-scrubtree
CommitLineData
bd688d0c
PZ
1#!/bin/bash
2
3DEBUG=""
4
5if [ "$1" == "--debug" ]; then
6 DEBUG="--debug"
7 shift
8fi
9
10if [ -z "$1" ]; then
11 echo "Usage: $0 /path/to/tree"
12 exit 1
13fi
14
15p=$1
16
17STRIP=strip
18ARCH=`uname -m | sed -e 's/i.86/i386/'`
19
20if [ $ARCH = ia64 ]; then
21 STRIP="strip --strip-debug"
22fi
23
24if [ $ARCH = x86_64 -o $ARCH = s390x ]; then
25 LIBDIR=lib64
26else
27 LIBDIR=lib
28fi
29
30# Must create ld.so.conf, because ldconfig does not cache
31# dirs specified on the command line.
32touch $p/etc/ld.so.conf
33mkdir $p/proc
34mount -t proc proc $p/proc
35[ -d $p/usr/X11R6/$LIBDIR ] && echo /usr/X11R6/$LIBDIR > $p/etc/ld.so.conf
36echo /usr/kerberos/$LIBDIR > $p/etc/ld.so.conf
37(cd $p; /usr/sbin/chroot $p usr/sbin/ldconfig )
38
39if [ $ARCH != s390 -a $ARCH != s390x ]; then
40 rm -f $p/usr/sbin/ldconfig
41fi
42rm $p/etc/ld.so.conf
43
44#
45# make sure we have links for programs supplied by busybox
46#
47# HOWEVER dont clobber existing programs supplied by other packages if exist
48#
49mv $p/sbin/busybox.anaconda $p/usr/bin/busybox
50(cd $p/usr/bin;
51set $(./busybox 2>&1| awk '/^\t([[:alnum:]_\[]+,)+/' | sed 's/,//g' | sed 's/ +//');
52dontclobber=(sh busybox reboot shutdown poweroff)
53while [ -n "$1" ]; do
54 save=
55 for n in ${dontclobber[@]} ; do
56 if [ "$1" == "$n" ]; then
57 save=$n
58 fi
59 done
60 # if it's not in our list and it doesn't exist, link to busybox
61 if [ -z "$save" -a ! -f "$1" ]; then
62 ln -sf ./busybox $1
63 else
64 [ -n "$DEBUG" ] && echo "Overriding busybox version of $1"
65 fi
66 shift
67done
68)
69
70umount $p/proc
71
72for l in `find $p -type f -perm +100 | grep -v "usr/X11R6/$LIBDIR/modules" | xargs file | sed -n 's/^\([^:]*\):.*ELF.*$/\1/p'`; do
73 $STRIP $l -R .comment -R .note `objdump -h $l | \
74 sed -n 's/^.*\(\.gnu\.warning\.[^ ]*\) .*$/-R \1/p'`
75done
This page took 0.074691 seconds and 4 git commands to generate.