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 @@ -12,24 +12,25 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with slackupgrade. If not, see # <http://www.gnu.org/licenses/>. set -e # Configuration directory : ${SLACKUPGRADE_CONFDIR:=/etc/slackupgrade} : ${SLACKUPGRADE_PKGDIR:=/var/slackupgrade} +: ${SLACKUPGRADE_MIRRORS_URL:=https://mirrors.slackware.com/slackware} # Slackware root directory rooturl= # Log file name logfile= # 'y', if dry-run mode is requested dry_run= # If 'y', don't ask anything, assume "y" as answer to all quieries assume_y= # Output verbosity: '' - normal, 'v' - verbose, 'q' - quiet verbosity= # If 'y', install all packages install_all= @@ -452,39 +453,38 @@ case "$(uname -m)" in i?86) ARCH=;; x86_64) ARCH=64;; *) abend "architecture $(uname -m) is not yet supported" esac if [ ! -d $SLACKUPGRADE_PKGDIR ]; then mkdir -p $SLACKUPGRADE_PKGDIR || abend "can't create $SLACKUPGRADE_PKGDIR" fi tempdir_create cd $tempdir -mirrors_url=https://mirrors.slackware.com/slackware if [ -z "$rooturl" ]; then dnfunc_init - if ! $dnfunc index.html $mirrors_url; then + if ! $dnfunc index.html $SLACKUPGRADE_MIRRORS_URL; then abend "exiting" exit 1 fi version_rx=$(echo $VERSION | sed -e 's/\./\\./g') new_version=$(cat index.html |\ tr '<' '\n' |\ sed -n -r \ -e 's/.*^a href="slackware'$ARCH'-([[:digit:].]+)\/?".*/\1/p'|\ sed -n -e "/$version_rx/{" -en -ep -e '}' ) if [ -n "$new_version" ]; then - rooturl="$mirrors_url/slackware$ARCH-$new_version" + rooturl="$SLACKUPGRADE_MIRRORS_URL/slackware$ARCH-$new_version" info "using $rooturl as distribution top-level URL" else abend "can't find distribution newer than $VERSION; please supply URL if you have any" fi fi # Check if rooturl is local or remote case $rooturl in /*) unset remote ;; http://*|https://*|ftp://*|ftps://*) dnfunc_init diff --git a/slackupgrade.8 b/slackupgrade.8 index d58b0e7..ef15eb9 100644 --- a/slackupgrade.8 +++ b/slackupgrade.8 @@ -310,24 +310,28 @@ becomes \fBX~2\fR and so on. At most five backup copies are kept .SH ENVIRONMENT .TP .B SLACKUPGRADE_CONFDIR Location of the configuration directory. This is the place where replacement maps are stored. The default is .BR /etc/slackupgrade . .TP .B SLACKUPGRADE_PKGDIR Location of the \fBslackupgrade\fR package spool directory. This is the temporary storage for downloaded package tarballs. The default is .BR /var/slackupgrade . .TP +.B SLACKUPGRADE_MIRRORS_URL +URL of the Slackware mirros site. The default is +.BR https://mirrors.slackware.com/slackware . +.TP .B TMP Location of the temporary directory. The default is .BR /tmp . .SH "SEE ALSO" The \fBUPGRADE.TXT\fR document, outlining the procedure as a whole: .nh <\fBhttps://mirrors.nix.org.ua/linux/slackware/slackware\-14.1/UPGRADE.TXT\fR>. .hy .PP .BR upgradepkg (8). .SH BUGS Only main Slackware packages are considered. The \fBpatches\fR |