-
Notifications
You must be signed in to change notification settings - Fork 1
/
centos-7-x86_64-ez.spec
164 lines (128 loc) · 4.23 KB
/
centos-7-x86_64-ez.spec
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# template name attributes
%define templatename centos
%define templatever 7
%define templatearch x86_64
# Human-readable attributes
%define fullname Centos %templatever
%define fulltemplatearch (for AMD64/Intel EM64T)
# template dirs
%define templatedir /vz/template/%templatename/%templatever/%templatearch/config
%define ostemplatedir %templatedir/os/default
# vzpkgenv related
%define pkgman 410x64
%define package_manager rpm%pkgman
%define package_manager_pkg vzpkgenv%pkgman >= 7.0.0
# Files lists
%define files_lst() \
find %1 -type d -printf '%%%dir %%%attr(%m,root,root) %p\\n' | sed "s,%buildroot,,g" >> %2\
find %1 -type f -printf '%%%config %%%attr(%m,root,root) %p\\n' | sed "s,%buildroot,,g" >> %2\
%nil
# Sources list
%define sources_lst() \
%((cd %_sourcedir;\
s=1;\
for tmpl in %1; do\
sources=$tmpl"_*";\
for file in $sources; do\
echo Source$s: $file;\
s=$((s+1))\
done;\
done))\
%nil
# Obsoletes list
%define obsoletes_lst() \
%((for tmpl in %1; do\
[ $tmpl = os ] && continue;\
echo "Obsoletes: $tmpl-%templatename-%templatever-%templatearch-ez < 7.0.0";\
echo "Provides: $tmpl-%templatename-%templatever-%templatearch-ez = %version-%release";\
done))\
%nil
# Templates list - packages file should be always present in any template!
%define templates_list() %((cd %_sourcedir; for f in *_packages; do echo -n "${f%_*} "; done))
Summary: %fullname %fulltemplatearch Template set
Name: %templatename-%templatever-%templatearch-ez
Group: Virtuozzo/Templates
License: GPL
Version: 7.0.0
Release: 5%{?dist}
BuildRoot: %_tmppath/%name-root
BuildArch: noarch
Requires: %package_manager_pkg
# template source files
%sources_lst %templates_list
# obsoletes
%obsoletes_lst %templates_list
%description
%fullname %fulltemplatearch packaged as a Virtuozzo Template set.
%install
installfile() {
local sourcename=%_sourcedir/${1}_$4
local mode=$2
local dir=$3
local name=$4
[ ! -f $sourcename ] && return
install -m $mode $sourcename $dir/$name
}
rm -f files.lst
for tmpl in %templates_list; do
[ $tmpl = "os" ] && dir=%buildroot/%ostemplatedir || \
dir=%buildroot/%templatedir/app/$tmpl/default
mkdir -p $dir
if [ $tmpl = "os" ]; then
# Os template only files
# Text
echo "%fullname %fulltemplatearch Virtuozzo Template" > $dir/description
echo "%fullname %fulltemplatearch Virtuozzo Template" > $dir/summary
# Package manager
echo "%package_manager" > $dir/package_manager
# Disable upgrade
touch $dir/upgradable_versions
# Pkgman environment
installfile $tmpl 0644 $dir environment
# vzctl-related
installfile $tmpl 0644 $dir distribution
# Kernel virtualization
installfile $tmpl 0644 $dir osrelease
# Os template cache scripts
installfile $tmpl 0755 $dir pre-cache
installfile $tmpl 0755 $dir post-cache
installfile $tmpl 0755 $dir ct2vm
installfile $tmpl 0755 $dir mid-pre-install
installfile $tmpl 0755 $dir mid-post-install
installfile $tmpl 0755 $dir pre-upgrade
installfile $tmpl 0755 $dir post-upgrade
else
# App templates only files
# Text
echo "$tmpl for %fullname %fulltemplatearch Virtuozzo Template" > $dir/description
echo "$tmpl for %fullname %fulltemplatearch Virtuozzo Template" > $dir/summary
fi
# Common things
# Installation sources
installfile $tmpl 0644 $dir mirrorlist
installfile $tmpl 0644 $dir repositories
# Packages
installfile $tmpl 0644 $dir packages
# Scripts
installfile $tmpl 0755 $dir pre-install
installfile $tmpl 0755 $dir pre-install-hn
installfile $tmpl 0755 $dir post-install
installfile $tmpl 0755 $dir post-install-hn
# Versioning
echo "%release" > $dir/release
echo "%version" > $dir/version
%files_lst $dir files.lst
done
%files -f files.lst
%changelog
* Tue Jul 14 2015 Konstantin Volckov <[email protected]> 7.0.0-5
- Removed check for devnodes net/tun:rw, see #PSBM-34902
* Tue Jul 07 2015 Konstantin Volckov <[email protected]> 7.0.0-4
- Removed checks for tty and random devnodes rw requires for docker
* Mon Jul 06 2015 Konstantin Volckov <[email protected]> 7.0.0-3
- Adopted docker template to Virtuozzo 7.0, see #PSBM-34625
* Tue Jun 30 2015 Konstantin Volckov <[email protected]> 7.0.0-2
- Set default target as multi-user target, see #PSBM-34228
- Enable rpcbind.socket by default, see #PSBM-34604
* Wed Jun 17 2015 Konstantin Volckov <[email protected]> 7.0.0-1
- Initial release