diff options
-rw-r--r-- | scripts/common-license.post | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/scripts/common-license.post b/scripts/common-license.post index 46fe909..7f2d4cb 100644 --- a/scripts/common-license.post +++ b/scripts/common-license.post @@ -1,16 +1,23 @@ #!/bin/sh echo "############### common-license.post ################" -LICENSE_DIR=/usr/share/licenses -LICENSE_FILE=/usr/share/license.html -MD5_TEMP_FILE=/usr/share/temp_license_md5 +LICENSE_BASE=/usr/share + +LICENSE_DIR=$LICENSE_BASE/licenses +LICENSE_FILE=$LICENSE_BASE/license.html +LICENSE_ZIP=$LICENSE_BASE/license.zip +MD5_TEMP_FILE=$LICENSE_BASE/temp_license_md5 if [[ -f $LICENSE_FILE ]]; then - rm -f $LICENSE_FILE + rm -f $LICENSE_FILE +fi + +if [[ -f $LICENSE_ZIP ]]; then + rm -f $LICENSE_ZIP fi if [[ -f $MD5_TEMP_FILE ]]; then - rm -f $MD5_TEMP_FILE + rm -f $MD5_TEMP_FILE fi @@ -18,10 +25,10 @@ cd $LICENSE_DIR LICENSE_LIST=`ls */*` for INPUT in $LICENSE_LIST; do - if [[ -f $INPUT ]]; then - PKG_NAME=`echo $INPUT|cut -d'/' -f1` - echo `md5sum $INPUT` $PKG_NAME >> $MD5_TEMP_FILE - fi + if [[ -f $INPUT ]]; then + PKG_NAME=`echo $INPUT|cut -d'/' -f1` + echo `md5sum $INPUT` $PKG_NAME >> $MD5_TEMP_FILE + fi done MD5_LIST=`cat $MD5_TEMP_FILE|awk '{print $1}'|sort -u` @@ -34,19 +41,23 @@ echo "<body>" >> $LICENSE_FILE echo "<xmp>" >> $LICENSE_FILE for INPUT in $MD5_LIST; do - PKG_LIST=`cat $MD5_TEMP_FILE|grep $INPUT|awk '{print $3}'` - FILE_LIST=`cat $MD5_TEMP_FILE|grep $INPUT|awk '{print $2}'` - PKG_FILE=`echo $FILE_LIST |awk '{print $1}'` - - echo "$PKG_LIST :" >> $LICENSE_FILE - cat $PKG_FILE >> $LICENSE_FILE - echo >> $LICENSE_FILE - echo >> $LICENSE_FILE - echo >> $LICENSE_FILE + PKG_LIST=`cat $MD5_TEMP_FILE|grep $INPUT|awk '{print $3}'` + FILE_LIST=`cat $MD5_TEMP_FILE|grep $INPUT|awk '{print $2}'` + PKG_FILE=`echo $FILE_LIST |awk '{print $1}'` + + echo "$PKG_LIST :" >> $LICENSE_FILE + cat $PKG_FILE >> $LICENSE_FILE + echo >> $LICENSE_FILE + echo >> $LICENSE_FILE + echo >> $LICENSE_FILE done echo "</xmp>" >> $LICENSE_FILE echo "</body>" >> $LICENSE_FILE echo "</html>" >> $LICENSE_FILE +cd $LICENSE_BASE ; zip license.zip license.html +cd - + rm -rf $LICENSE_DIR/* $MD5_TEMP_FILE +rm -rf $LICENSE_FILE
\ No newline at end of file |