summaryrefslogtreecommitdiffstats
path: root/chrome/installer/linux/rpm/chrome.spec.template
blob: c4fc91c03b1296c907a29b52bff554606bff5ea6 (plain)
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#------------------------------------------------------------------------------
#   chrome.spec
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
#   Prologue information
#------------------------------------------------------------------------------
Summary         : @@MENUNAME@@
License         : Multiple, see @@PRODUCTURL@@
Name            : @@PACKAGE@@-@@CHANNEL@@
Version         : @@VERSION@@
Release         : @@PACKAGE_RELEASE@@
Group           : Applications/Internet
Vendor          : @@COMPANY_FULLNAME@@
Url             : @@PRODUCTURL@@
Packager        : @@MAINTNAME@@ <@@MAINTMAIL@@>

Provides        : @@PROVIDES@@ = %{version}
Requires        : @@DEPENDS@@
Autoreqprov     : No
Conflicts       : @@REPLACES@@

BuildRoot       : %{_tmppath}/%{name}-%{version}-root

# The prefix is pretty important; RPM uses this to figure out
# how to make a package relocatable
prefix          : /opt

#------------------------------------------------------------------------------
#   Description
#------------------------------------------------------------------------------
%Description
@@SHORTDESC@@

@@FULLDESC@@

#------------------------------------------------------------------------------
#   Build rule - How to make the package
#------------------------------------------------------------------------------
%build

#------------------------------------------------------------------------------
#       Installation rule - how to install it (note that it
#   gets installed into a temp directory given by $RPM_BUILD_ROOT)
#------------------------------------------------------------------------------
%install
rm -rf "$RPM_BUILD_ROOT"

if [ -z "@@STAGEDIR@@" -o ! -d "@@STAGEDIR@@" ] ; then
    echo "@@STAGEDIR@@ appears to be incorrectly set - aborting"
    exit 1
fi

if [ -z "@@INSTALLDIR@@" -o ! -d "@@STAGEDIR@@/@@INSTALLDIR@@" ] ; then
    echo "@@INSTALLDIR@@ appears to be incorrectly set - aborting"
    exit 1
fi

install -m 755 -d \
  "$RPM_BUILD_ROOT/etc" \
  "$RPM_BUILD_ROOT/opt" \
  "$RPM_BUILD_ROOT/usr"
# This is hard coded for now
cp -a "@@STAGEDIR@@/etc/" "$RPM_BUILD_ROOT/"
cp -a "@@STAGEDIR@@/opt/" "$RPM_BUILD_ROOT/"
cp -a "@@STAGEDIR@@/usr/" "$RPM_BUILD_ROOT/"

#------------------------------------------------------------------------------
#   Rule to clean up a build
#------------------------------------------------------------------------------
%clean
rm -rf "$RPM_BUILD_ROOT"

#------------------------------------------------------------------------------
#   Files listing.
#------------------------------------------------------------------------------
%files
%defattr(-,root,root)
#%doc README

# We cheat and just let RPM figure it out for us; everything we install
# should go under this prefix anyways.
@@INSTALLDIR@@

# Be explicit about the files we scatter throughout the system we don't
# accidentally "own" stuff that's not ours (crbug.com/123990).
/etc/cron.daily/@@PACKAGE_FILENAME@@
/usr/bin/@@PACKAGE_FILENAME@@
/usr/share/gnome-control-center/default-apps/@@PACKAGE_FILENAME@@.xml
%docdir /usr/share/man/man1
/usr/share/man/man1/@@PACKAGE_FILENAME@@.1

#------------------------------------------------------------------------------
#   Pre install script
#------------------------------------------------------------------------------
%pre

exit 0




#------------------------------------------------------------------------------
#   Post install script
#------------------------------------------------------------------------------
%post

@@include@@../common/postinst.include

@@include@@../common/rpm.include

@@include@@../common/symlinks.include

remove_nss_symlinks
add_nss_symlinks

remove_udev_symlinks
add_udev_symlinks

DEFAULTS_FILE="/etc/default/@@PACKAGE@@"
if [ ! -e "$DEFAULTS_FILE" ]; then
  echo 'repo_add_once="true"' > "$DEFAULTS_FILE"
fi

. "$DEFAULTS_FILE"

if [ "$repo_add_once" = "true" ]; then
  determine_rpm_package_manager

  case $PACKAGEMANAGER in
  "yum")
    install_yum
    ;;
  "urpmi")
    install_urpmi
    ;;
  "yast")
    install_yast
    ;;
  esac
fi

# Some package managers have locks that prevent everything from being
# configured at install time, so wait a bit then kick the cron job to do
# whatever is left. Probably the db will be unlocked by then, but if not, the
# cron job will keep retrying.
# Do this with 'at' instead of a backgrounded shell because zypper waits on all
# sub-shells to finish before it finishes, which is exactly the opposite of
# what we want here. Also preemptively start atd because for some reason it's
# not always running, which kind of defeats the purpose of having 'at' as a
# required LSB command.
service atd start
echo "sh /etc/cron.daily/@@PACKAGE@@" | at now + 2 minute > /dev/null 2>&1
exit 0


#------------------------------------------------------------------------------
#   Pre uninstallation script
#------------------------------------------------------------------------------
%preun

if [ "$1" -eq "0" ]; then
  mode="uninstall"
elif [ "$1" -eq "1" ]; then
  mode="upgrade"
fi

@@include@@../common/rpm.include

@@include@@../common/symlinks.include

# Only remove menu items and symlinks on uninstall. When upgrading,
# old_pkg's %preun runs after new_pkg's %post.
if [ "$mode" = "uninstall" ]; then
@@include@@../common/prerm.include
  remove_nss_symlinks
  remove_udev_symlinks
fi

# On Debian we only remove when we purge. However, RPM has no equivalent to
# dpkg --purge, so this is all disabled.
#
#determine_rpm_package_manager
#
#case $PACKAGEMANAGER in
#"yum")
#  remove_yum
#  ;;
#"urpmi")
#  remove_urpmi
#  ;;
#"yast")
#  remove_yast
#  ;;
#esac

exit 0

#------------------------------------------------------------------------------
#   Post uninstallation script
#------------------------------------------------------------------------------
%postun

exit 0