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)
74e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)set -e
84e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
9868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)@@include@@../common/postinst.include
10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# Add to the alternatives system
12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#
13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# On Ubuntu 12.04, we have the following priorities
14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# (which can be obtain be installing browsers and running
15868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# update-alternatives --query x-www-browser):
16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#
17868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# /usr/bin/epiphany-browser  85
18868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# /usr/bin/firefox           40
19868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# /usr/bin/konqueror         30
20868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#
21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# While we would expect these values to be keyed off the most popular
22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# browser (Firefox), in practice, we treat Epiphany as the lower bound,
23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# resulting in the following scheme:
24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
25868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)CHANNEL=@@CHANNEL@@
26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)case $CHANNEL in
27868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  stable )
28868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    # Good enough to be the default.
29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    PRIORITY=200
30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    ;;
31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  beta )
32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    # Almost good enough to be the default. (Firefox stable should arguably be
33868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    # higher than this, but since that's below the "Epiphany threshold", we're
34868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    # not setting our priority below it. Anyone want to poke Firefox to raise
35868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    # their priority?)
36868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    PRIORITY=150
37868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    ;;
38868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  unstable )
39868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    # Unstable, give it the "lowest" priority.
40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    PRIORITY=120
41868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    ;;
42868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  * )
43868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    PRIORITY=0
44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    ;;
45868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)esac
46868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
47868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)update-alternatives --install /usr/bin/x-www-browser x-www-browser \
484e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  /usr/bin/@@USR_BIN_SYMLINK_NAME@@ $PRIORITY
49868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)update-alternatives --install /usr/bin/gnome-www-browser gnome-www-browser \
504e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  /usr/bin/@@USR_BIN_SYMLINK_NAME@@ $PRIORITY
514e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
524e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)update-alternatives --install /usr/bin/google-chrome google-chrome \
534e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  /usr/bin/@@USR_BIN_SYMLINK_NAME@@ $PRIORITY
54868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
55868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)@@include@@../common/apt.include
56868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
57868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)@@include@@../common/symlinks.include
58868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
59868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)remove_udev_symlinks
60868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)add_udev_symlinks
61868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
62868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)## MAIN ##
63868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)if [ ! -e "$DEFAULTS_FILE" ]; then
64868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  echo 'repo_add_once="true"' > "$DEFAULTS_FILE"
65868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  echo 'repo_reenable_on_distupgrade="true"' >> "$DEFAULTS_FILE"
66868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)fi
67868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
68868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# Run the cron job immediately to perform repository configuration.
69868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)nohup sh /etc/cron.daily/@@PACKAGE@@ > /dev/null 2>&1 &
70