(rev.0.1)
(rev.0.2 skip installed packages)
Line 1: Line 1:
<source lang="bash">
<source lang="bash">
#!/bin/sh
#!/bin/sh
-
# SBo_get.sh - rev. 0.1 2015-01-14 - copyleft Fabio Zorba 2015
+
# SBo_get.sh - rev. 0.2 2015-01-14 - copyleft Fabio Zorba 2015
# get SlackBuilds and sources from SBo,
# get SlackBuilds and sources from SBo,
# make and install Slackware packages
# make and install Slackware packages
Line 50: Line 50:
  fi
  fi
done
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 $SLACKBUILD -P ./slackbuilds
wget --no-check-certificate -c $SLACKBUILD -P ./slackbuilds

Revision as of 22:43, 14 January 2015

#!/bin/sh
# SBo_get.sh - rev. 0.2 2015-01-14 - copyleft Fabio Zorba 2015
# get SlackBuilds and sources from SBo,
# make and install Slackware packages
 
if test $# -ne 1
then
 echo "Usage: $0 http://slackbuilds.org/repository/{slackware-version}/{category}/{slackbuild_name}"
 exit 1
fi
 
SITEBASE=http://slackbuilds.org
 
if [ ! -d ./slackbuilds ] ; then
 mkdir -p ./slackbuilds
fi
 
IFS=
INDEX_HTML=`wget -q -O - $1/`
 
REQU[0]=`echo $INDEX_HTML | grep requires | grep -o -P '(?<=href=).*(?=</a>)' | cut -d"'" -f2`
REQU[1]=`echo $INDEX_HTML | grep requires | grep -o -P '(?<=href=).*(?=</a>)' | cut -d"'" -f4`
REQU[2]=`echo $INDEX_HTML | grep requires | grep -o -P '(?<=href=).*(?=</a>)' | cut -d"'" -f6`
REQU[3]=`echo $INDEX_HTML | grep requires | grep -o -P '(?<=href=).*(?=</a>)' | cut -d"'" -f8`
REQU[4]=`echo $INDEX_HTML | grep requires | grep -o -P '(?<=href=).*(?=</a>)' | cut -d"'" -f10`
REQU[5]=`echo $INDEX_HTML | grep requires | grep -o -P '(?<=href=).*(?=</a>)' | cut -d"'" -f12`
REQU[6]=`echo $INDEX_HTML | grep requires | grep -o -P '(?<=href=).*(?=</a>)' | cut -d"'" -f14`
REQU[7]=`echo $INDEX_HTML | grep requires | grep -o -P '(?<=href=).*(?=</a>)' | cut -d"'" -f16`
 
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`
 
SOURCE=`echo $INDEX_HTML | grep "Source Download" | grep -o -P '(?<=href=).*(?=</a>)' | cut -d'"' -f2`
 
echo "Package: $BUILD_DIR"
echo "---------------------------------------------"
echo "Slackbuild: $SLACKBUILD $FILE_NAME"
echo "Source: $SOURCE"
echo
 
for N in 0 1 2 3 4 5 6 7
do
 if [ "a${REQU[$N]}" != "a" ] ; then
  echo "Require: $SITEBASE${REQU[$N]}"
  $0 $SITEBASE${REQU[$N]}
 fi
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 $SLACKBUILD -P ./slackbuilds
 
tar -C ./slackbuilds -xzf ./slackbuilds/$FILE_NAME
 
wget --no-check-certificate -c $SOURCE -P ./slackbuilds/$BUILD_DIR
 
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_source_code"