Skip to content

Commit

Permalink
S3-2359 avoid force-yes with newer version of apt-get (heroku#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Taschik committed Oct 6, 2023
1 parent 5918ae9 commit 1d3025b
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 @@ -68,7 +75,7 @@ for PACKAGE in $(cat $BUILD_DIR/Aptfile | grep -v -s -e "^:repo:"); do
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 1d3025b

Please sign in to comment.