summaryrefslogtreecommitdiffstats
path: root/remote/setup-tools.sh
diff options
context:
space:
mode:
authorJonathan Bauer2012-11-30 18:39:22 +0100
committerJonathan Bauer2012-11-30 18:39:22 +0100
commitd2c1218dabbb7f554198175d041316b626ca6839 (patch)
treef468d56820f1d8bc1f990f8958ee9cc3de71c6c8 /remote/setup-tools.sh
parentMerge branch 'master' of git.openslx.org:openslx-ng/tm-scripts (diff)
downloadtm-scripts-d2c1218dabbb7f554198175d041316b626ca6839.tar.gz
tm-scripts-d2c1218dabbb7f554198175d041316b626ca6839.tar.xz
tm-scripts-d2c1218dabbb7f554198175d041316b626ca6839.zip
udev & dbus scripts. [TODO missing tools for systemd]
Diffstat (limited to 'remote/setup-tools.sh')
-rwxr-xr-xremote/setup-tools.sh45
1 files changed, 28 insertions, 17 deletions
diff --git a/remote/setup-tools.sh b/remote/setup-tools.sh
index cfd2a83e..98d27cf0 100755
--- a/remote/setup-tools.sh
+++ b/remote/setup-tools.sh
@@ -61,47 +61,59 @@ copyfileswithdependencies ()
COPYFILES_LIST="copyfiles.list"
[ -e $COPYFILES_LIST ] && rm $COPYFILES_LIST
-
+
for FILENAME in $REQUIRED_BINARIES
do
for f in $(find . -name $FILENAME -type f -executable)
do
- [ $(file $f |grep -i Executable |grep -c ELF) -eq 1 ] && FILE=$f
+ [ $(file $f |grep -c ELF) -eq 1 ] && FILE=$f
done
echo $FILE >> $COPYFILES_LIST
- #fetch dependencies
- for i in $(ldd $FILE |awk -F ">" '{print $2}'|awk '{print $1}'|grep ^/)
+ # fetch dependencies
+ # quick fix to exclude libc*, else it copies unneeded libs...
+ for i in $(ldd $FILE |awk -F ">" '{print $2}'|awk '{print $1}'|grep ^/|grep -v libc.so*)
do
+
filename_base=$(basename $i | awk -F "." '{print $1}')
filename_path=$(dirname $i)
echo "$filename_path/$filename_base*" >> $COPYFILES_LIST
done
done
- # fast hack
- LDLINUX=$(ldd $FILE | grep ld-linux | awk '{print $1}' |cut -c2-)
- if [ -z $LDLINUX ]
- then
- echo "/$LDLINUX" >> $COPYFILES_LIST
- tar -cpv $(readlink -f "/$LDLINUX") | tar -xpv -C $INIT_DIR
- fi
-
for FILENAME in $REQUIRED_FILES
do
for f in $(find . -name $FILENAME)
do
- [ $(file $f |grep -c ELF) -eq 0 ] && FILE=$f
- echo $FILE >> $COPYFILES_LIST
+ FILE=$f
+ echo $FILE >> $COPYFILES_LIST
done
#echo $FILE >> $COPYFILES_LIST
done
#copy to initramfsdir
- tar -cpv $(cat $COPYFILES_LIST) | tar -xpv -C $INIT_DIR
+ tar -cpv $(cat $COPYFILES_LIST) | tar -xpv -C $INIT_DIR &>/dev/null
+}
+
+get_basic_libs () {
+
+ # copy libc and ld-linux separatly
+ echo "Looking for libc and ld-linux used for $SHELL..."
+ BASICLIBS=""
+ for i in $(ldd $SHELL)
+ do
+ if [ $(echo $i | grep '^/' | grep -c ld) -eq 1 -o $(echo $i | grep '^/' | grep -c libc.so) -eq 1 ];
+ then
+ echo "Found basic lib at: $i"
+ BASICLIBS="$BASICLIBS $i $(readlink -f "$i")"
+ fi
+ done
+ tar -cpv $BASICLIBS | tar -xpv -C $INIT_DIR &>/dev/null
+ echo "Basic libs copied."
}
main () {
-
+
+ get_basic_libs
cd $TOOL_DIR
while (( "$#" )); do
TOOL=$1
@@ -124,5 +136,4 @@ main () {
}
-
main $@