All pastes #468615 Raw Edit

Something

public shellscript v1 · immutable
·published 2007-05-03 07:23 UTC
rendered paste body
 #!/bin/bash############################################# slack - slackbuilds.org repository maintainance tool #####################################################VARS##########Local VarsUPDATE=""PKG=""BUILD=""#DIRSTMP="/var/tmp/slack"SBD=~/slackbuilds#exitEXIT_CODE="0"#######################[ -d "$SBD" ] || mkdir -p "$SBD"[ -d "$TMP" ] || mkdir -p "$TMP"# Parse optionswhile [ $# -gt 0 ]docase "$1" inupdate)UPDATE="true"shift 1;;build)PKG="$2"shift 2;;search)PKG="$2"BUILD="no"shift 2;;--)# Rest of command line arguments are non option argumentsshift # Discard separator from list of argumentsbreak # Finish for loop;;-*)echo "Unknown option: $1" >&2pod2usage --output ">&2" "$0"exit 2;;*)# Non option argumentbreak # Finish for loop;;esacdoneup (){rsync -P -v -r ftp.slackbuilds.org::slackbuilds "$SBD"}search (){( cd "$TMP"; find $SBD/ -iname "$PKG.tar.gz" -exec tar xzvf "{}" ";" )}localvars(){exec < "$SUBST.info" while read line        do          export "$line" | grep env        done } build () {    [ "$UID" -ne "0" ] && { echo "Roots, bloody roots...."; exit 1; } local SUBST="${PKG%%.*}" search "$SUBST"; cd "$TMP/$SUBST" . "$SUBST.info" wget "$DOWNLOAD" && ( SOURCE=`basename $DOWNLOAD`; md5sum "$SOURCE" > ./"$SOURCE".md5; md5sum -c "$SOURCE" )   [ $? -ne "o" ] && { echo "md5 checksum failed!"; exit 1; }sh "$SUBST.SlackBuild" && ( cd /tmp; installpkg "$SUBST"*; )   [ $? -ne "0" ] && { echo "Cowardly refused to install packages"; exit 1; }( localvars ) && read}[ "$PKG" != "" ] && build[ "$UPDATE" == "true" ] && up[ "$BUILD" == "no" ] && searchexit "$EXIT_CODE"#Author: DaFruzler#License: GPL