summaryrefslogtreecommitdiffstats
path: root/remote/setup-tools.sh
diff options
context:
space:
mode:
authorJonathan Bauer2012-12-11 15:11:41 +0100
committerJonathan Bauer2012-12-11 15:11:41 +0100
commitd3bb9107163e622fe9f2702e1a6572746f149d36 (patch)
tree0763b6d740d7365808496055493577ebc4faad90 /remote/setup-tools.sh
parentREQUIRED_FILES can be path or filename, searching accordingly. Added base too... (diff)
downloadtm-scripts-d3bb9107163e622fe9f2702e1a6572746f149d36.tar.gz
tm-scripts-d3bb9107163e622fe9f2702e1a6572746f149d36.tar.xz
tm-scripts-d3bb9107163e622fe9f2702e1a6572746f149d36.zip
reworked setup-tools, generation of base dir structure of stage3.2 with tool named base
Diffstat (limited to 'remote/setup-tools.sh')
-rwxr-xr-xremote/setup-tools.sh65
1 files changed, 48 insertions, 17 deletions
diff --git a/remote/setup-tools.sh b/remote/setup-tools.sh
index 98d27cf0..54c4a69f 100755
--- a/remote/setup-tools.sh
+++ b/remote/setup-tools.sh
@@ -42,7 +42,7 @@ read_config ()
read_build ()
{
- BUILD_SCRIPT=$TOOL_DIR/$TOOL/build.$TOOL
+ BUILD_SCRIPT=$TOOL_DIR/$TOOL/$TOOL.build
if [ ! -e $BUILD_SCRIPT ]; then
echo "ERROR: Build script for specified tool not found."
@@ -57,9 +57,8 @@ copyfileswithdependencies ()
[ ! -d build ] && echo "No build directory for $TOOL found." && return
cd build
- [ ! -d $INIT_DIR ] && mkdir $INIT_DIR
- COPYFILES_LIST="copyfiles.list"
+ COPYFILES_LIST="list_wanted_stage3.2"
[ -e $COPYFILES_LIST ] && rm $COPYFILES_LIST
for FILENAME in $REQUIRED_BINARIES
@@ -68,34 +67,65 @@ copyfileswithdependencies ()
do
[ $(file $f |grep -c ELF) -eq 1 ] && FILE=$f
done
+ echo "Found $FILENAME at $FILE. Searching libraries..."
echo $FILE >> $COPYFILES_LIST
# 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*)
+ for i in $(ldd $FILE |awk '{print $1 $2 $3}'|grep -v ld-linux|grep -v libc.so*|grep -v linux-gate)
do
-
- filename_base=$(basename $i | awk -F "." '{print $1}')
- filename_path=$(dirname $i)
- echo "$filename_path/$filename_base*" >> $COPYFILES_LIST
+ arrIN=(${i//=>/ })
+ echo "--------------------------------------------------------"
+ echo "Searching ${arrIN[0]} under $(pwd)..."
+ LOCAL_MATCHES=$(find . -name $(echo ${arrIN[0]}|awk -F "." '{print $1}').*)
+ if [ "x$LOCAL_MATCHES" != "x" ];
+ then
+ for llib in $LOCAL_MATCHES;
+ do
+ echo "Copying $llib"
+ echo $llib >> $COPYFILES_LIST
+ #[ -L $llib ] && echo $(readlink -f $llib) >> $COPYFILES_LIST
+ done
+ else
+ echo "Did not found ${arrIN[0]} in $(pwd)"
+ if [ -e ${arrIN[1]} ];
+ then
+ echo -n "Trying ${arrIN[1]} ..."
+ echo " found! Copying."
+ echo ${arrIN[1]} >> $COPYFILES_LIST
+ [ -L ${arrIN[1]} ] && echo $(readlink -f ${arrIN[1]}) >> $COPYFILES_LIST
+ fi
+ fi
done
+ echo "Copied $FILENAME."
+ echo "-----------------------------------------------------------------"
done
- for FILENAME in $REQUIRED_FILES
+ for LIB in $REQUIRED_LIBRARIES
do
- for f in $(find . -name $FILENAME)
- do
- FILE=$f
- echo $FILE >> $COPYFILES_LIST
- done
- #echo $FILE >> $COPYFILES_LIST
+ for LOCATION in $(find . -name $LIB*)
+ do
+ echo $LOCATION >> $COPYFILES_LIST
+ done
+ done
+
+ echo "Copying required directories and files from config file..."
+ for ENTRY in $REQUIRED_DIRECTORIES $REQUIRED_FILES
+ do
+ echo ".$ENTRY" >> $COPYFILES_LIST
done
#copy to initramfsdir
- tar -cpv $(cat $COPYFILES_LIST) | tar -xpv -C $INIT_DIR &>/dev/null
+ tar -cpv $(cat $COPYFILES_LIST|sort -u) | tar -xpv -C $INIT_DIR &>/dev/null
+ unset REQUIRED_BINARIES
+ unset REQUIRED_LIBRARIES
+ unset REQUIRED_DIRECTORIES
+ unset REQUIRED_FILES
}
get_basic_libs () {
-
+
+ [ ! -d $INIT_DIR ] && mkdir $INIT_DIR
+
# copy libc and ld-linux separatly
echo "Looking for libc and ld-linux used for $SHELL..."
BASICLIBS=""
@@ -127,6 +157,7 @@ main () {
fetch_source
build
copyfileswithdependencies
+ post_copy
cd $TOOL_DIR
else
echo "Tool directory not found."