some readability improvements

This commit is contained in:
2021-12-06 17:06:49 +01:00
parent 239d9972a5
commit 056a6142bd
6 changed files with 82 additions and 29 deletions

View File

@@ -9,11 +9,13 @@
# https://opensource.org/licenses/BSD-3-Clause
# ------------------------------------------------------------------------------
# Variable:
# * PROXYAPT: Proxy to use with APT (eg. APT Cacher)
# * PROXYAPTPORT: Working port for APT proxy
# * PROXY_APT: Proxy to use with APT (eg. APT Cacher), optionnal
# * PROXY_APT_PORT: Working port for APT proxy if one declared
# * PROXY_SRV: General purpose proxy if PROXY_APT is undefined
# * PROXY_SRV_PORT: Working port for general purpose proxy if one declared
# ------------------------------------------------------------------------------
export VER_upgrade_dist="0.2.0"
export VER_upgrade_dist="0.2.1"
# As aptitude might fail if clock is too far from real time, we need to depend
# on ntp
@@ -27,12 +29,13 @@ upgrade_dist()
# We backup entire apt dir as future version will normalise source.list files
backupdist /etc/apt
prnt I "Basic apt configuration..."
echo 'APT::Install-Recommends "false";' > $norecommends
echo "# Generated automatically on $(stdtime) by $0" > $norecommend
echo 'APT::Install-Recommends "false";' >> $norecommends
echo 'APT::AutoRemove::RecommendsImportant "false";' >> $norecommends
echo 'APT::AutoRemove::SuggestsImportant "false";' >> $norecommends
prnt I "Configuring proxy for APT..."
if [[ -n $PROXYAPT ]]; then
if [[ -n $PROXY_APT ]]; then
if [[ ! -d $(dirname $proxyfile) ]]; then
mkdir -pv $(dirname $proxyfile) || (
prnt E "Impossible to create directory to receive APT configuration."
@@ -40,10 +43,10 @@ upgrade_dist()
)
fi
echo "# Generated automatically on $(stdtime) by $0" > $proxyfile
echo "Acquire::http::Proxy \"http://${PROXYAPT}:${PROXYAPT_PORT}\";" >> $proxyfile
echo "Acquire::http::Proxy \"http://${PROXY_APT}:${PROXY_APT_PORT}\";" >> $proxyfile
elif [[ -n $http_proxy ]]; then
echo "# Generated automatically on $(stdtime) by $0" > $proxyfile
echo "Acquire::http::Proxy \"http://${http_proxy}\";" >> $proxyfile
echo "Acquire::http::Proxy \"http://${PROXY_SRV}:${PROXY_SRV_PORT}\";" >> $proxyfile
else
prnt I "No proxy configured, nothing to do."
fi
@@ -69,8 +72,12 @@ precheck_upgrade_dist()
prnt E "It seems network configuration is not functionnal! Giving up."
die 160
fi
if [[ -n $PROXYAPT && -z $PROXYAPT_PORT ]]; then
prnt E "A proxy server have been specified but not its working port."
if [[ -n $PROXY_APT && -z $PROXY_APT_PORT ]]; then
prnt E "An APT proxy server have been specified but not its working port."
die 160
fi
if [[ -n $PROXY_SRV && -z $PROXY_SRV_PORT ]]; then
prnt E "A general proxy server have been specified but not its working port."
die 160
fi
file_exists pkgman/${SYS_DIST}_${SYS_VER}.list