Home | History | Annotate | Download | only in common
      1 #!/bin/sh
      2 #
      3 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
      4 # Use of this source code is governed by a BSD-style license that can be
      5 # found in the LICENSE file.
      6 #
      7 # This script is part of the @@PACKAGE@@ package.
      8 #
      9 # It creates the repository configuration file for package updates, since
     10 # we cannot do this during the @@PACKAGE@@ installation since the repository
     11 # is locked.
     12 #
     13 # This functionality can be controlled by creating the $DEFAULTS_FILE and
     14 # setting "repo_add_once" to "true" or "false" as desired. An empty
     15 # $DEFAULTS_FILE is the same as setting the value to "false".
     16 
     17 @@include@@rpm.include
     18 
     19 ## MAIN ##
     20 DEFAULTS_FILE="/etc/default/@@PACKAGE@@"
     21 if [ -r "$DEFAULTS_FILE" ]; then
     22   . "$DEFAULTS_FILE"
     23 fi
     24 
     25 if [ "$repo_add_once" = "true" ]; then
     26   determine_rpm_package_manager
     27 
     28   # The initial install happens in the post-install scripts, but there have been
     29   # reports of configuration problems, so just verify that everything looks
     30   # good, and if not, try to install again.
     31   verify_install $PACKAGEMANAGER
     32   if [ $? -ne 0 ]; then
     33     install_${PACKAGEMANAGER}
     34   fi
     35 
     36   # Now do any extra configuration that couldn't be done by post-install.
     37   case $PACKAGEMANAGER in
     38   "urpmi")
     39     # We need to configure urpmi after the install has finished.
     40     # See configure_urpmi() for details.
     41     configure_urpmi
     42     ;;
     43   "yast")
     44     # It looks as though yast/zypper has a lock on the RPM DB during
     45     # postinstall, so we cannot add the signing key with install_rpm_key().
     46     # Instead, we attempt to do this here. If the user attempt to update before
     47     # the cron job imports the key, Yast will grab the key from our server and
     48     # prompt the user to accept the key.
     49     install_rpm_key
     50     ;;
     51   esac
     52 
     53   if [ $? -eq 0 ]; then
     54     # Before we quit auto-configuration, check that everything looks sane, since
     55     # part of this happened during package install and we don't have the return
     56     # value of that process.
     57     verify_install $PACKAGEMANAGER
     58     if [ $? -eq 0 ]; then
     59       sed -i -e 's/[[:space:]]*repo_add_once=.*/repo_add_once="false"/' \
     60         "$DEFAULTS_FILE"
     61     fi
     62   fi
     63 else
     64   update_bad_repo
     65 fi
     66