#!/bin/sh # # This script downloads package source trees from the slackware source repo # and puts them in the right place in the Zenwalk source repo # # Written by George Vlahavas (vlahavas~at~gmail.com, gapan@zenwalk forums) # This has to be an ftp site. http sites won't always work right. # You'll probably need to tweak --cut-dirs in the wget command if you change this. SLACKREPO=${SLACKREPO:-"ftp://ftp.osuosl.org/pub/slackware/slackware-current/source/"} # You can set BASEDIR to the directory that includes the i486/ and source/ directories for testing purposes BASEDIR=${BASEDIR:-"/home/www/zenwalk.org/download/"} # This presents a dialog if the package name cannot be found in Zenwalk PACKAGES.TXT # That should only happen only if it's a new slackware package that is being moved # to Zenwalk for the first time dirdialog() { dialog --title "$PKG" \ --menu "Package $PKG is not in the Zenwalk repository yet. If you want to add it, select the right category or press cancel to skip adding the sources to the Zenwalk source tree.\n\n" 50 80 25 \ "a" "Basic software for the computer to run" \ "ap" "Various non-graphical applications" \ "d" "Program development tools" \ "l" "Libraries required by many other programs" \ "n" "Networking programs" \ "x" "The base X Window System" \ "xap" "Various graphical applications. " \ "extra/a" "Additional basic system software" \ "extra/ap" "Additional non-graphical applications" \ "extra/d" "Additional program development tools" \ "extra/e" "The Enlightenment Window Manager" \ "extra/f" "FAQs, HOWTOs, and other documentation" \ "extra/g" "The Gnome desktop enviornment" \ "extra/games" "Games :)" \ "extra/kde" "The KDE desktop environment" \ "extra/l" "Additional libraries required by many other programs" \ "extra/locale" "Addon software to support various locales" \ "extra/n" "Additional networking software" \ "extra/s" "Software for servers" \ "extra/t" "The teTeX document formatting system" \ "extra/tcl" "The Tool Command Language software" \ "extra/x" "Additional software for the X Window System" \ "extra/xap" "Additional graphical applications" 2> $BASEDIR/source/.menu.tmp.$$ retval=$? ZENSRCCAT=`cat $BASEDIR/source/.menu.tmp.$$` rm -f $BASEDIR/source/.menu.tmp.$$ } rm -f $BASEDIR/source/.FILE_LIST.$$ mkdir -p $BASEDIR/source/.temp.$$ # Exit if there are no command line arguments if [ -z "$*" ];then echo "Usage: getslacksrc package1 package2 ..." exit 1 fi # We need this to determine where the source tree # for each package is in slackware echo "Downloading slackware current source tree listing..." wget -q -O $BASEDIR/source/.FILE_LIST.$$ $SLACKREPO/FILE_LIST || { echo "ERROR: Couldn't download slackware current source tree listing"; exit 1; } for PKG in $* do # find where the source is located in slackware repo SLACKSRCDIR=`grep ^drw $BASEDIR/source/.FILE_LIST.$$ | grep "/$PKG$" | sed "s|\(.*\) \./\(.*\)|\2|"` # go on only if the source tree for each package exists if [ ! -z $SLACKSRCDIR ]; then # find the package category for the package in Zenwalk, # may not be the same as in slackware ZENSRCCAT=`grep -A1 "PACKAGE NAME:" $BASEDIR/i486/snapshot/PACKAGES.TXT | sed "s/\(.*\)-\(.*\)-\(.*\)-\(.*\)\.tgz/\1/" | grep -A1 "NAME: $PKG$" | grep -v "PACKAGE NAME" | sed "s|PACKAGE LOCATION: \./||"` # if the package is not included in PACKAGES.TXT it's a new # package, so we'll have to put it in a category manually if [ -z $ZENSRCCAT ]; then dirdialog fi # if we know where to put the source for each package, # do the real work # cannot use else in combination with the previous if, # you might have exited with cancel in dirdialog if [ ! -z $ZENSRCCAT ]; then mkdir -p $BASEDIR/source/$ZENSRCCAT/$PKG rm -rf $BASEDIR/source/$ZENSRCCAT/$PKG/* echo "Updating sources in $ZENSRCCAT/$PKG..." wget -nH -r -np --cut-dirs=4 -q -R "=D","=A","index.html","robots*" -P $BASEDIR/source/.temp.$$ $SLACKREPO/$SLACKSRCDIR || echo "ERROR: Could not download all source files in $ZENSRCCAT/$PKG" mv $BASEDIR/source/.temp.$$/$SLACKSRCDIR/* $BASEDIR/source/$ZENSRCCAT/$PKG rm -rf $BASEDIR/source/.temp.$$/$SLACKSRCDIR fi # if the source tree doesn't exist in slackware servers, display a message else echo "ERROR: $PKG not found in slackware current source tree" fi done rm -rf $BASEDIR/source/.temp.$$ # clean up rm -f $BASEDIR/source/.FILE_LIST.$$