#! /bin/bash TMPDIR="/tmp" # change into g-octave-db directory cd $(grep "^db" /etc/g-octave.cfg | cut -f 2 -d "=") # parse packages page wget -qO - http://octave.sourceforge.net/packages.php | grep tar.gz | cut -f 4 -d '"' | \ while read do name=${REPLY##*/} name=${name%.tar.gz*} fname=${TMPDIR}/${name}.tar.gz wget -qO "$fname" "$REPLY" desc=$(tar tzf "$fname" | grep "DESCRIPTION$") # extract description tar xzf "$fname" "$desc" dir="$(find octave-forge -name "${name%-*}" -type d)" dir="${dir:=octave-forge/main/${name%-*}}" mkdir -p "$dir" # update g-octave-db with extracted description mv -v "$desc" "${dir}/${name%.tar.gz}.DESCRIPTION" rm -rf "${desc%/*}" rm "$fname" done