This repository has been archived on 2024-10-17. You can view files and clone it, but cannot push or open issues or pull requests.
MahiroOS-jhalfs/extras/do_ica_prep

68 lines
1.9 KiB
Text
Raw Normal View History

2006-04-08 19:01:40 +02:00
#!/bin/bash
# $Id$
2006-04-09 19:09:43 +02:00
# Acknowledgment:
# The following code is a modified version of an original work written by
# Greg Schafer for the "DIY Linux" project and is included here with his
# permission.
# ref: http://www.diy-linux.org
#
2006-04-08 19:01:40 +02:00
set -e
2006-04-09 19:17:52 +02:00
local CMP_DIR=$1
local F L BN
2006-04-09 19:09:43 +02:00
2006-04-09 19:17:52 +02:00
# Run ica_prep if it hasn't been done already
if [ ! -f "$CMP_DIR/icaprep" ]; then
2006-04-09 19:09:43 +02:00
2006-04-09 19:17:52 +02:00
echo -n "Removing symbolic links in ${CMP_DIR}... "
find $CMP_DIR -type l | xargs rm -f
echo "done."
2006-04-09 19:09:43 +02:00
2006-04-09 19:17:52 +02:00
echo -n "Gunzipping \".gz\" files in ${CMP_DIR}... "
find $CMP_DIR -name '*.gz' | xargs gunzip
echo "done."
2006-04-09 19:09:43 +02:00
2006-04-09 19:17:52 +02:00
#echo -n "Bunzipping \".bz2\" files in ${CMP_DIR}... "
#find $CMP_DIR -name '*.bz2' | xargs bunzip2
#echo "done."
2006-04-09 19:09:43 +02:00
2006-04-09 19:17:52 +02:00
# ar archives contain date & time stamp info that causes us
# grief when trying to find differences. Here we perform some
# hackery to allow easy diffing. Essentially, replace each
# archive with a dir of the same name and extract the object
# files from the archive into this dir. Despite their names,
# libieee.a & libmcheck.a are not actual ar archives.
echo -n "Extracting object files from \".a\" files in ${CMP_DIR}... "
L=$(find $CMP_DIR -name '*.a' ! -name 'libieee.a' ! -name 'libmcheck.a')
for F in $L; do
mv $F ${F}.XX
mkdir $F
cd $F
BN=${F##*/}
ar x ../${BN}.XX || {
echo -e "\nError: ar archive extraction failed!\n" >&2
exit 1
}
rm -f ../${BN}.XX
done
echo "done."
2006-04-09 19:09:43 +02:00
2006-04-09 19:17:52 +02:00
echo -n "Stripping (debug) symbols from \".o\" files in ${CMP_DIR}... "
find $CMP_DIR -name '*.o' | xargs strip -p -g 2>/dev/null
echo "done."
2006-04-09 19:09:43 +02:00
2006-04-09 19:17:52 +02:00
echo -n "Stripping (all) symbols from files OTHER THAN \".o\" files in ${CMP_DIR}... "
find $CMP_DIR ! -name '*.o' | xargs strip -p 2>/dev/null || :
echo "done."
2006-04-09 19:09:43 +02:00
2006-04-09 19:17:52 +02:00
# We're all done
echo -en "\nSuccess: ICA preparation for "
echo -e "${CMP_DIR} complete.\n"
touch $CMP_DIR/icaprep
else
echo -e "\n$CMP_DIR was already processed\n"
fi
2006-04-08 19:01:40 +02:00