diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-09-16 19:20:57 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-09-16 19:20:57 +0200 |
commit | 80088a438e46a1556123722275531499a40b06b2 (patch) | |
tree | e24fac3a6397cae5db32d87c1f19df6aa737d2e6 | |
parent | cbd74112e0ee98461db58ac943daced1b668edb9 (diff) | |
download | slackupgrade-80088a438e46a1556123722275531499a40b06b2.tar.gz slackupgrade-80088a438e46a1556123722275531499a40b06b2.tar.bz2 |
Install all essential packages from the local storage.
Essential packages include glibc-solibs, package utilities and
wget, if installing from the remote archive. They are all downloaded
to the local disk, and then installed from the local copies. This makes
sure the download agent (wget or curl) won't get broken in the process due
to shared library mismatch. After installation wget is selected as the
download agent.
-rw-r--r-- | slackware-upgrade-system | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/slackware-upgrade-system b/slackware-upgrade-system index 45401f6..eb655a6 100644 --- a/slackware-upgrade-system +++ b/slackware-upgrade-system @@ -171,10 +171,10 @@ function download_wget { function dnfunc_init() { if [ -z "$dnfunc" ]; then - if curl --version >/dev/null 2>&1; then - dnfunc=download_curl - elif wget --version >/dev/null 2>&1; then + if wget --version >/dev/null 2>&1; then dnfunc=download_wget + elif curl --version >/dev/null 2>&1; then + dnfunc=download_curl else abend "neither curl nor wget is installed" fi @@ -224,6 +224,18 @@ function dropfile() { fi } +function upgrade_local() { + if [ -n "$dry_run" ]; then + echo "upgradepkg $@" + elif [ "$verbosity" = 'v' ]; then + upgradepkg "$@" | \ + tee -a $logfile | \ + sed -n -e '/^| Upgrading/s/^| //p' + else + upgradepkg "$@" >> $logfile + fi +} + function upgrade_package() { local name=$1 shift @@ -232,11 +244,7 @@ function upgrade_package() { else file=$(getfile $name) if [ -n "$file" ]; then - if [ "$verbosity" = 'v' ]; then - upgradepkg "$@" $file | tee -a $logfile | sed -n -e '/^| Upgrading/s/^| //p' - else - upgradepkg "$@" $file >> $logfile - fi + upgrade_local $@ $file dropfile $file fi fi @@ -446,19 +454,33 @@ if ! getyn n "Ready for upgrade from $VERSION to $newversion. Continue"; then exit 0 fi -# Upgrade the glibc shared libraries. -echo "$0: Upgrading shared libraries" -upgrade_package $(package_file_name glibc-solibs) +pkg_names="glibc-solibs pkgtools tar xz findutils" +if [ -n "$remote" ]; then + # If using the remote repository, add wget and the libraries it + # depends on. Wget is preferred over curl because of its limited + # number of dependencies. + pkg_names="$pkg_names aaa_elflibs wget" +fi +pkg_re='^('$(echo "$pkg_names" | sed -r -e 's/ +/|/g')')$' -# Upgrade the package utilities and related tools. -echo "$0: Upgrading package utilities" -for pkg in pkgtools tar xz findutils +pkg_files= +echo "$0: Downloading essential packages" +for pkg in $pkg_names do - upgrade_package $(package_file_name $pkg) + pkg_files="$pkg_files${pkg_files:+ }"$(getfile $(package_file_name $pkg)) done +echo "$0: Installing essential packages" +upgrade_local $pkg_files + +if [ -n "$remote" ]; then + # Until now we have been using whatever downloader that is available + # (curl or wget). Switch to wget: it has all its dependecies installed. + dnfunc=download_wget +fi + # Upgrade the rest of packages -egrep -v '^(glibc-solibs|pkgtools|tar|xz|findutils)$' candidates |\ +egrep -v "$pkg_re" candidates |\ while read name do package_file_name $name |