first result

This commit is contained in:
MatMoul 2015-08-21 01:15:14 +02:00
parent f2035a6eef
commit 37d5ecf2a5

68
archdi
View file

@ -16,12 +16,16 @@ apptitle="Arch Linux Desktop Install (archdi) - Version: 2015.04.26.22.14.52 (GP
version="2015.04.26.22.14.52" version="2015.04.26.22.14.52"
cachedir=~/.cache/archdi cachedir=~/.cache/archdi
lastverurl1=http://archdi.sourceforge.net/version
#lastverurl2=https://raw.githubusercontent.com/MatMoul/archdi/master/version
lastverurl2=https://raw.githubusercontent.com/MatMoul/archdi/NewCodeStructure/version
binurl1=archdi.sourceforge.net/archdi
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
lastverurl1=https://raw.githubusercontent.com/MatMoul/archdi/master/version
lastverurl2=http://archdi.sourceforge.net/archdi/version
help(){ help(){
echo "-h | --help : this screen" echo "-h | --help : this screen"
@ -63,30 +67,32 @@ dependencies(){
lastver=$lastverurl1 lastver=$lastverurl1
lastversion=$(curl $lastver) lastversion=$(curl $lastver)
if [ "$?" = "0" ] && [ "${#lastversion}" = "19" ]; then if [ "$?" = "0" ] && [ "${#lastversion}" = "19" ]; then
binurl=$binurl1
liburl=$liburl1 liburl=$liburl1
else else
lastver=$lastverurl2 lastver=$lastverurl2
lastversion=$(curl $lastver) lastversion=$(curl $lastver)
if [ "$?" = "0" ] && [ "${#lastversion}" = "19" ]; then if [ "$?" = "0" ] && [ "${#lastversion}" = "19" ]; then
binurl=$binurl2
liburl=$liburl2 liburl=$liburl2
else else
exit 1 exit 1
fi fi
fi fi
exit 0
liburl=$liburl1 #liburl=$liburl1
if (curl $liburl 1>/dev/null 2>/dev/null) then #if (curl $liburl 1>/dev/null 2>/dev/null) then
echo "Connexion OK." # echo "Connexion OK."
else #else
liburl=$liburl2 # liburl=$liburl2
if (curl $liburl 1>/dev/null 2>/dev/null) then # if (curl $liburl 1>/dev/null 2>/dev/null) then
echo "Connexion OK." # echo "Connexion OK."
else # else
echo "No connexion, please check your internet connexion !" # echo "No connexion, please check your internet connexion !"
exit 1 # exit 1
fi # fi
fi #fi
echo "" echo ""
echo "Checking $apptitle dependencies :" echo "Checking $apptitle dependencies :"
echo "" echo ""
@ -105,20 +111,11 @@ dependencies(){
if [ "$needinstall" = "true" ]; then if [ "$needinstall" = "true" ]; then
echo "" echo ""
echo "Install missing dependencies ?" echo "Install missing dependencies ?"
while read -n1 -p "[Y/N] :" -s yesno; do read -p "Install missing dependencies ? (Y/n)" choice
if [[ $yesno = [YyNn] ]]; then case "$choice" in
[[ $yesno = [Yy] ]] && yesno=1 n|N ) exit 1;;
[[ $yesno = [Nn] ]] && yesno=0 esac
break pacman -S --needed wget libnewt
fi
echo ""
done
echo ""
if [ $yesno = 1 ]; then
pacman -S --needed wget libnewt
else
exit 1
fi
fi fi
echo "" echo ""
echo "Checking bin version..." echo "Checking bin version..."
@ -126,17 +123,12 @@ dependencies(){
} }
chkupgrade(){ chkupgrade(){
if [ -f "/usr/bin/archdi" ]; then if [ "$0" = "/usr/bin/archdi" ]; then
#lastverurl=$lastverurl1 #if [ -f "/usr/bin/archdi" ]; then
#chkver=$(curl $lastverurl)
#chkver=$version
#chkver=$(curl archdi.sourceforge.net/archdi/version)
if [ ! "$version" = "$lastversion" ]; then if [ ! "$version" = "$lastversion" ]; then
if (whiptail --backtitle "$apptitle" --yesno "New version found !\n\nInstall last version ?" 0 0) then if (whiptail --backtitle "$apptitle" --yesno "New version found !\n\nInstall last version ?" 0 0) then
cd /tmp cd /tmp
wget archdi.sourceforge.net/archdi wget $binurl
sh archdi -i sh archdi -i
exit 0 exit 0
fi fi