All pastes #1987526 Raw Edit

SlackBuild automation script

public shellscript v1 · immutable
#1987526 ·published 2010-11-10 20:53 UTC
rendered paste body
#!/bin/bash# SBO - SlackBuild automation script.# dagni, 2010-11-10, thanks to guys from ##slackware ;)#####################################version="0.1"link="$1"function sbo_usage() {        echo "sbo.sh is SlackBuild Automation Script, that automates routine steps, required in order to build and install"        echo "Slackware package."        echo -e "sbo version: ${version}\n--------------------------------------------------------------------------------"        echo "usage: $0 [link]"        echo "example: $0 http://slackbuilds.org/slackbuilds/13.1/libraries/pangomm.tar.gz"}function sbo_action() {        if [ -z ${link} ]; then                sbo_usage                exit 1        fi        echo -n "Checking if ${link} is valid... "        wget -q --spider ${link} ; sbo_reply=$?        if [ ! ${sbo_reply} -eq 0 ]; then                echo -e "invalid\n${link} is not valid URL or reffers to non-existing package, exiting now."                exit 1        fi        echo -en "valid.\ndownloading SlackBuild script... "        wget -q ${link} ; echo "done"        tarname=`(basename ${link})`        archivetype=`(file ${tarname}|awk '{print $2}')`        echo -en "decompressing build script... "        if [[ "${archivetype}" = "bzip2" ]]; then                echo -n "archive type: bzip2 compressed data.. "                tar xfj ${tarname}                echo "done"                packagename="`(echo ${tarname}|awk -F".tar.bz2" '{print $1}')`"        elif [[ "${archivetype}" = "gzip" ]]; then                echo -n "archive type: gzip compressed data.. "                tar -zxf ${tarname}                echo "done"                packagename="`(echo ${tarname}|awk -F".tar.gz" '{print $1}')`"        else                echo "unknown archive format, exiting"                exit 1        fi        cd ${packagename}        srcurl=`(cat ${packagename}.info | grep "DOWNLOAD="|awk -F"\"" '{print $2}')`        echo -en "preparing to download source code for SlackBuild script.. "        wget -q --spider ${srcurl} ; sbo_reply=$?        if [ ! ${sbo_reply} -eq 0 ]; then                echo -e "invalid\n${srcurl} is not valid URL or reffers to non-existing package, exiting now."                exit 1           fi        echo -e "ok.\ndownloading source code.. "        wget -q ${srcurl} ; echo "done"        a=4        while [ $a -gt 0 ]; do                echo -en "launching ${packagename}.SlackBuild script in: ${a} sec.."                sleep 1                let a-=1                echo -en "\r"        done        sh ${packagename}.SlackBuild}if [ -z $1 ]; then        sbo_usage        exit 1 else        sbo_actionfi