#------------------------------------------------------------------------------ # 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@@ Requires(post) : %{_sbindir}/update-alternatives Requires(preun) : %{_sbindir}/update-alternatives 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@@ %ghost %attr(755,root,root) /usr/bin/google-chrome /usr/bin/@@USR_BIN_SYMLINK_NAME@@ /usr/share/applications/@@PACKAGE_FILENAME@@.desktop /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 CHANNEL=@@CHANNEL@@ case $CHANNEL in stable ) PRIORITY=200 ;; beta ) PRIORITY=150 ;; unstable ) PRIORITY=120 ;; * ) PRIORITY=0 ;; esac %{_sbindir}/update-alternatives --install /usr/bin/google-chrome google-chrome \ /usr/bin/@@USR_BIN_SYMLINK_NAME@@ $PRIORITY 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 %{_sbindir}/update-alternatives --remove google-chrome \ /usr/bin/@@USR_BIN_SYMLINK_NAME@@ 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