e93f02f1f4519dbadca2fd1812bf6ff2495f998f
[platform/framework/web/crosswalk.git] / src / chrome / tools / test / reference_build / chrome_linux / installer / rpm / chrome.spec.template
1 #------------------------------------------------------------------------------
2 #   chrome.spec
3 #------------------------------------------------------------------------------
4
5 #------------------------------------------------------------------------------
6 #   Prologue information
7 #------------------------------------------------------------------------------
8 Summary         : @@MENUNAME@@
9 License         : Multiple, see @@PRODUCTURL@@
10 Name            : @@PACKAGE@@-@@CHANNEL@@
11 Version         : @@VERSION@@
12 Release         : @@PACKAGE_RELEASE@@
13 Group           : Applications/Internet
14 Vendor          : @@COMPANY_FULLNAME@@
15 Url             : @@PRODUCTURL@@
16 Packager        : @@MAINTNAME@@ <@@MAINTMAIL@@>
17
18 Provides        : @@PROVIDES@@ = %{version}
19 Requires        : @@DEPENDS@@
20 Requires(post)  : %{_sbindir}/update-alternatives
21 Requires(preun) : %{_sbindir}/update-alternatives
22 Autoreqprov     : No
23 Conflicts       : @@REPLACES@@
24
25 BuildRoot       : %{_tmppath}/%{name}-%{version}-root
26
27 # The prefix is pretty important; RPM uses this to figure out
28 # how to make a package relocatable
29 prefix          : /opt
30
31 #------------------------------------------------------------------------------
32 #   Description
33 #------------------------------------------------------------------------------
34 %Description
35 @@SHORTDESC@@
36
37 @@FULLDESC@@
38
39 #------------------------------------------------------------------------------
40 #   Build rule - How to make the package
41 #------------------------------------------------------------------------------
42 %build
43
44 #------------------------------------------------------------------------------
45 #       Installation rule - how to install it (note that it
46 #   gets installed into a temp directory given by $RPM_BUILD_ROOT)
47 #------------------------------------------------------------------------------
48 %install
49 rm -rf "$RPM_BUILD_ROOT"
50
51 if [ -z "@@STAGEDIR@@" -o ! -d "@@STAGEDIR@@" ] ; then
52     echo "@@STAGEDIR@@ appears to be incorrectly set - aborting"
53     exit 1
54 fi
55
56 if [ -z "@@INSTALLDIR@@" -o ! -d "@@STAGEDIR@@/@@INSTALLDIR@@" ] ; then
57     echo "@@INSTALLDIR@@ appears to be incorrectly set - aborting"
58     exit 1
59 fi
60
61 install -m 755 -d \
62   "$RPM_BUILD_ROOT/etc" \
63   "$RPM_BUILD_ROOT/opt" \
64   "$RPM_BUILD_ROOT/usr"
65 # This is hard coded for now
66 cp -a "@@STAGEDIR@@/etc/" "$RPM_BUILD_ROOT/"
67 cp -a "@@STAGEDIR@@/opt/" "$RPM_BUILD_ROOT/"
68 cp -a "@@STAGEDIR@@/usr/" "$RPM_BUILD_ROOT/"
69
70 #------------------------------------------------------------------------------
71 #   Rule to clean up a build
72 #------------------------------------------------------------------------------
73 %clean
74 rm -rf "$RPM_BUILD_ROOT"
75
76 #------------------------------------------------------------------------------
77 #   Files listing.
78 #------------------------------------------------------------------------------
79 %files
80 %defattr(-,root,root)
81 #%doc README
82
83 # We cheat and just let RPM figure it out for us; everything we install
84 # should go under this prefix anyways.
85 @@INSTALLDIR@@
86
87 # Be explicit about the files we scatter throughout the system we don't
88 # accidentally "own" stuff that's not ours (crbug.com/123990).
89 /etc/cron.daily/@@PACKAGE_FILENAME@@
90 %ghost %attr(755,root,root) /usr/bin/google-chrome
91 /usr/bin/@@USR_BIN_SYMLINK_NAME@@
92 /usr/share/applications/@@PACKAGE_FILENAME@@.desktop
93 /usr/share/gnome-control-center/default-apps/@@PACKAGE_FILENAME@@.xml
94 %docdir /usr/share/man/man1
95 /usr/share/man/man1/@@PACKAGE_FILENAME@@.1
96
97 #------------------------------------------------------------------------------
98 #   Pre install script
99 #------------------------------------------------------------------------------
100 %pre
101
102 exit 0
103
104
105
106
107 #------------------------------------------------------------------------------
108 #   Post install script
109 #------------------------------------------------------------------------------
110 %post
111
112 @@include@@../common/postinst.include
113
114 @@include@@../common/rpm.include
115
116 @@include@@../common/symlinks.include
117
118 remove_nss_symlinks
119 add_nss_symlinks
120
121 remove_udev_symlinks
122 add_udev_symlinks
123
124 DEFAULTS_FILE="/etc/default/@@PACKAGE@@"
125 if [ ! -e "$DEFAULTS_FILE" ]; then
126   echo 'repo_add_once="true"' > "$DEFAULTS_FILE"
127 fi
128
129 . "$DEFAULTS_FILE"
130
131 if [ "$repo_add_once" = "true" ]; then
132   determine_rpm_package_manager
133
134   case $PACKAGEMANAGER in
135   "yum")
136     install_yum
137     ;;
138   "urpmi")
139     install_urpmi
140     ;;
141   "yast")
142     install_yast
143     ;;
144   esac
145 fi
146
147 # Some package managers have locks that prevent everything from being
148 # configured at install time, so wait a bit then kick the cron job to do
149 # whatever is left. Probably the db will be unlocked by then, but if not, the
150 # cron job will keep retrying.
151 # Do this with 'at' instead of a backgrounded shell because zypper waits on all
152 # sub-shells to finish before it finishes, which is exactly the opposite of
153 # what we want here. Also preemptively start atd because for some reason it's
154 # not always running, which kind of defeats the purpose of having 'at' as a
155 # required LSB command.
156 service atd start
157 echo "sh /etc/cron.daily/@@PACKAGE@@" | at now + 2 minute > /dev/null 2>&1
158
159 CHANNEL=@@CHANNEL@@
160 case $CHANNEL in
161   stable )
162     PRIORITY=200
163     ;;
164   beta )
165     PRIORITY=150
166     ;;
167   unstable )
168     PRIORITY=120
169     ;;
170   * )
171     PRIORITY=0
172     ;;
173 esac
174
175 %{_sbindir}/update-alternatives --install /usr/bin/google-chrome google-chrome \
176   /usr/bin/@@USR_BIN_SYMLINK_NAME@@ $PRIORITY
177
178 exit 0
179
180
181 #------------------------------------------------------------------------------
182 #   Pre uninstallation script
183 #------------------------------------------------------------------------------
184 %preun
185
186 if [ "$1" -eq "0" ]; then
187   mode="uninstall"
188 elif [ "$1" -eq "1" ]; then
189   mode="upgrade"
190 fi
191
192 @@include@@../common/rpm.include
193
194 @@include@@../common/symlinks.include
195
196 # Only remove menu items and symlinks on uninstall. When upgrading,
197 # old_pkg's %preun runs after new_pkg's %post.
198 if [ "$mode" = "uninstall" ]; then
199 @@include@@../common/prerm.include
200   remove_nss_symlinks
201   remove_udev_symlinks
202
203   %{_sbindir}/update-alternatives --remove google-chrome \
204     /usr/bin/@@USR_BIN_SYMLINK_NAME@@
205 fi
206
207 # On Debian we only remove when we purge. However, RPM has no equivalent to
208 # dpkg --purge, so this is all disabled.
209 #
210 #determine_rpm_package_manager
211 #
212 #case $PACKAGEMANAGER in
213 #"yum")
214 #  remove_yum
215 #  ;;
216 #"urpmi")
217 #  remove_urpmi
218 #  ;;
219 #"yast")
220 #  remove_yast
221 #  ;;
222 #esac
223
224 exit 0
225
226 #------------------------------------------------------------------------------
227 #   Post uninstallation script
228 #------------------------------------------------------------------------------
229 %postun
230
231 exit 0