blob: 46fe9098b70fabdd11353487f5bb4b59383c9cae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/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
if [[ -f $LICENSE_FILE ]]; then
rm -f $LICENSE_FILE
fi
if [[ -f $MD5_TEMP_FILE ]]; then
rm -f $MD5_TEMP_FILE
fi
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
done
MD5_LIST=`cat $MD5_TEMP_FILE|awk '{print $1}'|sort -u`
echo "<html>" >> $LICENSE_FILE
echo "<head>" >> $LICENSE_FILE
echo "<meta name=\"viewport\" content=\"initial-scale=1.0\">" >> $LICENSE_FILE
echo "</head>" >> $LICENSE_FILE
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
done
echo "</xmp>" >> $LICENSE_FILE
echo "</body>" >> $LICENSE_FILE
echo "</html>" >> $LICENSE_FILE
rm -rf $LICENSE_DIR/* $MD5_TEMP_FILE
|