Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions apt-fast
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ msg(){
fi
}

# Stores fullpath of real "apt-get"
real_APT="/usr/bin/apt-get"

# Search for known options and decide if root privileges are needed.
root=1 # default value: we need root privileges
option=
Expand Down Expand Up @@ -118,7 +121,8 @@ LCK_FD=99

# Set default package manager, APT cache, temporary download dir,
# temporary download list file, and maximal parallel downloads
_APTMGR='apt-get'
_APTMGR="${real_APT}"

eval "$(apt-config shell APTCACHE Dir::Cache::archives/d)"
# Check if APT config option Dir::Cache::archives::apt-fast-partial is set.
eval "$(apt-config shell apt_fast_partial Dir::Cache::archives::apt-fast-partial/d)"
Expand Down Expand Up @@ -168,6 +172,12 @@ for Prefix in /usr/local/etc /etc; do
fi
done

# Check if "${real_APT}" exists
if [ '!' -x "${real_APT}" ]; then
msg "We use ${real_APT} in case ${_APTMGR} doesn't work, but it doesn't exist!" 'warning'
exit 1
fi

# no proxy as default
ftp_proxy=
http_proxy=
Expand Down Expand Up @@ -321,10 +331,11 @@ get_uris(){
# Add header to overwrite file.
echo "# apt-fast mirror list: $(date)" > "$DLLIST"
# NOTE: "aptitude" doesn't have this functionality
# so we use "${_APTMGR}" to get package URI's
# so we use either "${_APTMGR}" or "${real_APT}"
# to get package URI's
case "$(basename "${_APTMGR}")" in
'apt'|'apt-get') uri_mgr="${_APTMGR}";;
*) uri_mgr='apt-get';;
*) uri_mgr="${real_APT}";;
esac
uris_full="$("$uri_mgr" "${APT_SCRIPT_WARNING[@]}" -y --print-uris "$@")"
CLEANUP_STATE="$?"
Expand Down