/
make-rpm.sh.in
127 lines (93 loc) · 4.89 KB
/
make-rpm.sh.in
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
#!/bin/bash
## confFlu - pythonFlu configuration package
## Copyright (C) 2010- Alexey Petrov
## Copyright (C) 2009-2010 Pebble Bed Modular Reactor (Pty) Limited (PBMR)
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
## See http://sourceforge.net/projects/pythonflu
##
## Author : Alexey PETROV
##
#--------------------------------------------------------------------------------------
# Prepare variables for substition in control,changelog etc files
confflu_version=@PACKAGE_VERSION@
version_number_part=@VERSION_NUMBER_PART@
package_name="confflu"
build_version=@BUILD_VERSION@
package_version=${confflu_version}-${build_version}
curr_folder=@abs_top_builddir@
package_folder=${curr_folder}/${package_name}-${package_version}
template_folder=${curr_folder}/rpm-template
#--------------------------------------------------------------------------------------
# Prepare folder for deb-packaging and copy necessary files to it
# first cleaning package files, folders with the same name( ${package_name}-${package_version} ) from the last attempt
rm -rf ${package_name}-${package_version}*
rm -rf ${package_name}_${package_version}*
install -d ${package_folder}
echo "--------------------------------------------------------------------------------"
echo "Copying \"package files\" to ${package_folder}"
echo "--------------------------------------------------------------------------------"
cp -rf admin build_configure env.sh Makefile ${package_folder}/
#--------------------------------------------------------------------------------------
#prepare to build rpm
rpm_package_folder="/usr/src/packages"
build_folder=${rpm_package_folder}/BUILD
echo "copy files to \"${build_folder}\""
echo "--------------------------------------------------------------------------------"
#copy solvers and libs to BUILD folder
cp ${template_folder}/Makefile ${package_folder}
( cd ${package_folder} && make preparation )
cp ${template_folder}/Makefile ${build_folder}/
#--------------------------------------------------------------------------------------
# create files list
confflu_path="/usr/local/share"
files_list="files.txt"
( cd ${package_folder} && touch ${files_list} )
lib_files=`( cd ${build_folder} && find confFlu -type f )`
for file in ${lib_files}; do
echo "${confflu_path}/${file}" >> ${package_folder}/${files_list}
done
links=`( cd ${build_folder} && find confFlu -type l )`
for link in ${links}; do
echo "${confflu_path}/${link}" >> ${package_folder}/${files_list}
done
echo "--------------------------------------------------------------------------------"
#--------------------------------------------------------------------------------------
specs_folder=${rpm_package_folder}/SPECS
echo "copying ${package_name}.spec file to \"${specs_folder}\""
cp rpm-template/rpm.spec ${specs_folder}/${package_name}.spec
# to add to "spec" file files_list
cat ${package_folder}/${files_list} >> ${specs_folder}/${package_name}.spec
echo "--------------------------------------------------------------------------------"
#---------------------------------------------------------------------------------------
# copying readme, news and add it's to spec file
cp README INSTALL NEWS ${rpm_package_folder}/BUILD/
echo "%doc README INSTALL NEWS" >> ${specs_folder}/${package_name}.spec
#---------------------------------------------------------------------------------------
# create package and move it to working folder
echo "create package"
echo "--------------------------------------------------------------------------------"
rpmbuild -bb ${specs_folder}/${package_name}.spec
a_package_file=${rpm_package_folder}/RPMS/noarch/${package_name}-${version_number_part}-${build_version}.noarch.rpm
a_new_filename=${package_name}-${package_version}.rpm
mv ${a_package_file} ${a_new_filename}
#---------------------------------------------------------------------------------------
# cleaning the building folder
echo "--------------------------------------------------------------------------------"
echo "clean \"${rpm_package_folder}/BUILD\" folder"
( cd ${rpm_package_folder}/BUILD && rm -rf confFlu Makefile README INSTALL NEWS )
( cd ${specs_folder} && rm -f ${package_name}.spec )
echo "--------------------------------------------------------------------------------"
#---------------------------------------------------------------------------------------