Add -l and --local dir for testing localy archdi-pkg

This commit is contained in:
MatMoul 2019-01-04 01:50:40 +01:00
parent 470d17d4a0
commit 224d78dccb

46
archdi
View file

@ -32,6 +32,7 @@ pkgurl2=https://raw.githubusercontent.com/MatMoul/archdi-pkg/master/pkg.tar
help(){ help(){
echo "-h | --help : this screen" echo "-h | --help : this screen"
echo "-i | --install : install" echo "-i | --install : install"
echo "-l | --local dir : run local archdi-pkg dir"
echo "-t | --test githubuser branch : launch a forked branch" echo "-t | --test githubuser branch : launch a forked branch"
echo "no args : start archdi" echo "no args : start archdi"
} }
@ -53,13 +54,17 @@ run(){
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 if [ ! "$pkgdir" = "" ]; then
wget -O lib $liburl 2>/dev/null cp -r $pkgdir/* . >/dev/null
else else
echo "" if [ "$pkgurl" == "" ]; then
echo "Downloading packages..." wget -O lib $liburl 2>/dev/null
wget -O pkg.tar $pkgurl 2>/dev/null else
tar -xf pkg.tar echo ""
echo "Downloading packages..."
wget -O pkg.tar $pkgurl 2>/dev/null
tar -xf pkg.tar
fi
fi fi
chmod 755 lib 2>/dev/null chmod 755 lib 2>/dev/null
@ -69,20 +74,31 @@ run(){
archdi --branch master archdi --branch master
fi fi
else else
if [ "$branchoption" = "" ]; then if [ ! "$pkgdir" = "" ]; then
sed -i "/apptitle=/c\apptitle=\"Arch Linux Desktop Install (archdi) - local: $pkgdir (GPLv3)\"" lib
sed -i "/baseurl=/c\baseurl=$pkgdir" lib
./lib --root ./lib --root
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
archdi --branch master archdi --branch master
fi fi
else else
sed -i "/apptitle=/c\apptitle=\"Arch Linux Desktop Install (archdi) - Branch: $branchoption (GPLv3)\"" lib if [ "$branchoption" = "" ]; then
sed -i "/baseurl=/c\baseurl=https://raw.githubusercontent.com/$githubuser/archdi-pkg/$branchoption" lib ./lib --root
./lib --root if [ ! "$?" = "0" ]; then
if [ ! "$?" = "0" ]; then archdi --branch master
archdi --branch master fi
else
sed -i "/apptitle=/c\apptitle=\"Arch Linux Desktop Install (archdi) - Branch: $branchoption (GPLv3)\"" lib
sed -i "/baseurl=/c\baseurl=https://raw.githubusercontent.com/$githubuser/archdi-pkg/$branchoption" lib
./lib --root
if [ ! "$?" = "0" ]; then
archdi --branch master
fi
fi fi
fi fi
fi fi
cd 2>/dev/null cd 2>/dev/null
rm -R $cachedir 2>/dev/null rm -R $cachedir 2>/dev/null
} }
@ -167,6 +183,12 @@ while (( "$#" )); do
branchoption="$1" branchoption="$1"
githubuser="MatMoul" githubuser="MatMoul"
;; ;;
-l | --local)
shift
apptitle="Arch Linux Desktop Install (archdi) - Version: local ($1)"
version="local ($1)"
pkgdir="$1"
;;
-t | --test) -t | --test)
shift shift
liburl1=https://raw.githubusercontent.com/$1/archdi-pkg/$2/lib liburl1=https://raw.githubusercontent.com/$1/archdi-pkg/$2/lib