From 37d5ecf2a5bae489f6e61d187a452e1f495a9711 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Fri, 21 Aug 2015 01:15:14 +0200 Subject: [PATCH] first result --- archdi | 68 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 30 insertions(+), 38 deletions(-) diff --git a/archdi b/archdi index b411eb9..2ec4a6b 100755 --- a/archdi +++ b/archdi @@ -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" 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 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(){ echo "-h | --help : this screen" @@ -63,30 +67,32 @@ dependencies(){ lastver=$lastverurl1 lastversion=$(curl $lastver) if [ "$?" = "0" ] && [ "${#lastversion}" = "19" ]; then + binurl=$binurl1 liburl=$liburl1 else lastver=$lastverurl2 lastversion=$(curl $lastver) if [ "$?" = "0" ] && [ "${#lastversion}" = "19" ]; then + binurl=$binurl2 liburl=$liburl2 else exit 1 fi fi - exit 0 - liburl=$liburl1 - if (curl $liburl 1>/dev/null 2>/dev/null) then - echo "Connexion OK." - else - liburl=$liburl2 - if (curl $liburl 1>/dev/null 2>/dev/null) then - echo "Connexion OK." - else - echo "No connexion, please check your internet connexion !" - exit 1 - fi - fi + #liburl=$liburl1 + #if (curl $liburl 1>/dev/null 2>/dev/null) then + # echo "Connexion OK." + #else + # liburl=$liburl2 + # if (curl $liburl 1>/dev/null 2>/dev/null) then + # echo "Connexion OK." + # else + # echo "No connexion, please check your internet connexion !" + # exit 1 + # fi + #fi + echo "" echo "Checking $apptitle dependencies :" echo "" @@ -105,20 +111,11 @@ dependencies(){ if [ "$needinstall" = "true" ]; then echo "" echo "Install missing dependencies ?" - while read -n1 -p "[Y/N] :" -s yesno; do - if [[ $yesno = [YyNn] ]]; then - [[ $yesno = [Yy] ]] && yesno=1 - [[ $yesno = [Nn] ]] && yesno=0 - break - fi - echo "" - done - echo "" - if [ $yesno = 1 ]; then - pacman -S --needed wget libnewt - else - exit 1 - fi + read -p "Install missing dependencies ? (Y/n)" choice + case "$choice" in + n|N ) exit 1;; + esac + pacman -S --needed wget libnewt fi echo "" echo "Checking bin version..." @@ -126,17 +123,12 @@ dependencies(){ } chkupgrade(){ - if [ -f "/usr/bin/archdi" ]; then - #lastverurl=$lastverurl1 - #chkver=$(curl $lastverurl) - - #chkver=$version - #chkver=$(curl archdi.sourceforge.net/archdi/version) - + if [ "$0" = "/usr/bin/archdi" ]; then + #if [ -f "/usr/bin/archdi" ]; then if [ ! "$version" = "$lastversion" ]; then if (whiptail --backtitle "$apptitle" --yesno "New version found !\n\nInstall last version ?" 0 0) then cd /tmp - wget archdi.sourceforge.net/archdi + wget $binurl sh archdi -i exit 0 fi