Changeset d057075


Ignore:
Timestamp:
04/09/2006 05:09:43 PM (18 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
experimental
Children:
5bcccc1
Parents:
aab6e73
Message:

Added do_ica_prep code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extras/do_ica_prep

    raab6e73 rd057075  
    11#!/bin/bash
    22# $Id$
     3
     4# Acknowledgment:
     5#  The following code is a modified version of an original work written by
     6#  Greg Schafer for the "DIY Linux" project and is included here with his
     7#  permission.
     8#  ref: http://www.diy-linux.org
     9#
     10
    311set -e
    412
    5 echo "This is a placeholder for now"
     13  local CMP_DIR=$1
     14  local F L BN
     15  local ALL_FILES=/tmp/allfiles.$$
     16  local UNIQUE_FILES=/tmp/uniquefiles.$$
    617
    7 exit
     18  # Run ica_prep if it hasn't been done already
     19  if [ ! -f "$CMP_DIR/icaprep" ]; then
     20
     21    echo -n "Removing symbolic links in ${CMP_DIR}... "
     22    find $CMP_DIR -type l | xargs rm -f
     23    echo "done."
     24
     25    echo -n "Gunzipping \".gz\" files in ${CMP_DIR}... "
     26    find $CMP_DIR -name '*.gz' | xargs gunzip
     27    echo "done."
     28
     29    #echo -n "Bunzipping \".bz2\" files in ${CMP_DIR}... "
     30    #find $CMP_DIR -name '*.bz2' | xargs bunzip2
     31    #echo "done."
     32
     33    # ar archives contain date & time stamp info that causes us
     34    # grief when trying to find differences. Here we perform some
     35    # hackery to allow easy diffing. Essentially, replace each
     36    # archive with a dir of the same name and extract the object
     37    # files from the archive into this dir. Despite their names,
     38    # libieee.a & libmcheck.a are not actual ar archives.
     39    echo -n "Extracting object files from \".a\" files in ${CMP_DIR}... "
     40    L=$(find $CMP_DIR -name '*.a' ! -name 'libieee.a' ! -name 'libmcheck.a')
     41    for F in $L; do
     42      mv $F ${F}.XX
     43      mkdir $F
     44      cd $F
     45      BN=${F##*/}
     46      ar x ../${BN}.XX || {
     47      echo -e "\nError: ar archive extraction failed!\n" >&2
     48      exit 1
     49      }
     50      rm -f ../${BN}.XX
     51    done
     52    echo "done."
     53
     54    echo -n "Stripping (debug) symbols from \".o\" files in ${CMP_DIR}... "
     55    find $CMP_DIR -name '*.o' | xargs strip -p -g 2>/dev/null
     56    echo "done."
     57
     58    echo -n "Stripping (all) symbols from files OTHER THAN \".o\" files in ${CMP_DIR}... "
     59    find $CMP_DIR ! -name '*.o' | xargs strip -p 2>/dev/null || :
     60    echo "done."
     61
     62    # We're all done
     63    echo -en "\nSuccess: ICA preparation for "
     64    echo -e "${CMP_DIR} complete.\n"
     65    touch $CMP_DIR/icaprep
     66  else
     67   echo -e "\n$CMP_DIR was already processed\n"
     68  fi
     69
Note: See TracChangeset for help on using the changeset viewer.