Inserting VZGOT development tree within GIT
[safe/jmp/vzgot] / support / vzgot.spec
1 #-----------------------------------------------------------
2 #Fichier des definition des SPEC d'installation
3 #-----------------------------------------------------------
4 #to define the revision numer
5 %define revision %(R="$Revision: 0.84.0.0 $"; RR="${R##: }"; echo ${RR%% ?})
6 %define rversion %(echo %{revision} | cut -d'.' -f1-2)
7 %define rrelease %(echo %{revision}| cut -d'.' -f4)
8 %define revdate %(R="$Date: 2010/03/06 16:39:08 $"; RR="${R##: }"; echo ${RR%% ?})
9 %define sversion %(echo %{revdate} | cut -d' ' -f1 | tr -d '/')
10 %define ddist %(echo %{?dist}| tr -d '.')
11 #-----------------------------------------------------------
12 %{?!mark:%define mark fedora}
13
14 %if "%mark" == "fedora"
15 %define locmark %{?dist}
16 %endif
17
18 %if "%mark" == "safe"
19 %define locmark .%{?dist}.%{mark}
20 %endif
21 #-----------------------------------------------------------
22 Name: vzgot
23 Summary: An application to drive linux container
24 Group: System Environment/Daemons
25 Version: %{rversion}.%{rrelease}
26 Release: %{?sversion}%{?locmark}
27 License: GPLv2
28 Source: ftp://ftp.safe.ca/pub/srctgz/%{name}-%{version}.tgz
29 URL: http://www.%{name}.safe.ca/index.html
30 Vendor: SAFE Inc.
31 Requires: kernel >= 2.6.24
32 Requires: util-linux-ng
33 Requires: bridge-utils
34 Requires: /usr/sbin/brctl,/sbin/ip,/bin/ps,/usr/bin/wc
35 Requires: /sbin/chkconfig
36 Requires: /bin/chmod,/bin/sed,/bin/sh,/bin/ln
37 #---------------------------------------------------------------
38 buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
39
40
41 %description
42 vzgot is a set of tool to manage linux container
43 it allow to run a wide range of distribution
44 (from RH-7.3 to FC12, Centos-4.6 to Centos-5.3)
45 while using a plain linux kernel (above 2.6.24).
46
47
48 %files
49 #%defattr(0640,root,root,0755)
50 %doc %{name}-%{version}*.build_date
51 %doc README Changes QUICK-START
52 %{_var}/lock/%{name}
53 %{_var}/lib/%{name}/RPM
54 %{_var}/lib/%{name}/vzdir
55 %{_var}/lib/%{name}/etc/ssh
56 %{_var}/lib/%{name}/home
57 %{_var}/lib/%{name}/cgroup.d
58 %{_var}/lib/%{name}/vztemplate
59 %{_initrddir}/%{name}
60 %{_usr}/sbin/%{name}
61 %{_usr}/sbin/%{name}.mksrvz
62 %{_usr}/sbin/%{name}.redoall
63 %{_var}/lib/%{name}/shell/%{name}.net
64 %{_var}/lib/%{name}/shell/%{name}.fboot
65 %{_var}/lib/%{name}/shell/%{name}.fboot.redhat
66 %{_var}/lib/%{name}/shell/%{name}.fboot.debian
67 %{_var}/lib/%{name}/shell/%{name}.open
68 %{_var}/lib/%{name}/shell/%{name}.close
69 %{_var}/lib/%{name}/shell/%{name}.start
70 %{_var}/lib/%{name}/shell/%{name}.create
71 %{_var}/lib/%{name}/shell/%{name}.destroy
72
73 %config(noreplace) %{_sysconfdir}/%{name}/vzgot_config
74 %config(noreplace) %{_sysconfdir}/%{name}/vzgot_list
75 %config(noreplace) %{_var}/lib/%{name}/etc/shadow
76 %config(noreplace) %{_var}/lib/%{name}/etc/resolv.conf
77 %config(noreplace) %{_var}/lib/%{name}/etc/groups
78 %config(noreplace) %{_var}/lib/%{name}/etc/users
79 %config(noreplace) %{_var}/lib/%{name}/etc/sudoers
80 %config(noreplace) %{_var}/lib/%{name}/etc/sysconfig/iptables
81 %config(noreplace) %{_var}/lib/%{name}/etc/snmp/snmpd.conf
82
83 #-----------------------------------------------------------
84 #This is the RPM install/upgrade/remove directive
85 #-----------------------------------------------------------
86 #before install or upgrade
87 %pre
88
89 #after install or upgrade
90 %post
91 if [ "$1" = 1 ]; then
92  /sbin/chkconfig %{name} on 2>/dev/null || :
93  #extracting HOST root password to be used as container common password
94  /bin/chmod 600 %{_var}/lib/%{name}/etc/shadow
95  /bin/sed 's/#.*//g' /etc/shadow        |  \
96         grep -v '^[[:space:]]*$'        |  \
97         grep root >>  %{_var}/lib/%{name}/etc/shadow
98  #extracting HOST nameserver to be used by container
99  /bin/sed 's/#.*//g' /etc/resolv.conf      \
100         >> %{_var}/lib/%{name}/etc/resolv.conf
101  fi
102
103 #before upgrade or remove
104 %postun
105
106 #after upgrade or remove
107 %preun
108 if [ "$1" = 0 ]; then
109   %{_initrddir}/%{name} stop 2>/dev/null || :
110   /sbin/chkconfig --del %{name} 2>/dev/null || :
111   fi
112
113 #-----------------------------------------------------------
114 #common part
115 #-----------------------------------------------------------
116 %prep
117
118 %setup -q
119
120 %build
121 %{__rm} -rf %{buildroot}
122 %{?_smp_mflags:%define _smp_mflags -j `/usr/bin/getconf _NPROCESSORS_ONLN`}
123 %{__make} -s %{?_smp_mflags} DIST=%{?ddist} prod
124
125 %clean 
126 %{__rm} -rf %{buildroot}
127
128 %install
129 #main install
130 %{__rm} -fr %{buildroot}
131 mkdir -p -m0755 %{buildroot}
132 %{__make} -s install DESTDIR=%{buildroot}
133
134 %changelog
135 * Mon Jan 4 2010 Jean-Marc Pigeon <jmp@safe.ca> 0.71.6-20100104
136 - Bug Fix
137    * In none debug flag, vzgot was not returning echo
138      from called shell
139    * Defining a 'FLINUX' env variable within shell script
140      vzgot.mksrvz to be pass to 'vzgot create' and used by
141      vzgot.fboot to prepare container with the right
142      linux family (RedHat,SUSE,...) structure
143
144 * Sun Jan 3 2010 Jean-Marc Pigeon <jmp@safe.ca> 0.71.3-20100104
145   * First release