Skip to content

Commit

Permalink
avoid force-yes with newer version of apt-get (#51)
Browse files Browse the repository at this point in the history
force-yes was deprecated with 1.1, and split up into three new options.
Keep the same behavior by enabling all 3 options when a newer version is
detected.

This should fix errors at install time, which are tripping up the
current tests.

Fixes #16.
  • Loading branch information
imirkin authored and edmorley committed Sep 6, 2019
1 parent 3a59ddc commit cae2549
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ APT_SOURCELIST_DIR="$CACHE_DIR/apt/sources" # place custom sources.list here

APT_SOURCES="$APT_SOURCELIST_DIR/sources.list"

APT_VERSION=$(apt-get -v | awk 'NR == 1{ print $2 }')

case "$APT_VERSION" in
0* | 1.0*) APT_FORCE_YES="--force-yes";;
*) APT_FORCE_YES="--allow-downgrades --allow-remove-essential --allow-change-held-packages";;
esac

if [ -f $APT_CACHE_DIR/Aptfile ] && cmp -s $BUILD_DIR/Aptfile $APT_CACHE_DIR/Aptfile ; then
# Old Aptfile is the same as new
topic "Reusing cache"
Expand Down Expand Up @@ -69,7 +76,7 @@ for PACKAGE in $(cat $BUILD_DIR/Aptfile | grep -v -s -e '^#' | grep -v -s -e "^:
curl -s -L -z $PACKAGE_FILE -o $PACKAGE_FILE $PACKAGE 2>&1 | indent
else
topic "Fetching .debs for $PACKAGE"
apt-get $APT_OPTIONS -y --force-yes -d install --reinstall $PACKAGE | indent
apt-get $APT_OPTIONS -y $APT_FORCE_YES -d install --reinstall $PACKAGE | indent
fi
done

Expand Down

0 comments on commit cae2549

Please sign in to comment.