| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 set -e | 7 set -e |
| 8 | 8 |
| 9 if [ "$1" = "purge" ]; then | 9 if [ "$1" = "purge" ]; then |
| 10 delgroup --quiet chrome-remote-desktop > /dev/null || true | 10 delgroup --quiet chrome-remote-desktop > /dev/null || true |
| 11 fi | 11 fi |
| 12 | 12 |
| 13 APT_CONFIG="`which apt-config 2> /dev/null`" | 13 APT_CONFIG="`which apt-config 2> /dev/null`" |
| 14 | 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 | 15 # 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 | 16 # put there by the sysadmin to disable automatic repository configuration, as |
| 24 # per the instructions on the package download page. | 17 # per the instructions on the package download page. |
| 25 DEFAULTS_FILE="/etc/default/chrome-remote-desktop" | 18 DEFAULTS_FILE="/etc/default/chrome-remote-desktop" |
| 26 if [ -s "$DEFAULTS_FILE" ]; then | 19 if [ -s "$DEFAULTS_FILE" ]; then |
| 27 # Make sure the package defaults are removed before the repository config, | 20 # Make sure the package defaults are removed before the repository config, |
| 28 # otherwise it could result in the repository config being removed, but the | 21 # 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. | 22 # 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. | 23 # In that case, future installs won't recreate it and won't get auto-updated. |
| 31 rm "$DEFAULTS_FILE" || exit 1 | 24 rm "$DEFAULTS_FILE" || exit 1 |
| 32 fi | 25 fi |
| 33 # Remove Google repository added by the package. | 26 # Remove Google repository added by the package. |
| 34 APTDIR=$(apt_config_val Dir) | 27 if [ -x "$APT_CONFIG" ]; then |
| 35 APTETC=$(apt_config_val 'Dir::Etc') | 28 eval $("$APT_CONFIG" shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d') |
| 36 APT_SOURCESDIR="$APTDIR$APTETC$(apt_config_val 'Dir::Etc::sourceparts')" | 29 rm -f "${APT_SOURCESDIR}chrome-remote-desktop.list" |
| 37 rm -f "$APT_SOURCESDIR/chrome-remote-desktop.list" | 30 fi |
| 38 | 31 |
| 39 #DEBHELPER# | 32 #DEBHELPER# |
| OLD | NEW |