wgetter
#!/bin/bash # xorg7, get one section, or get all sections with -a # # Run in the parent dir of the section dirs. # # the wget-list link is the required command line argument # ex: # wgetter http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/driver-7.5-2.wget # # In the current directory, # the section subdir will be created/used to contain # the wget-list, the md5-list, and the section files downloaded. # The wget-list and the md5-list will be downloaded there also. # # -c allows continuing when there was an interruption. # # Once a section download completes, the md5 check will be run. sections=(proto util lib app font driver) check_u() { here=$(basename $(pwd)) for sect in ${sections[*]}; do if [ "$here" == "$sect" ]; then echo "Run this in $(dirname $(pwd))" exit fi done } check_u fun_fun() { baseh=http://xorg.freedesktop.org/releases/individual/${sect}/ wget -c -P ${sect} ${wget_list%.wget}.md5 wget -c -P ${sect} ${wget_list} grep -v '^#' ${sect}/${wgetl} | wget -c -P ${sect} -B ${baseh} -i- (cd ${sect} && md5sum -c ${wgetl%%.wget}.md5 && cd ..) } params=($*) for param in ${params[*]}; do case $param in -a|--all) get_all_sections=1 ;; -*) continue ;; *) wget_list=$param ;; esac done [ -z "$wget_list" ] && echo "no wget list" && exit wgetd=$(dirname $wget_list) if [ "${wget_list%%.md5}" != "${wget_list}" ]; then wget_list=${wget_list%%.md5}.wget # oops, the md5 list; make it work fi [ "${wget_list##*.}" != "wget" ] && echo "wrong href" && exit wgetl=$(basename $wget_list) sect=${wgetl%%-*} vers=${wgetl%%.wget} vers=${vers#${sect}-} if (( get_all_sections == 0 )); then fun_fun else for sect in ${sections[*]}; do wget_list=${wgetd}/${sect}-${vers}.wget wgetl=$(basename $wget_list) fun_fun done fi -- http://linuxfromscratch.org/mailman/listinfo/blfs-dev FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
