Home | History | Annotate | Download | only in debian
      1 #!/bin/bash
      2 
      3 # Copyright 2013 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 set -e
      8 
      9 if [ "$1" = "purge" ]; then
     10   delgroup --quiet chrome-remote-desktop > /dev/null || true
     11 fi
     12 
     13 APT_CONFIG="`which apt-config 2> /dev/null`"
     14 
     15 apt_config_val() {
     16   APTVAR="$1"
     17   if [ -x "$APT_CONFIG" ]; then
     18     "$APT_CONFIG" dump | sed -e "/^$APTVAR /"'!d' -e "s/^$APTVAR \"\(.*\)\".*/\1/"
     19   fi
     20 }
     21 
     22 # Only remove the defaults file if it is not empty. An empty file was probably
     23 # put there by the sysadmin to disable automatic repository configuration, as
     24 # per the instructions on the package download page.
     25 DEFAULTS_FILE="/etc/default/chrome-remote-desktop"
     26 if [ -s "$DEFAULTS_FILE" ]; then
     27   # Make sure the package defaults are removed before the repository config,
     28   # otherwise it could result in the repository config being removed, but the
     29   # package defaults remain and are set to not recreate the repository config.
     30   # In that case, future installs won't recreate it and won't get auto-updated.
     31   rm "$DEFAULTS_FILE" || exit 1
     32 fi
     33 # Remove Google repository added by the package.
     34 APTDIR=$(apt_config_val Dir)
     35 APTETC=$(apt_config_val 'Dir::Etc')
     36 APT_SOURCESDIR="$APTDIR$APTETC$(apt_config_val 'Dir::Etc::sourceparts')"
     37 rm -f "$APT_SOURCESDIR/chrome-remote-desktop.list"
     38 
     39 #DEBHELPER#
     40