| OLD | NEW |
| 1 @@include@@variables.include | 1 @@include@@variables.include |
| 2 | 2 |
| 3 APT_GET="`which apt-get 2> /dev/null`" | 3 APT_GET="`which apt-get 2> /dev/null`" |
| 4 APT_CONFIG="`which apt-config 2> /dev/null`" | 4 APT_CONFIG="`which apt-config 2> /dev/null`" |
| 5 | 5 |
| 6 SOURCES_PREAMBLE="### THIS FILE IS AUTOMATICALLY CONFIGURED ### | 6 SOURCES_PREAMBLE="### THIS FILE IS AUTOMATICALLY CONFIGURED ### |
| 7 # You may comment out this entry, but any other modifications may be lost.\n" | 7 # You may comment out this entry, but any other modifications may be lost.\n" |
| 8 | 8 |
| 9 # Parse apt configuration and return requested variable value. | 9 # Parse apt configuration and return requested variable value. |
| 10 apt_config_val() { | 10 apt_config_val() { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 # Don't do anything if the file isn't there, since that probably means the | 80 # Don't do anything if the file isn't there, since that probably means the |
| 81 # user disabled it. | 81 # user disabled it. |
| 82 if [ ! -r "$SOURCELIST" ]; then | 82 if [ ! -r "$SOURCELIST" ]; then |
| 83 return 0 | 83 return 0 |
| 84 fi | 84 fi |
| 85 | 85 |
| 86 # Basic check for active configurations (non-blank, non-comment lines). | 86 # Basic check for active configurations (non-blank, non-comment lines). |
| 87 ACTIVECONFIGS=$(grep -v "^[[:space:]]*\(#.*\)\?$" "$SOURCELIST" 2>/dev/null) | 87 ACTIVECONFIGS=$(grep -v "^[[:space:]]*\(#.*\)\?$" "$SOURCELIST" 2>/dev/null) |
| 88 | 88 |
| 89 # Check if the correct repository configuration is in there. | 89 # Check if the correct repository configuration is in there. |
| 90 REPOMATCH=$(grep -E "^[[:space:]#]*\b($REPOCONFIG|$SSLREPOCONFIG)\b" "$SOURCEL
IST" \ | 90 REPOMATCH=$(grep -E "^[[:space:]#]*\b$REPOCONFIGREGEX\b" "$SOURCELIST" \ |
| 91 2>/dev/null) | 91 2>/dev/null) |
| 92 | 92 |
| 93 # Check if the correct repository is disabled. | 93 # Check if the correct repository is disabled. |
| 94 MATCH_DISABLED=$(echo "$REPOMATCH" | grep "^[[:space:]]*#" 2>/dev/null) | 94 MATCH_DISABLED=$(echo "$REPOMATCH" | grep "^[[:space:]]*#" 2>/dev/null) |
| 95 | 95 |
| 96 # Now figure out if we need to fix things. | 96 # Now figure out if we need to fix things. |
| 97 BADCONFIG=1 | 97 BADCONFIG=1 |
| 98 if [ "$REPOMATCH" ]; then | 98 if [ "$REPOMATCH" ]; then |
| 99 # If it's there and active, that's ideal, so nothing to do. | 99 # If it's there and active, that's ideal, so nothing to do. |
| 100 if [ ! "$MATCH_DISABLED" ]; then | 100 if [ ! "$MATCH_DISABLED" ]; then |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 # Detect if the repo config was disabled by distro upgrade and enable if | 167 # Detect if the repo config was disabled by distro upgrade and enable if |
| 168 # necessary. | 168 # necessary. |
| 169 handle_distro_upgrade() { | 169 handle_distro_upgrade() { |
| 170 if [ ! "$REPOCONFIG" ]; then | 170 if [ ! "$REPOCONFIG" ]; then |
| 171 return 0 | 171 return 0 |
| 172 fi | 172 fi |
| 173 | 173 |
| 174 find_apt_sources | 174 find_apt_sources |
| 175 SOURCELIST="$APT_SOURCESDIR/@@PACKAGE@@.list" | 175 SOURCELIST="$APT_SOURCESDIR/@@PACKAGE@@.list" |
| 176 if [ -r "$SOURCELIST" ]; then | 176 if [ -r "$SOURCELIST" ]; then |
| 177 REPOLINE=$(grep -E "^[[:space:]]*#[[:space:]]*($REPOCONFIG|$SSLREPOCONFIG)[[
:space:]]*# disabled on upgrade to .*" "$SOURCELIST") | 177 REPOLINE=$(grep -E "^[[:space:]]*#[[:space:]]*$REPOCONFIGREGEX[[:space:]]*#
disabled on upgrade to .*" "$SOURCELIST") |
| 178 if [ $? -eq 0 ]; then | 178 if [ $? -eq 0 ]; then |
| 179 sed -i -e "s,^[[:space:]]*#[[:space:]]*\($REPOCONFIG\|$SSLREPOCONFIG\)[[:s
pace:]]*# disabled on upgrade to .*,\1," \ | 179 sed -i -e "s,^[[:space:]]*#[[:space:]]*\(.*\)[[:space:]]*# disabled on upg
rade to .*,\1," \ |
| 180 "$SOURCELIST" | 180 "$SOURCELIST" |
| 181 LOGGER=$(which logger 2> /dev/null) | 181 LOGGER=$(which logger 2> /dev/null) |
| 182 if [ "$LOGGER" ]; then | 182 if [ "$LOGGER" ]; then |
| 183 "$LOGGER" -t "$0" "Reverted repository modification: $REPOLINE." | 183 "$LOGGER" -t "$0" "Reverted repository modification: $REPOLINE." |
| 184 fi | 184 fi |
| 185 fi | 185 fi |
| 186 fi | 186 fi |
| 187 } | 187 } |
| 188 | 188 |
| 189 DEFAULT_ARCH="@@ARCHITECTURE@@" | 189 DEFAULT_ARCH="@@ARCHITECTURE@@" |
| 190 | 190 |
| 191 get_lib_dir() { | 191 get_lib_dir() { |
| 192 if [ "$DEFAULT_ARCH" = "i386" ]; then | 192 if [ "$DEFAULT_ARCH" = "i386" ]; then |
| 193 LIBDIR=lib/i386-linux-gnu | 193 LIBDIR=lib/i386-linux-gnu |
| 194 elif [ "$DEFAULT_ARCH" = "amd64" ]; then | 194 elif [ "$DEFAULT_ARCH" = "amd64" ]; then |
| 195 LIBDIR=lib/x86_64-linux-gnu | 195 LIBDIR=lib/x86_64-linux-gnu |
| 196 else | 196 else |
| 197 echo Unknown CPU Architecture: "$DEFAULT_ARCH" | 197 echo Unknown CPU Architecture: "$DEFAULT_ARCH" |
| 198 exit 1 | 198 exit 1 |
| 199 fi | 199 fi |
| 200 } | 200 } |
| OLD | NEW |