From 738ed47b2dd6981e99595001dd87c22e0f9f81df Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Tue, 5 Feb 2013 17:29:01 +0100 Subject: [setup_tools] check for locate --- remote/setup_tools | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'remote/setup_tools') diff --git a/remote/setup_tools b/remote/setup_tools index ed6f58e9..091a63da 100755 --- a/remote/setup_tools +++ b/remote/setup_tools @@ -6,14 +6,15 @@ MODULE_DIR=${ROOT_DIR}/remote TOOL_DIR=${MODULE_DIR}/tools INIT_DIR=${MODULE_DIR}/stage3.2 -setup_git () +initial_checks () { - if [ ! -z "${GIT}" ]; then - GIT_BIN=$(which git) - [ -z "${GIT_BIN}" ] && echo "Installing git..." && apt-get install git - fi + for BIN in $(which git) $(which locate) + do + [ -z $BIN ] && echo "Installing $BIN..." && apt-get install $BIN + done } + read_config () { TOOL_CONFIG=${TOOL_DIR}/${TOOL}/${TOOL}.conf @@ -165,6 +166,8 @@ get_basic_libs () { generate_stage32 () { + initial_checks + # if no arguments assume all. if [ "x$1" = "x" -o "x$1" = "xall" ]; then tools=$(ls ${TOOL_DIR}) @@ -183,7 +186,6 @@ generate_stage32 () { cd ${TOOL} read_config read_build - setup_git install_dependencies fetch_source build -- cgit v1.2.3-55-g7522 From d9e747a690f34401e1d545fa4c794310d105f510 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Fri, 8 Feb 2013 17:39:04 +0100 Subject: [setup_tools] cleaned up debug message, use -d for debug output or it will write to file. --- remote/setup_tools | 47 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) (limited to 'remote/setup_tools') diff --git a/remote/setup_tools b/remote/setup_tools index 091a63da..ef498960 100755 --- a/remote/setup_tools +++ b/remote/setup_tools @@ -44,6 +44,7 @@ copyfileswithdependencies () [ ! -d build ] && echo "No build directory for ${TOOL} found." && return cd build + [ "x$DEBUG" != "x1" ] && echo "Logging to build_stage32.log" && exec 6>&1 > build_stage32.log COPYFILES_LIST="list_wanted_stage3.2" [ -e ${COPYFILES_LIST} ] && rm ${COPYFILES_LIST} @@ -56,35 +57,46 @@ copyfileswithdependencies () echo "-----------------------------------------------------------------" continue fi - echo "Found ${FILENAME} at ${FILE}. Searching libraries..." + echo "Found ${FILENAME} at ${FILE}" echo ${FILE} >> ${COPYFILES_LIST} # fetch dependencies # quick fix to exclude libc*, else it copies unneeded libs... + # workaround for + ldd ${FILE} &>/dev/null + ldd_exit_code=$? + if [ "x$ldd_exit_code" != "x0" ]; + then + echo "ldd $FILE failed." + continue + fi for i in $(ldd ${FILE} |awk '{print $1 $2 $3}'|grep -v ld-linux|grep -v libc.so*|grep -v linux-gate|grep -v linux-vdso) do arrIN=(${i//=>/ }) - echo "--------------------------------------------------------" - echo "Searching ${arrIN[0]} under $(pwd)..." + echo -e -n "\t${arrIN[0]}" 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 -ne " ->${llib}" echo ${llib} >> ${COPYFILES_LIST} done + echo "" 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} + + if [ ! -L ${arrIN[1]} ]; + then + echo -e " -> ${arrIN[1]}" + else + echo -e " -> ${arrIN[1]} -> $(readlink -f ${arrIN[1]})" + echo $(readlink -f ${arrIN[1]}) >> ${COPYFILES_LIST} + fi fi fi done - echo "Copied ${FILENAME}." echo "-----------------------------------------------------------------" done @@ -137,8 +149,12 @@ copyfileswithdependencies () echo ".${ENTRY}" >> ${COPYFILES_LIST} done + # reset pipes + [ "x$DEBUG" != "x1" ] && exec 1>&6 6>&- + #copy to initramfsdir - tar -cpv $(cat ${COPYFILES_LIST}|sort -u) | tar -xpv -C ${INIT_DIR} &>/dev/null + echo "[stage32] Completed file list generation at ${TOOL_DIR}/${TOOL}/build/${COPYFILES_LIST}." + (tar -cpv $(cat ${COPYFILES_LIST}|sort -u) | tar -xpv -C ${INIT_DIR}) &>/dev/null unset REQUIRED_BINARIES unset REQUIRED_LIBRARIES unset REQUIRED_DIRECTORIES @@ -150,6 +166,7 @@ get_basic_libs () { [ ! -d ${INIT_DIR} ] && mkdir ${INIT_DIR} # copy libc and ld-linux separatly + echo "----------------------------------------------------" echo "Looking for libc and ld-linux used for ${SHELL}..." BASICLIBS="" for i in $(ldd ${SHELL}) @@ -160,7 +177,7 @@ get_basic_libs () { BASICLIBS="${BASICLIBS} $i $(readlink -f "$i")" fi done - tar -cpv ${BASICLIBS} | tar -xpv -C ${INIT_DIR} &>/dev/null + (tar -cpv ${BASICLIBS} | tar -xpv -C ${INIT_DIR}) &>/dev/null echo "Basic libs copied." } @@ -183,6 +200,10 @@ generate_stage32 () { TOOL=$1 if [ -d ${TOOL} ]; then + echo "###############################################################" + echo "# BUILDING $TOOL" + echo "###############################################################" + cd ${TOOL} read_config read_build @@ -192,6 +213,10 @@ generate_stage32 () { copyfileswithdependencies post_copy cd ${TOOL_DIR} + + echo "###############################################################" + echo "# COMPLETED $TOOL" + echo "###############################################################" else echo "Tool directory not found." fi -- cgit v1.2.3-55-g7522 From 5bbedbe7b55dde3fabe7dc4797522b77495df6be Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Thu, 14 Feb 2013 16:02:01 +0100 Subject: debug output cleaned a bit --- remote/setup_tools | 89 ++++++++++++++++++++++---------------- remote/tools/dbus/dbus.build | 2 +- remote/tools/systemd/systemd.build | 2 +- remote/tools/xorg/xorg.build | 4 +- server/build_core | 3 +- 5 files changed, 56 insertions(+), 44 deletions(-) (limited to 'remote/setup_tools') diff --git a/remote/setup_tools b/remote/setup_tools index ef498960..bb1895d0 100755 --- a/remote/setup_tools +++ b/remote/setup_tools @@ -44,20 +44,25 @@ copyfileswithdependencies () [ ! -d build ] && echo "No build directory for ${TOOL} found." && return cd build - [ "x$DEBUG" != "x1" ] && echo "Logging to build_stage32.log" && exec 6>&1 > build_stage32.log COPYFILES_LIST="list_wanted_stage3.2" [ -e ${COPYFILES_LIST} ] && rm ${COPYFILES_LIST} - + + + echo -e "\n\n*********************************************************" + echo "*" + echo "* Copying required binaries from config file..." + echo "*" + echo -e "*********************************************************\n\n" for FILENAME in ${REQUIRED_BINARIES} do FILE=$(find . -name ${FILENAME} -type f -executable | xargs grep -l ELF) if [ -z "$FILE" ]; then - echo "No Binary found for ${FILENAME}. Skipping." + echo -e "\tNo Binary found for ${FILENAME}. Skipping." echo "-----------------------------------------------------------------" continue fi - echo "Found ${FILENAME} at ${FILE}" + echo -e "\tFound ${FILENAME} at ${FILE}" echo ${FILE} >> ${COPYFILES_LIST} # fetch dependencies # quick fix to exclude libc*, else it copies unneeded libs... @@ -66,14 +71,14 @@ copyfileswithdependencies () ldd_exit_code=$? if [ "x$ldd_exit_code" != "x0" ]; then - echo "ldd $FILE failed." + echo -e "\tldd $FILE failed." continue fi for i in $(ldd ${FILE} |awk '{print $1 $2 $3}'|grep -v ld-linux|grep -v libc.so*|grep -v linux-gate|grep -v linux-vdso) do arrIN=(${i//=>/ }) - echo -e -n "\t${arrIN[0]}" - LOCAL_MATCHES=$(find . -name $(echo ${arrIN[0]}|awk -F "." '{print $1}').*) + echo -en "\t\t${arrIN[0]}" + LOCAL_MATCHES=$(find . -name $(echo ${arrIN[0]}|awk -F "." '{print $1}').so*) if [ "x${LOCAL_MATCHES}" != "x" ]; then for llib in ${LOCAL_MATCHES}; @@ -97,7 +102,7 @@ copyfileswithdependencies () fi fi done - echo "-----------------------------------------------------------------" + echo -e "\t-------------------------------------------------------------------------------------------------------------" done for LIB in ${REQUIRED_LIBRARIES} @@ -108,49 +113,56 @@ copyfileswithdependencies () done done - echo "Copying required directories from config file..." + echo -e "\n\n*********************************************************" + echo "*" + echo "* Copying required directories from config file..." + echo "*" + echo -e "*********************************************************\n\n" for ENTRY in ${REQUIRED_DIRECTORIES} do echo ".${ENTRY}" >> ${COPYFILES_LIST} - for LIB in $(find .${ENTRY} -type f -not -name "*.a" | xargs grep -l ELF) + for BIN in $(find .${ENTRY} -type f -not -name "*.a" | xargs grep -l ELF) do - for i in $(ldd ${LIB} |awk '{print $1 $2 $3}'|grep -v ld-linux|grep -v libc.so*|grep -v linux-gate|grep -v linux-vdso) + echo -e "\tSearching libs for ${BIN}..." + for i in $(ldd ${BIN} |awk '{print $1 $2 $3}'|grep -v ld-linux|grep -v libc.so*|grep -v linux-gate|grep -v linux-vdso) do arrIN=(${i//=>/ }) - echo "--------------------------------------------------------" - echo "Searching ${arrIN[0]} under $(pwd)..." - LOCAL_MATCHES=$(find . -name $(echo ${arrIN[0]}|awk -F "." '{print $1}').*) + echo -e "\t\t---------------------------------------------------------" + echo -ne "\t\tSearching ${arrIN[0]} under $(pwd)..." + LOCAL_MATCHES=$(find . -name $(echo ${arrIN[0]}|awk -F "." '{print $1}').so*) if [ "x${LOCAL_MATCHES}" != "x" ]; then for llib in ${LOCAL_MATCHES}; do - echo "Copying ${llib}" + echo -en "\n\t\tCopying ${llib}" echo ${llib} >> ${COPYFILES_LIST} done + echo "" else - echo "Did not found ${arrIN[0]} in $(pwd)" + echo " not found." if [ ! -z ${arrIN[1]} ]; then - echo -n "Trying ${arrIN[1]} ..." - echo " found! Copying." + echo -e "\t\tCopying from system ${arrIN[1]} ..." echo ${arrIN[1]} >> ${COPYFILES_LIST} [ -L ${arrIN[1]} ] && echo $(readlink -f ${arrIN[1]}) >> ${COPYFILES_LIST} fi fi done - echo "Copied ${LIB}." - echo "-----------------------------------------------------------------" + echo -e "\tCopied $BIN" + echo -e "\t-------------------------------------------------------------------------------------------------------------" done done - echo "Copying required files from config file..." + echo "*********************************************************" + echo "*" + echo "* Copying required files from config file..." + echo "*" + echo "*********************************************************" for ENTRY in ${REQUIRED_FILES} do echo ".${ENTRY}" >> ${COPYFILES_LIST} done - # reset pipes - [ "x$DEBUG" != "x1" ] && exec 1>&6 6>&- #copy to initramfsdir echo "[stage32] Completed file list generation at ${TOOL_DIR}/${TOOL}/build/${COPYFILES_LIST}." @@ -167,43 +179,43 @@ get_basic_libs () { # copy libc and ld-linux separatly echo "----------------------------------------------------" - 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" + echo "Copied $i" BASICLIBS="${BASICLIBS} $i $(readlink -f "$i")" fi done (tar -cpv ${BASICLIBS} | tar -xpv -C ${INIT_DIR}) &>/dev/null - echo "Basic libs copied." } generate_stage32 () { initial_checks + get_basic_libs + # if no arguments assume all. if [ "x$1" = "x" -o "x$1" = "xall" ]; then tools=$(ls ${TOOL_DIR}) set -- $tools fi - # first copy libc and ld-linux - get_basic_libs - # now iterate over given tools and copy them cd ${TOOL_DIR} while (( "$#" )); do - TOOL=$1 + TOOL=$1 if [ -d ${TOOL} ]; then - echo "###############################################################" - echo "# BUILDING $TOOL" - echo "###############################################################" - + echo "###################################################################################" + echo "# BUILDING $TOOL" + echo "#" + + [ "x$DEBUG" != "x1" ] \ + && echo "Logging to ${TOOL_DIR}/${TOOL}/stage32.log" \ + && exec 6>&1 > ${TOOL_DIR}/${TOOL}/stage32.log cd ${TOOL} read_config read_build @@ -214,15 +226,16 @@ generate_stage32 () { post_copy cd ${TOOL_DIR} - echo "###############################################################" - echo "# COMPLETED $TOOL" - echo "###############################################################" + # reset pipes + [ "x$DEBUG" != "x1" ] && exec 1>&6 6>&- + echo "#" + echo "# DONE" + echo "###################################################################################" else echo "Tool directory not found." fi shift done - } clean_tools() { diff --git a/remote/tools/dbus/dbus.build b/remote/tools/dbus/dbus.build index 6c6faaf5..5254497f 100644 --- a/remote/tools/dbus/dbus.build +++ b/remote/tools/dbus/dbus.build @@ -21,7 +21,7 @@ build() { # prepare target dir & copy there [ ! -d ${BUILDDIR} ] && mkdir -p ${BUILDDIR} - tar -cpv $(cat ${COPYLIST}|sort -u) | tar -xpv -C ${BUILDDIR} + (tar -cpv $(cat ${COPYLIST}|sort -u) | tar -xpv -C ${BUILDDIR}) &> /dev/null } post_copy() { diff --git a/remote/tools/systemd/systemd.build b/remote/tools/systemd/systemd.build index 6df35629..d198f821 100644 --- a/remote/tools/systemd/systemd.build +++ b/remote/tools/systemd/systemd.build @@ -19,7 +19,7 @@ install_dependencies() { add-apt-repository --yes ppa:pitti/systemd apt-get update --force-yes fi - apt-get install -y $DEPS + apt-get install -y $DEPS &>/dev/null } build () { diff --git a/remote/tools/xorg/xorg.build b/remote/tools/xorg/xorg.build index 5eaff345..590d0bb0 100644 --- a/remote/tools/xorg/xorg.build +++ b/remote/tools/xorg/xorg.build @@ -25,13 +25,13 @@ build() { # prepare target dir & copy there [ ! -d $BUILDDIR ] && mkdir -p $BUILDDIR - tar -cpv $(cat $COPYLIST|sort -u) | tar -xpv -C $BUILDDIR + (tar -cpv $(cat $COPYLIST|sort -u) | tar -xpv -C $BUILDDIR) &>/dev/null } post_copy() { [ ! -d $INIT_DIR/etc/X11 ] && mkdir -p $INIT_DIR/etc/X11 - ln -s /usr/bin/Xorg ${INIT_DIR}/etc/X11/X + [ ! -e ${INIT_DIR}/etc/X11/X ] && ln -s /usr/bin/Xorg ${INIT_DIR}/etc/X11/X [ ! -d $INIT_DIR/var/lib/xkb ] && mkdir -p $INIT_DIR/var/lib/xkb cp /var/lib/xkb/server* $INIT_DIR/var/lib/xkb } diff --git a/server/build_core b/server/build_core index a9763715..6367e9e5 100755 --- a/server/build_core +++ b/server/build_core @@ -82,11 +82,10 @@ generate_initramfs() { if [ $(echo $i | grep '^/' | grep -c ld) -eq 1 \ -o $(echo $i | grep '^/' | grep -c libc.so) -eq 1 ]; then - echo $i BASICLIBS="$BASICLIBS $i $(readlink -f "$i")" fi done - tar cpv $BASICLIBS | tar xpv -C ${STAGE31_DIR} &>/dev/null + (tar cpv $BASICLIBS | tar xpv -C ${STAGE31_DIR}) &>/dev/null } -- cgit v1.2.3-55-g7522