aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2020-02-07 12:16:48 +0100
committerSergey Poznyakoff <gray@gnu.org.ua>2020-02-07 12:16:48 +0100
commitbed14b11e3d3070b92bb66203ae42d9e31393299 (patch)
tree81207427dca441f10e72fb42581611ae00336fe4
parent507ae64c3e886b82435cbc963594ed5e2af3458f (diff)
downloadslackupgrade-bed14b11e3d3070b92bb66203ae42d9e31393299.tar.gz
slackupgrade-bed14b11e3d3070b92bb66203ae42d9e31393299.tar.bz2
Make mirror URL configurable via the environment.
-rw-r--r--slackupgrade6
-rw-r--r--slackupgrade.84
2 files changed, 7 insertions, 3 deletions
diff --git a/slackupgrade b/slackupgrade
index ff4d46f..ada387b 100644
--- a/slackupgrade
+++ b/slackupgrade
@@ -18,12 +18,13 @@
18 18
19set -e 19set -e
20 20
21# Configuration directory 21# Configuration directory
22: ${SLACKUPGRADE_CONFDIR:=/etc/slackupgrade} 22: ${SLACKUPGRADE_CONFDIR:=/etc/slackupgrade}
23: ${SLACKUPGRADE_PKGDIR:=/var/slackupgrade} 23: ${SLACKUPGRADE_PKGDIR:=/var/slackupgrade}
24: ${SLACKUPGRADE_MIRRORS_URL:=https://mirrors.slackware.com/slackware}
24# Slackware root directory 25# Slackware root directory
25rooturl= 26rooturl=
26# Log file name 27# Log file name
27logfile= 28logfile=
28# 'y', if dry-run mode is requested 29# 'y', if dry-run mode is requested
29dry_run= 30dry_run=
@@ -458,27 +459,26 @@ if [ ! -d $SLACKUPGRADE_PKGDIR ]; then
458 mkdir -p $SLACKUPGRADE_PKGDIR || abend "can't create $SLACKUPGRADE_PKGDIR" 459 mkdir -p $SLACKUPGRADE_PKGDIR || abend "can't create $SLACKUPGRADE_PKGDIR"
459fi 460fi
460 461
461tempdir_create 462tempdir_create
462cd $tempdir 463cd $tempdir
463 464
464mirrors_url=https://mirrors.slackware.com/slackware
465if [ -z "$rooturl" ]; then 465if [ -z "$rooturl" ]; then
466 dnfunc_init 466 dnfunc_init
467 if ! $dnfunc index.html $mirrors_url; then 467 if ! $dnfunc index.html $SLACKUPGRADE_MIRRORS_URL; then
468 abend "exiting" 468 abend "exiting"
469 exit 1 469 exit 1
470 fi 470 fi
471 version_rx=$(echo $VERSION | sed -e 's/\./\\./g') 471 version_rx=$(echo $VERSION | sed -e 's/\./\\./g')
472 new_version=$(cat index.html |\ 472 new_version=$(cat index.html |\
473 tr '<' '\n' |\ 473 tr '<' '\n' |\
474 sed -n -r \ 474 sed -n -r \
475 -e 's/.*^a href="slackware'$ARCH'-([[:digit:].]+)\/?".*/\1/p'|\ 475 -e 's/.*^a href="slackware'$ARCH'-([[:digit:].]+)\/?".*/\1/p'|\
476 sed -n -e "/$version_rx/{" -en -ep -e '}' ) 476 sed -n -e "/$version_rx/{" -en -ep -e '}' )
477 if [ -n "$new_version" ]; then 477 if [ -n "$new_version" ]; then
478 rooturl="$mirrors_url/slackware$ARCH-$new_version" 478 rooturl="$SLACKUPGRADE_MIRRORS_URL/slackware$ARCH-$new_version"
479 info "using $rooturl as distribution top-level URL" 479 info "using $rooturl as distribution top-level URL"
480 else 480 else
481 abend "can't find distribution newer than $VERSION; please supply URL if you have any" 481 abend "can't find distribution newer than $VERSION; please supply URL if you have any"
482 fi 482 fi
483fi 483fi
484 484
diff --git a/slackupgrade.8 b/slackupgrade.8
index d58b0e7..ef15eb9 100644
--- a/slackupgrade.8
+++ b/slackupgrade.8
@@ -316,12 +316,16 @@ replacement maps are stored. The default is
316.TP 316.TP
317.B SLACKUPGRADE_PKGDIR 317.B SLACKUPGRADE_PKGDIR
318Location of the \fBslackupgrade\fR package spool directory. This is 318Location of the \fBslackupgrade\fR package spool directory. This is
319the temporary storage for downloaded package tarballs. The default is 319the temporary storage for downloaded package tarballs. The default is
320.BR /var/slackupgrade . 320.BR /var/slackupgrade .
321.TP 321.TP
322.B SLACKUPGRADE_MIRRORS_URL
323URL of the Slackware mirros site. The default is
324.BR https://mirrors.slackware.com/slackware .
325.TP
322.B TMP 326.B TMP
323Location of the temporary directory. The default is 327Location of the temporary directory. The default is
324.BR /tmp . 328.BR /tmp .
325.SH "SEE ALSO" 329.SH "SEE ALSO"
326The \fBUPGRADE.TXT\fR document, outlining the procedure as a whole: 330The \fBUPGRADE.TXT\fR document, outlining the procedure as a whole:
327.nh 331.nh

Return to:

Send suggestions and report system problems to the System administrator.