1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#!/bin/sh
2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#
3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# Copyright (c) 2009 The Chromium Authors. All rights reserved.
4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# Use of this source code is governed by a BSD-style license that can be
5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# found in the LICENSE file.
6868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#
7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# This script is part of the @@PACKAGE@@ package.
8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#
9868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# It creates the repository configuration file for package updates, and it
10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# monitors that config to see if it has been disabled by the overly aggressive
11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# distro upgrade process (e.g.  intrepid -> jaunty). When this situation is
12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# detected, the respository will be re-enabled. If the respository is disabled
13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# for any other reason, this won't re-enable it.
14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#
15868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# This functionality can be controlled by creating the $DEFAULTS_FILE and
16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# setting "repo_add_once" and/or "repo_reenable_on_distupgrade" to "true" or
17868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# "false" as desired. An empty $DEFAULTS_FILE is the same as setting both values
18868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# to "false".
19868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
20868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)@@include@@apt.include
21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)## MAIN ##
23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)DEFAULTS_FILE="/etc/default/@@PACKAGE@@"
24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)if [ -r "$DEFAULTS_FILE" ]; then
25868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  . "$DEFAULTS_FILE"
26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)fi
27868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
28868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)if [ "$repo_add_once" = "true" ]; then
29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  install_key
30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  create_sources_lists
31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  RES=$?
32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  # Sources creation succeeded, so stop trying.
33868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  if [ $RES -ne 2 ]; then
34868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    sed -i -e 's/[[:space:]]*repo_add_once=.*/repo_add_once="false"/' "$DEFAULTS_FILE"
35868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  fi
36868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)else
37868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  update_bad_sources
38868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)fi
39868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)if [ "$repo_reenable_on_distupgrade" = "true" ]; then
41868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  handle_distro_upgrade
42868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)fi
43