diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2020-02-07 12:16:48 +0100 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2020-02-07 12:16:48 +0100 |
commit | bed14b11e3d3070b92bb66203ae42d9e31393299 (patch) | |
tree | 81207427dca441f10e72fb42581611ae00336fe4 | |
parent | 507ae64c3e886b82435cbc963594ed5e2af3458f (diff) | |
download | slackupgrade-bed14b11e3d3070b92bb66203ae42d9e31393299.tar.gz slackupgrade-bed14b11e3d3070b92bb66203ae42d9e31393299.tar.bz2 |
Make mirror URL configurable via the environment.
-rw-r--r-- | slackupgrade | 6 | ||||
-rw-r--r-- | slackupgrade.8 | 4 |
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 | ||
19 | set -e | 19 | set -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 |
25 | rooturl= | 26 | rooturl= |
26 | # Log file name | 27 | # Log file name |
27 | logfile= | 28 | logfile= |
28 | # 'y', if dry-run mode is requested | 29 | # 'y', if dry-run mode is requested |
29 | dry_run= | 30 | dry_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" |
459 | fi | 460 | fi |
460 | 461 | ||
461 | tempdir_create | 462 | tempdir_create |
462 | cd $tempdir | 463 | cd $tempdir |
463 | 464 | ||
464 | mirrors_url=https://mirrors.slackware.com/slackware | ||
465 | if [ -z "$rooturl" ]; then | 465 | if [ -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 |
483 | fi | 483 | fi |
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 |
318 | Location of the \fBslackupgrade\fR package spool directory. This is | 318 | Location of the \fBslackupgrade\fR package spool directory. This is |
319 | the temporary storage for downloaded package tarballs. The default is | 319 | the 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 | ||
323 | URL of the Slackware mirros site. The default is | ||
324 | .BR https://mirrors.slackware.com/slackware . | ||
325 | .TP | ||
322 | .B TMP | 326 | .B TMP |
323 | Location of the temporary directory. The default is | 327 | Location of the temporary directory. The default is |
324 | .BR /tmp . | 328 | .BR /tmp . |
325 | .SH "SEE ALSO" | 329 | .SH "SEE ALSO" |
326 | The \fBUPGRADE.TXT\fR document, outlining the procedure as a whole: | 330 | The \fBUPGRADE.TXT\fR document, outlining the procedure as a whole: |
327 | .nh | 331 | .nh |