source: svn/trunk/newcon3bcm2_21bu/dta/tools/match-secure.sh @ 5

Last change on this file since 5 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#! /bin/bash
2# This script compares SecureFileList.txt against the release source tree to
3# identify any files that would be stripped by the docsafe.
4# To use this script execute it from the directory where tarball with the
5# release source is located. Alternatively, execute this script from the
6# HD DTA source root - a directory containing dta directory. Alternatively,
7# directory should contain source.lst file that has list of all the files in
8# the release.
9# The scrpt requres tar, grep, awk and the recent version of bash.
10
11secure_name_list="SecureFileList.txt"
12source_file_list="source.lst"
13match_file_list="match.lst"
14module_file_list="modules.lst"
15
16function create-source-list()
17{
18    local archive_name=$(compgen -G "*.tar.gz")
19# select first name from the list
20    for name in ${archive_name} ; do
21        archive_name=${name}
22        break
23    done
24    if [ -n "${archive_name}" ] ; then
25        echo -n "Found archive ${archive_name}... "
26        tar -tzf ${archive_name} > ${source_file_list}
27    else
28        if [ -d ./dta ] ; then
29            echo -n "Found dta directory... "
30            find . > ${source_file_list}
31        else
32            echo "Unable create source list, exiting."
33            exit 254
34        fi
35    fi
36    echo "created source list."
37}
38
39
40if [ ! -e ${secure_name_list} ] ; then
41 echo "Secure file list can not be found."
42 exit 255
43fi
44
45if [ ! -e ${source_file_list} ] ; then
46 echo "Source file list can not be found, attempting to create."
47 create-source-list
48fi
49
50
51sed -e 's/[ \t]*$//' -e 's/\\/\//g' -e '/^$/{d}' -e 's/\(^[^\/#]\)/\/\1/' ${secure_name_list} > u_${secure_name_list}
52
53grep -Fo -f u_${secure_name_list} ${source_file_list} > ${match_file_list}
54
55echo "###" >> ${match_file_list}
56grep -F -f ${match_file_list} u_${secure_name_list} > ${module_file_list}
57
58awk '/^###/{header=$0}; /^[^#]/{if(header != "") {print header; header=""}; print $0}' ${module_file_list}
59
60rm ${source_file_list} ${match_file_list} ${module_file_list} u_${secure_name_list}
61
Note: See TracBrowser for help on using the repository browser.