Add package download support

This commit is contained in:
MatMoul 2017-02-04 22:18:19 +01:00
parent faa78f3700
commit bbdcd5bb1f

18
archdi Normal file → Executable file
View file

@ -25,6 +25,9 @@ binurl2=matmoul.github.io/archdi
liburl1=http://archdi.sourceforge.net/archdi-lib liburl1=http://archdi.sourceforge.net/archdi-lib
liburl2=https://raw.githubusercontent.com/MatMoul/archdi-pkg/master/lib liburl2=https://raw.githubusercontent.com/MatMoul/archdi-pkg/master/lib
pkgurl1=http://archdi.sourceforge.net/archdi-pkg
pkgurl2=https://raw.githubusercontent.com/MatMoul/archdi-pkg/master/pkg.tar
help(){ help(){
echo "-h | --help : this screen" echo "-h | --help : this screen"
@ -49,7 +52,16 @@ run(){
rm -R $cachedir 2>/dev/null rm -R $cachedir 2>/dev/null
mkdir -p $cachedir 2>/dev/null mkdir -p $cachedir 2>/dev/null
cd $cachedir 2>/dev/null cd $cachedir 2>/dev/null
if [ "$pkgurl" == "" ]; then
wget -O lib $liburl 2>/dev/null wget -O lib $liburl 2>/dev/null
else
echo ""
echo "Downloading packages..."
wget -O pkg.tar $pkgurl 2>/dev/null
tar -xf pkg.tar
fi
chmod 755 lib 2>/dev/null chmod 755 lib 2>/dev/null
if [ "$chrootoption" = "true" ]; then if [ "$chrootoption" = "true" ]; then
./lib --chroot ./lib --chroot
@ -84,12 +96,14 @@ dependencies(){
if [ "$?" = "0" ] && [ "${#lastver}" = "19" ]; then if [ "$?" = "0" ] && [ "${#lastver}" = "19" ]; then
binurl=$binurl1 binurl=$binurl1
liburl=$liburl1 liburl=$liburl1
pkgurl=$pkgurl1
else else
lastverurl=$lastverurl2 lastverurl=$lastverurl2
lastver=$(curl $lastverurl) lastver=$(curl $lastverurl)
if [ "$?" = "0" ] && [ "${#lastver}" = "19" ]; then if [ "$?" = "0" ] && [ "${#lastver}" = "19" ]; then
binurl=$binurl2 binurl=$binurl2
liburl=$liburl2 liburl=$liburl2
pkgurl=$pkgurl2
else else
exit 1 exit 1
fi fi
@ -148,6 +162,8 @@ while (( "$#" )); do
shift shift
liburl1=https://raw.githubusercontent.com/MatMoul/archdi-pkg/$1/lib liburl1=https://raw.githubusercontent.com/MatMoul/archdi-pkg/$1/lib
liburl2=https://raw.githubusercontent.com/MatMoul/archdi-pkg/$1/lib liburl2=https://raw.githubusercontent.com/MatMoul/archdi-pkg/$1/lib
pkgurl1=""
pkgurl2=""
branchoption="$1" branchoption="$1"
githubuser="MatMoul" githubuser="MatMoul"
;; ;;
@ -155,6 +171,8 @@ while (( "$#" )); do
shift shift
liburl1=https://raw.githubusercontent.com/$1/archdi-pkg/$2/lib liburl1=https://raw.githubusercontent.com/$1/archdi-pkg/$2/lib
liburl2=https://raw.githubusercontent.com/$1/archdi-pkg/$2/lib liburl2=https://raw.githubusercontent.com/$1/archdi-pkg/$2/lib
pkgurl1=""
pkgurl2=""
branchoption="$2" branchoption="$2"
githubuser="$1" githubuser="$1"
;; ;;