diff --git a/modules/upgrade_dist.sh b/modules/upgrade_dist.sh index 814bd20..e5ae058 100644 --- a/modules/upgrade_dist.sh +++ b/modules/upgrade_dist.sh @@ -15,7 +15,7 @@ # * PROXY_SRV_PORT: Working port for general purpose proxy if one declared # ------------------------------------------------------------------------------ -export VER_upgrade_dist="0.2.4" +export VER_upgrade_dist="0.2.5" # As aptitude might fail if clock is too far from real time, we need to depend # on ntp @@ -38,27 +38,27 @@ upgrade_dist() prnt I "Configuring proxy for APT..." if [[ -n $PROXY_APT ]]; then - if [[ ! -d $(dirname $proxyfile) ]]; then - mkdir -pv $(dirname $proxyfile) || ( - prnt E "Impossible to create directory to receive APT configuration." - die 60 - ) - else + if [[ ! -d $(dirname $proxyfile) ]]; then + mkdir -pv "$(dirname $proxyfile)" || ( + prnt E "Impossible to create directory to receive APT configuration." + die 60 + ) + else # Cleanup if [[ -s $proxyfile ]]; then - emptyflie $proxyfile + emptyfile $proxyfile fi - if [[ $(grep "^Acquire::http::Proxy" /etc/apt/apt.conf) ]]; then + if grep -q "^Acquire::http::Proxy" /etc/apt/apt.conf; then sed -i -e "/^Acquire::http::Proxy/d" /etc/apt/apt.conf fi fi tag_file $proxyfile echo "Acquire::http::Proxy \"http://${PROXY_APT}:${PROXY_APT_PORT}\";" >> $proxyfile elif [[ -n $PROXY_SRV ]]; then - tag_file $proxyfile - echo "Acquire::http::Proxy \"http://${PROXY_SRV}:${PROXY_SRV_PORT}\";" >> $proxyfile + tag_file $proxyfile + echo "Acquire::http::Proxy \"http://${PROXY_SRV}:${PROXY_SRV_PORT}\";" >> $proxyfile else - prnt I "No proxy configured, nothing to do." + prnt I "No proxy configured, nothing to do." fi # Remplace source.list from dist with ours (be smarter) @@ -79,16 +79,16 @@ precheck_upgrade_dist() prnt I "Checking network connectivity..." if [[ $(noerror wget -q --tries=10 --timeout=20 --spider http://www.tetaneutral.net) != 0 ]]; then - prnt E "It seems network configuration is not functionnal! Giving up." - die 160 + prnt E "It seems network configuration is not functionnal! Giving up." + die 160 fi 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 + 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 + prnt E "A general proxy server have been specified but not its working port." + die 160 fi file_must_exists pkgman/${SYS_DIST}_${SYS_VER}.list }