#!/bin/bash # Change the above line if your bash executable is located elsewhere # # getrpr.sh: Bash (Linux) version of getrpr.bat for # downloading the MiKTeX package repository # # Copyright (C) 2001-2003 MiKTeX.org # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published # by the Free Software Foundation; either version 2, or (at your # option) any later version. # # This file is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # 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 this file; if not, write to the Free Software # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. function usage() { echo "Usage: getrpr REMOTEREPOSITORY PACKAGESET LOCALREPOSITORY [WGETOPTIONS]" echo "Usage: getrpr remoterepository packageset localrepository [wgetoptions]" echo "e.g getrpr http://www.tex.ac.uk/tex-archive/systems/win32/miktex/tm/packages total C:\TEMP" echo "Say \"wget --help\" to see valid wget options." exit 1 } function error() { echo Something went wrong under the download. exit 1 } if test "$#" -lt 3; then usage else remrep=$1 packset=$2 locrep=$3 shift; shift; shift fi if test "$packset" != "small" -a "$packset" != "large" -a "$packset" != "total"; then echo "\"$packset\" is not a package set. You should choose" echo "one of: \"small\", \"large\", \"total\"." echo usage fi echo "getrpr 2.1.2 (C) Copyright 2001-2003 MiKTeX.org" echo "This script will download the \"$packset\" MiKTeX package repository" echo "from (remote): $remrep" echo " to (local): $locrep" echo if test ! -d $locrep; then mkdir $locrep 2> /dev/null fi if test $? -ne 0; then echo "Failed to create directory \"$locrep\" - aborting." echo "(Do you have write access?)" exit 1 fi wget $remrep/$packset.html --directory-prefix=$locrep $@ if test $? -ne 0; then error fi wget --force-html --base=$remrep/ --input-file=$locrep/$packset.html --directory-prefix=$locrep $@ if test $? -ne 0; then error fi exit 0