-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathbuild.sh
executable file
·136 lines (97 loc) · 2.87 KB
/
build.sh
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
#
# script for create rpm(s) packages
#
LANG=C
# for rpmlint
# export http_proxy=http://user:password@proxy:port/
cd ../../..
ROOT_DIR=`pwd`
SRC_DIR="`pwd`/webacula"
echo "SRC_DIR=${SRC_DIR}"
F_INDEX_PHP="${SRC_DIR}/html/index.php"
F_SPEC="${SRC_DIR}/packaging/Fedora/webacula.spec"
F_README="${SRC_DIR}/README"
F_EXCLUDE="exclude.lst"
RPM_ROOT="${HOME}/src"
RPM_SOURCES="${RPM_ROOT}/SOURCES"
RPM_SPECS="${RPM_ROOT}/SPECS"
RPM_TMP="${RPM_ROOT}/tmp"
RPM_RPMS="${RPM_ROOT}/RPMS"
SPEC="webacula.spec"
VERSION=`grep -e "^.*define('WEBACULA_VERSION.*$" ${F_INDEX_PHP} | awk -F "'" '{print($4)}'`
VER_SPEC=`grep -e "^Version:" ${F_SPEC} | awk '{print($2)}'`
VER_README=`grep -e "^Version:" ${F_README} | awk '{print($2)}'`
if [ ${VERSION} == ${VER_SPEC} ] && [ ${VERSION} == ${VER_README} ]
then
echo "OK. Versions correct."
else
echo -e "\nVersions not match. Correct this (file/version) :\n"
echo -e "$F_INDEX_PHP\t${VERSION}"
echo -e "${F_SPEC}\t${VER_SPEC}"
echo -e "${F_README}\t${VER_README}"
echo -e "\n"
exit 10
fi
cd ${SRC_DIR}
mkdir -p "${RPM_TMP}/webacula-${VERSION}"
echo "library/Zend
nbproject
docs/src
library/Zend.arc
library/runme
library/Zend*.tar.gz
packaging
tests
.htaccess
.settings
.git
.gitignore
.project
.buildpath
*~
*.tmp
*.swp
" > "${RPM_TMP}/${F_EXCLUDE}"
echo "create tarball..."
rsync -a --exclude-from="${RPM_TMP}/${F_EXCLUDE}" . "${RPM_TMP}/webacula-${VERSION}"
echo -e "\n*** exit=$?"
rm -f "${RPM_TMP}/${F_EXCLUDE}"
cd ${RPM_TMP}
tar zcvpf "${RPM_SOURCES}/webacula-${VERSION}.tar.gz" "webacula-${VERSION}"
echo -e "\n*** exit=$?"
echo -e "\nclean all\n"
rm -f "${RPM_TMP}/webacula-${VERSION}.tar.gz"
rm -f -r "${RPM_TMP}/webacula-${VERSION}"
echo -e "\ncopy files...\n"
cd ${ROOT_DIR}
cp -p -f "${SRC_DIR}/packaging/Fedora/webacula.spec" "${RPM_SPECS}/"
cp -p -f "${SRC_DIR}/packaging/Fedora/*.patch "${RPM_SOURCES}/"
echo -e "\n"
cd ${RPM_SPECS}
pwd
ls -la
echo -e "\nPress Enter to rpmlint ..."
read
rpmlint ${SPEC}
echo -e "\n*** exit=$?"
echo -e "\nPress Enter to rpmbuild ..."
read
# fix error: unpacking of archive failed on file XXX cpio: MD5 sum mismatch
rpmbuild --define "_source_filedigest_algorithm md5" --define "_binary_filedigest_algorithm md5" -ba ${SPEC}
echo -e "\n*** exit=$?"
echo -e "\n\n\n**************************************************************"
echo -e "***** Next instruction :\n
rpmlint -i ${RPM_RPMS}/noarch/webacula-
Install rpm and testing.
rpm -ihv ${RPM_RPMS}/noarch/webacula-\n
mock -r fedora-14-i386 rebuild ${RPM_ROOT}/SRPMS/webacula-\n
mock -r fedora-15-i386 rebuild ${RPM_ROOT}/SRPMS/webacula-\n
mock -r fedora-16-i386 rebuild ${RPM_ROOT}/SRPMS/webacula-\n
mock -r epel-5-i386 rebuild ${RPM_ROOT}/SRPMS/webacula-\n
mock -r epel-6-i386 rebuild ${RPM_ROOT}/SRPMS/webacula-\n
see result:
ls -la /var/lib/mock/fedora-*/result/
Add sign
rpm --addsign *.rpm
\n"