(---)
(rev. 0.3 2015-01-23 - checks up to 50 dependencies, now)
Line 2: Line 2:
:Usage example:
:Usage example:
<source lang="bash">
<source lang="bash">
-
# ./SBo_get.sh http://slackbuilds.org/repository/14.1/multimedia/cinelerra
+
# ./SBo_get.sh http://slackbuilds.org/repository/14.1/multimedia/vlc
</source>
</source>
-
:'''SBo_get.sh'''
+
:'''SBo_get.sh''' - rev. 0.3 2015-01-23 - checks up to 50 dependencies, now
{{:Slackbuilds_get_source_code}}
{{:Slackbuilds_get_source_code}}
[[Category:Shell scripts]] [[Category:Highlight news]]
[[Category:Shell scripts]] [[Category:Highlight news]]

Revision as of 15:51, 23 January 2015

Here is a simple but powerful script that finds informations directly from SBo html pages, get sources and slackbuilds, make and install all required dependencies, recursively. Simple, without error check, but works! Note: use at own risk, no warranty.

Usage example:
# ./SBo_get.sh http://slackbuilds.org/repository/14.1/multimedia/vlc
SBo_get.sh - rev. 0.3 2015-01-23 - checks up to 50 dependencies, now
#!/bin/sh
# SBo_get.sh - copyleft Fabio Zorba 2015
# get SlackBuilds and sources from SBo,
# make and install Slackware packages
# rev. 0.5 - 2016-01-21:
# slackbuild site template is changed, URL to slackbuild-name.gz is relative now, fixed
# checks up to 50 dependencies, download all required sources packages per slackbuild
 
if test $# -ne 1
then
 echo "$0 rev. 0.5 - 2016-01-21"
 echo "Usage: $0 https://slackbuilds.org/repository/{slackware-version}/{category}/{slackbuild_name}"
 exit 1
fi
 
SITEBASE=https://slackbuilds.org
 
if [ ! -d ./slackbuilds ] ; then
 mkdir -p ./slackbuilds
fi
 
IFS=
INDEX_HTML=`wget -q -O - $1/`
 
N=1
while [ $N -le 50 ]
do
 K=$(($N*2))
 REQU[$N]=`echo $INDEX_HTML  | grep requires | grep -o -P '(?<=href=).*(?=</a>)' | cut -d"'" -f$K`
 N=$(($N+1))
done
 
SLACKBUILD=`echo $INDEX_HTML | grep "Download SlackBuild" | grep -o -P '(?<=href=).*(?=</a>)' | cut -d'"' -f2`
FILE_NAME=`echo $SLACKBUILD | rev | cut -d'/' -f1 | rev`
BUILD_DIR=`echo $FILE_NAME | cut -d'.' -f1`
 
SLACKBUILD=`echo $INDEX_HTML | grep "Download SlackBuild" | grep -o -P '(?<=href=).*(?=</a>)' | cut -d'"' -f2`
 
SOURCES=`echo $INDEX_HTML | sed -n -e '/Source Downloads/,/Download SlackBuild/ p' - | grep -o -P '(?<=href=).*(?=</a>)'| cut -d'"' -f2`
 
# find all sources links
LINK="start"
MAXS=0
while [ "a$LINK" != "a" ]
do
 MAXS=$(($MAXS+1))
 IFS=$'\n'
 LINK=`echo $SOURCES | cut -d' ' -f$MAXS`
 SOURCE[$MAXS]=$LINK
done
 
echo "Package: $BUILD_DIR"
echo "---------------------------------------------"
echo "Slackbuild: $SLACKBUILD $FILE_NAME"
echo "Source: $SOURCE"
echo
 
N=1
while [ $N -le 50 ]
do
 if [ "a${REQU[$N]}" != "a" ] ; then
  echo "Require: $SITEBASE${REQU[$N]}"
  $0 $SITEBASE${REQU[$N]}
 fi
 N=$(($N+1))
done
 
PKG=`ls -1 ./slackbuilds/$BUILD_DIR/$BUILD_DIR-*.tgz 2>/dev/null`
 
if [ "a$PKG" != "a" ] ; then
 echo  "Package: $BUILD_DIR exists. Skipping ..."
 exit
fi
 
wget --no-check-certificate -c $SITEBASE$SLACKBUILD -P ./slackbuilds
 
tar -C ./slackbuilds -xzf ./slackbuilds/$FILE_NAME
 
# download all sources packages
for (( K=1; K<$MAXS-1; K++ ))
do
 wget --no-check-certificate -c ${SOURCE[$K]} -P ./slackbuilds/$BUILD_DIR
done
 
cd ./slackbuilds/$BUILD_DIR
./$BUILD_DIR.SlackBuild
 
PKG=`ls -1 /tmp/$BUILD_DIR-*.tgz`
 
cp $PKG .
 
upgradepkg --install-new $PKG
Retrieved from "http://www.zoros.org/wiki/index.php?title=Slackbuilds_Get,_a_script_that_make_and_install_Slackware_SBo_packages_and_dependencies,_recursively"