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, and it
     10 # monitors that config to see if it has been disabled by the overly aggressive
     11 # distro upgrade process (e.g.  intrepid -> jaunty). When this situation is
     12 # detected, the respository will be re-enabled. If the respository is disabled
     13 # for any other reason, this won't re-enable it.
     14 #
     15 # This functionality can be controlled by creating the $DEFAULTS_FILE and
     16 # setting "repo_add_once" and/or "repo_reenable_on_distupgrade" to "true" or
     17 # "false" as desired. An empty $DEFAULTS_FILE is the same as setting both values
     18 # to "false".
     19 
     20 @@include@@apt.include
     21 
     22 ## MAIN ##
     23 DEFAULTS_FILE="/etc/default/@@PACKAGE@@"
     24 if [ -r "$DEFAULTS_FILE" ]; then
     25   . "$DEFAULTS_FILE"
     26 fi
     27 
     28 if [ "$repo_add_once" = "true" ]; then
     29   install_key
     30   create_sources_lists
     31   RES=$?
     32   # Sources creation succeeded, so stop trying.
     33   if [ $RES -ne 2 ]; then
     34     sed -i -e 's/[[:space:]]*repo_add_once=.*/repo_add_once="false"/' "$DEFAULTS_FILE"
     35   fi
     36 else
     37   update_bad_sources
     38 fi
     39 
     40 if [ "$repo_reenable_on_distupgrade" = "true" ]; then
     41   handle_distro_upgrade
     42 fi
     43