diff --git a/CAU_Installer b/CAU_Installer index a7adbcb..eab7465 100755 --- a/CAU_Installer +++ b/CAU_Installer @@ -18,7 +18,7 @@ # Programmversion PROGNAME=`basename $0` -VERSION="0.14.99.6" +VERSION="0.19.99.7" ##### Variablen deklaration ##### # Downloadseite der Linuxinstallation @@ -63,14 +63,17 @@ func_install_noroot() echo -e "\n\033[1;36mDie Programm-Dateien werden nach $BIN kopiert\e[m\e[m" if [ ! -d $BIN ]; then mkdir $BIN; fi; if [ ! -d $ETC ]; then mkdir $ETC; fi; if [ ! -d $INC ]; then mkdir $INC; fi cp calibre-autoupdate $BIN; chmod 755 $BIN"calibre-autoupdate" - sed -i "s/_-VERSION-_/${VERSION//\//\/}/g" $BIN"calibre-autoupdate" # Der Installer übergibt die Versionsnummer + sed -i "s/_-ETC-_/${ETC//\//\/}/g" $BIN"calibre-autoupdate" + sed -i "s/_-VERSION-_/${VERSION//\//\/}/g" $BIN"calibre-autoupdate" func_progressbar echo -e "\n\033[1;36mDie Header-Dateien werden nach $INC kopiert\e[m" cp calibre-autoupdate.h calibre-autoupdate_checks.h $INC; chmod 644 $INC"calibre-autoupdate.h" $INC"calibre-autoupdate_checks.h" func_progressbar echo -e "\n\033[1;36mDie Konfigurations-Dateien werden nach $ETC kopiert\e[m" cp calibre-autoupdate.conf $ETC; chmod 644 $ETC"calibre-autoupdate.conf"; - sed -i "s/_-CALIBRE_INSTALL_LOCATION-_/${CALIBRE_INSTALL_LOCATION//\//\/}/g" $ETC"calibre-autoupdate.conf" # Ort der Calibreinstall + sed -i "s/_-INC-_/${INC//\//\/}/g" $ETC"calibre-autoupdate.conf" + sed -i "s/_-BIN-_/${BIN//\//\/}/g" $ETC"calibre-autoupdate.conf" + sed -i "s/_-CALIBRE_INSTALL_LOCATION-_/${CALIBRE_INSTALL_LOCATION//\//\/}/g" $ETC"calibre-autoupdate.conf" func_progressbar return 0 } @@ -81,14 +84,17 @@ func_install_root() sudo echo -e "\n\033[1;36mDie Programm-Dateien werden nach $BIN kopiert\e[m\e[m" if [ ! -d $BIN ]; then sudo mkdir $BIN; fi; if [ ! -d $ETC ]; then sudo mkdir $ETC; fi; if [ ! -d $INC ]; then sudo mkdir $INC; fi sudo cp calibre-autoupdate $BIN; sudo chmod 755 $BIN"calibre-autoupdate" - sudo sed -i "s/_-VERSION-_/${VERSION//\//\/}/g" $BIN"calibre-autoupdate" # Der Installer übergibt die Versionsnummer + sudo sed -i "s/_-ETC-_/${ETC//\//\/}/g" $BIN"calibre-autoupdate" + sudo sed -i "s/_-VERSION-_/${VERSION//\//\/}/g" $BIN"calibre-autoupdate" func_progressbar echo -e "\n\033[1;36mDie Header-Dateien werden nach $INC kopiert\e[m" sudo cp calibre-autoupdate.h calibre-autoupdate_checks.h $INC; sudo chmod 644 $INC"calibre-autoupdate.h" $INC"calibre-autoupdate_checks.h" func_progressbar echo -e "\n\033[1;36mDie Konfigurations-Dateien werden nach $ETC kopiert\e[m" sudo cp calibre-autoupdate.conf $ETC; sudo chmod 644 $ETC"calibre-autoupdate.conf"; - sudo sed -i "s/_-CALIBRE_INSTALL_LOCATION-_/${CALIBRE_INSTALL_LOCATION//\//\/}/g" $ETC"calibre-autoupdate.conf" # Ort der Calibreinstall + sudo sed -i "s/_-INC-_/${INC//\//\/}/g" $ETC"calibre-autoupdate.conf" + sudo sed -i "s/_-BIN-_/${BIN//\//\/}/g" $ETC"calibre-autoupdate.conf" + sudo sed -i "s/_-CALIBRE_INSTALL_LOCATION-_/${CALIBRE_INSTALL_LOCATION//\//\/}/g" $ETC"calibre-autoupdate.conf" func_progressbar return 0 } @@ -129,49 +135,4 @@ done func_term_output func_usage echo -e "\e[m" -exit 0 - - - - - - - - - - - - - - - - - - - - - -############################################################################### - -# Die sed Befehle ersetzen in den Programmdateien Platzhalter für den Installationsort. -# Grund hierfür sind die includes der Header unf Configfiles die den kompletten Fad benörigen -# echo -e "\n\033[1;34mDer Calibre-Autoupdater wird nun unter $UPDATER_INSTALL_LOCATION installiert...\e[m"; -# echo -e "\033[1;32mDie Programm-Dateien werden nach $BIN kopiert\e[m" -# cp calibre-autoupdate $BIN - # #sed -i "s/_-ETC-_/${ETC//\//\/}/g" $BIN"calibre-autoupdate" -# #sed -i "s/_-VERSION-_/${VERSION//\//\/}/g" $BIN"calibre-autoupdate" -# chmod 755 $BIN/calibre-autoupdate -# func_progressbar -# echo -e "\n\033[1;32mDie Header-Dateien werden nach $INC kopiert\e[m" -# cp calibre-autoupdate.h calibre-autoupdate_checks.h $INC -# chmod 644 $INC/calibre-autoupdate.h $INC/calibre-autoupdate_checks.h -# func_progressbar -# echo -e "\n\033[1;32mDie Konfigurations-Dateien wird nach $ETC kopiert\e[m" -# cp calibre-autoupdate.conf $ETC -# #sed -i "s/_-INC-_/${INC//\//\/}/g" $ETC"calibre-autoupdate.conf" -# #sed -i "s/_-BIN-_/${BIN//\//\/}/g" $ETC"calibre-autoupdate.conf" -# #sed -i "s/_-CALIBRE_INSTALL_LOCATION-_/${CALIBRE_INSTALL_LOCATION//\//\/}/g" $ETC"calibre-autoupdate.conf" -# chmod 644 $ETC/calibre-autoupdate.conf -# func_progressbar -# return 0 -################################################################################ \ No newline at end of file +exit 0 \ No newline at end of file diff --git a/CAU_Installer.h b/CAU_Installer.h index f786b71..1b7b5ce 100644 --- a/CAU_Installer.h +++ b/CAU_Installer.h @@ -27,7 +27,6 @@ func_help () # Listet alle Optionsschalter auf echo " -h, --help zeigt die Hilfe an" echo " -V, --version gibt die Programmversion aus" echo " -i, --install installiert den Calibre-Autoupdater (CAU)" - echo " --install_calibre installiert Calibre in der aktuellsten Version" echo "" echo -e "Sende Fehler an .\n" return 0 diff --git a/calibre-autoupdate b/calibre-autoupdate index 3e47356..afef1f3 100644 --- a/calibre-autoupdate +++ b/calibre-autoupdate @@ -102,16 +102,18 @@ VERSION="_-VERSION-_" # Diese Version funktioniert für alle Linuxsysteme nur so lange # bis Veränderungen auf der Internetseite durchgeführt wurden ################################# +# Installationsfade in der Verzeichnishierarchie +ETC=_-ETC-_ # Einlesen des Configfiles mit den Variablen für die Calibre Downloadseite, Hauptseite # und den Installationsfaden in der Verzeichnishierarchie -source ../etc/calibre-autoupdate.conf +source $ETC/calibre-autoupdate.conf ################################# ##### Zusätzliche Funktionen aus Headerfiles laden ##### -source ../include/calibre-autoupdate.h -source ../include/calibre-autoupdate_checks.h +source $INC/calibre-autoupdate.h +source $INC/calibre-autoupdate_checks.h ####################################################### ####################################################### @@ -133,9 +135,9 @@ func_update () { case $CHECK_VERCOMP_RESULT in 0) - $NOTIFY "Deine Calibre Version ist auf dem aktuellsten Stand ($CURRENT_VERSION).";; + $NOTIFY "Deine Calibre Version ist auf dem aktuellsten Stand (Version $CURRENT_VERSION).";; 1) - $NOTIFY "Uh Oh! Deine Calibre Version ist aktueller wie die letzte Verfügbare! (Installiert: $CURRENT_VERSION, Letzte Verfügbare: $LATEST_VERSION)";; + $NOTIFY "Uh Oh! Deine Calibre Version ist aktueller wie die letzte Verfügbare! (Installiert: Version $CURRENT_VERSION, Letzte Verfügbare: Version $LATEST_VERSION)";; 2) $NOTIFY "Ein Calibre Update ist verfügbar. (Installiert: $CURRENT_VERSION, letzte Verfügbare: $LATEST_VERSION)" # Installiert die aktuellste verfügbare Version von der Calibre Homepage @@ -149,7 +151,7 @@ func_update () { echo -e "\e[m" sudo -v && wget -nv -O- $DOWNLOAD_URL | sudo python -c "import sys; main=lambda x:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main('$CALIBRE_INSTALL_LOCATION')" fi - $NOTIFY "Calibre wurde auf die neuste Version aktuallisiert.";; + $NOTIFY "Calibre wurde auf die neuste Version $LATEST_VERSION aktuallisiert.";; esac ;; 2) @@ -181,7 +183,9 @@ do --check | -C | -c ) func_check_prog; exit 0 ;; --uninstall | -U | -u ) - func_uninstall; exit 0;; + func_uninstall; exit 0 ;; + --install_calibre ) + func_install_calibre; exit 0 ;; --uninstall_calibre ) func_uninstall_calibre; exit 0 ;; esac diff --git a/calibre-autoupdate.conf b/calibre-autoupdate.conf index b6ac210..7a27e1a 100644 --- a/calibre-autoupdate.conf +++ b/calibre-autoupdate.conf @@ -20,6 +20,6 @@ NOTIFY=/usr/bin/notify-send AWK=/usr/bin/awk # Installationsfade in der Verzeichnishierarchie -#INC=_-INC-_ -#BIN=_-BIN-_ +INC=_-INC-_ +BIN=_-BIN-_ diff --git a/calibre-autoupdate.h b/calibre-autoupdate.h index 79cd9af..c12a9aa 100644 --- a/calibre-autoupdate.h +++ b/calibre-autoupdate.h @@ -29,6 +29,7 @@ func_help () echo " -V, --version gibt die Programmversion aus" echo " -c, --check kontrolliert ob benötigte Programme vorhanden sind" echo " -u, --uninstall deinstalliert den Calibre-Autoupdater" + echo " --install_calibre installiert Calibre in der aktuellsten Version" echo " --uninstall_calibre deinstalliert das Calibre Programm" echo "" echo -e "Sende Fehler an .\n"; @@ -134,13 +135,13 @@ func_uninstall_calibre() func_install_calibre() { # Installationsort von Calibre - read -p "Wo befindet sich die Calibre Installation? [default /opt] " CALIBRE_INSTALL_LOCATION + read -p "Wohin soll Calibre installiert werden? [default /opt] " CALIBRE_INSTALL_LOCATION if [ -z $CALIBRE_INSTALL_LOCATION ]; then CALIBRE_INSTALL_LOCATION=/opt fi while [ ! -d $CALIBRE_INSTALL_LOCATION ]; do echo -e "\n\033[1;31mDas Verzeichnis $CALIBRE_INSTALL_LOCATION existiert nicht. Bitte gib ein existierendes Verzeichnis ein!\e[m" - read -p "Wo befindet sich die Calibre Installation? [default /opt] " CALIBRE_INSTALL_LOCATION + read -p "Wohin soll Calibre installiert werden? [default /opt] " CALIBRE_INSTALL_LOCATION done if [ -w "$CALIBRE_INSTALL_LOCATION" ]; then echo -e "\033[1;32mCalibre wird nun installiert...\n\e[m" diff --git a/calibre-autoupdate_checks.h b/calibre-autoupdate_checks.h index fab694c..b34ef13 100644 --- a/calibre-autoupdate_checks.h +++ b/calibre-autoupdate_checks.h @@ -68,6 +68,38 @@ func_check_run_calibre () { done kill -15 $CALIBRE_PID return 0 + + + + + + + # Installationsort vom Updater + read -p "Wo soll der Calibre-Autoupdater installiert werden? [default /usr/local] " UPDATER_INSTALL_LOCATION + if [ -z $UPDATER_INSTALL_LOCATION ]; then + UPDATER_INSTALL_LOCATION=/usr/local + fi + while [ ! -d $UPDATER_INSTALL_LOCATION ]; do + echo -e "\n\033[1;31mDas Verzeichnis $UPDATER_INSTALL_LOCATION existiert nicht. Bitte gib ein existierendes Verzeichnis ein!\e[m" + read -p "Wo soll der Calibre-Autoupdater installiert werden? [default /usr/local] " UPDATER_INSTALL_LOCATION + done + # Installationsort von Calibre + read -p "Wo befindet sich die Calibre Installation? [default /opt] " CALIBRE_INSTALL_LOCATION + if [ -z $CALIBRE_INSTALL_LOCATION ]; then + CALIBRE_INSTALL_LOCATION=/opt + fi + while [ ! -d $CALIBRE_INSTALL_LOCATION ]; do + echo -e "\n\033[1;31mDas Verzeichnis $CALIBRE_INSTALL_LOCATION existiert nicht. Bitte gib ein existierendes Verzeichnis ein!\e[m" + read -p "Wo befindet sich die Calibre Installation? [default /opt] " CALIBRE_INSTALL_LOCATION + done + + + + + + + + done return 0 } @@ -81,6 +113,7 @@ func_check_run_calibre () { + func_check_version () { #Ermitteln der letzten aktuell verfügbaren Version LATEST_VERSION=`curl -s $CALIBRE_DOWNLOAD_PAGE | grep 'latest release of calibre' | sed 's/[^0-9.]*\([1-9]*[0-9]\.[1-9]*[0-9]\).*/\1/'` @@ -111,19 +144,6 @@ func_check_version () { return 0 } - - - - - - - - - - - - - func_check_prog () { func_term_output if [ ! -f $CURL ]; then