]> git.ipfire.org Git - thirdparty/sarg.git/blob - archive.sh
Store the smartfilter log temporary file in the temporary directory
[thirdparty/sarg.git] / archive.sh
1 #!/bin/sh
2
3 Sources="."
4 Target=".."
5
6 Version=$(cat "$Sources/CMakeLists.txt" | sed -n -e 's/^SET(sarg_VERSION \([0-9]\))/\1/p')
7 if [ -z "$Version" ] ; then
8 echo "No version found"
9 exit 1
10 fi
11 Revision=$(cat "$Sources/CMakeLists.txt" | sed -n -e 's/^SET(sarg_REVISION "\([0-9][0-9]*.*\)")/\1/p')
12 if [ -z "$Revision" ] ; then
13 echo "No revision found"
14 exit 1
15 fi
16 Version="$Version.$Revision"
17
18 VersionCheck=$(cat "$Sources/configure.in" | sed -n -e 's/^AC_INIT(\[sarg\],\[\([0-9][0-9]*\.[0-9][0-9]*.*\)\])/\1/p')
19 if [ "x$Version" != "x$VersionCheck" ] ; then
20 echo "CMakeLists and configure doesn't refer to the same version"
21 exit 1
22 fi
23
24 SargList="$Target/sarglist.txt.unsort"
25 SortList="$Target/sarglist.txt"
26 DirList="$Target/sargdir.txt"
27 ExcludeList="$Target/sargexclude.txt"
28 ArchiveFile="$Target/sarg-$Version.tar"
29
30 SedSources=$(echo "$Sources" | sed -e 's/\./\\./')
31 ls $Sources/*.c | sed -e "s/^$SedSources\///" > $SargList
32 ls $Sources/include/*.h | sed -e "s/^$SedSources\///" >> $SargList
33 ls $Sources/po/*.{po,gmo,pot} | sed -e "s/^$SedSources\///" >> $SargList
34
35 echo "
36 config.h
37 ABOUT-NLS
38 aclocal.m4
39 BETA-TESTERS
40 ChangeLog
41 CMakeLists.txt
42 configure.in
43 CONTRIBUTORS
44 COPYING
45 css.tpl
46 DONATIONS
47 Doxyfile
48 exclude_codes
49 htaccess
50 LICENSE
51 Makefile.in
52 PROGRAMMERS
53 README
54 README_cmake
55 sarg.1
56 sarg.conf
57 sarg_htaccess
58 user_limit_block
59 cfgaux
60 documentation
61 fonts
62 images
63 include/config.h.in
64 sarg-php
65 sarg_manpage.xml
66 po/remove-potcdate.sin
67 po/Makefile.in.in
68 po/POTFILES.in
69 po/quot.sed
70 po/Rules-quot
71 po/insert-header.sin
72 po/ChangeLog
73 po/LINGUAS
74 po/en@quot.header
75 po/en@boldquot.header
76 po/boldquot.sed
77 po/Makevars
78 sorttable/sorttable.js
79 " >> $SargList
80
81 [ -f "$DirList" ] && rm "$DirList"
82 cat $SargList | while read file
83 do
84 [ -z "$file" ] && continue
85 if [ -f "$file" ] ; then
86 echo "$file" >> "$DirList"
87 elif [ -d "$file" ] ; then
88 find "$file" -type f >> "$DirList"
89 else
90 echo "Unknown file type $file"
91 exit 1
92 fi
93 done
94 rm "$SargList"
95
96 sort -u "$DirList" | sed -e '/^$/d' > "$SortList"
97 rm "$DirList"
98
99 echo "
100 */.svn
101 */.git
102 *~
103 *.o
104 .gitignore
105 " > "$ExcludeList"
106
107 tar cf "$ArchiveFile" -C "$Sources" --files-from="$SortList" --exclude-from="$ExcludeList" --no-recursion --transform="s,^,sarg-$Version/," --owner root --group root --mode 644
108 tar rf "$ArchiveFile" -C "$Sources" "configure" --exclude-from="$ExcludeList" --transform="s,^,sarg-$Version/," --owner root --group root --mode 755
109 gzip -f "$ArchiveFile"
110 CompressFile="$ArchiveFile.gz"
111
112 md5sum $CompressFile > "$Target/sarg-$Version.md5sum"
113 echo "md5sum:"
114 cat "$Target/sarg-$Version.md5sum"
115
116 sha1sum $CompressFile > "$Target/sarg-$Version.sha1sum"
117 echo "sha1sum:"
118 cat "$Target/sarg-$Version.sha1sum"
119
120 sha256sum $CompressFile > "$Target/sarg-$Version.sha256sum"
121 echo "sha256sum:"
122 cat "$Target/sarg-$Version.sha256sum"