diff --git a/CAU_Installer b/CAU_Installer new file mode 100755 index 0000000..c6860f8 --- /dev/null +++ b/CAU_Installer @@ -0,0 +1,156 @@ +#!/bin/bash + +# Programmversion +PROGNAME=`basename $0` +VERSION="0.6" +QUIET=0 + +func_term_output () { + ## Beginne mit der Ausgbe ## + tty -s && clear + echo -e "\033[44m \033[0m\033[1m $PROGNAME the Calibre-Autoupdate-Installer Version $VERSION\033[0m\n\033[44m \033[0m 2013-2014 by Leon Gaultier\n"; + return 0 +} + +func_usage () # Gibt Auskunft über Verwendung des Scriptes +{ + echo "Usage: $PROGNAME [OPTION...]" + echo "Try '$PROGNAME --help' or '$PROGNAME -h' for more information." +} + +func_help () # Listet alle Optionsschalter auf +{ + func_term_output + echo "Usage: $PROGNAME [OPTION...]" + echo "$PROGNAME -- the Calibre-Autoupdate-Installer (CAUI)" + echo "" + echo "Options:" + echo " -q, --quiet ohne Konsolenausgabe" + echo " -h, --help zeigt die Hilfe an" + echo " -V, --version gibt die Programmversion aus" + echo " -i, --install installiert den Calibre-Autoupdater (CAU)" + #echo " -u, --uninstall deinstalliert den Calibre-Autoupdater (CAU)" + echo "" + echo -e "Report bugs to .\n"; +} + +func_version () # Versionsauskunft des Installers +{ + echo "$PROGNAME: the Calibre-Autoupdate-Installer (CAUI) v$VERSION" + echo "Copyright (C) Leon Gaultier 2013-2014. This program is distributed" + echo "in the hope that it will be useful, but WITHOUT ANY WARRANTY" + +} + +func_change_install_dir() # Funktion zur Abfrage des Installationsortes +{ +read -p "Wo soll der Calibre Updater installiert werden? [default /usr/local] " UPDATER_INSTALL_LOCATION + + if [ -z $UPDATER_INSTALL_LOCATION ]; then + UPDATER_INSTALL_LOCATION=/usr/local + fi +read -p "Wo befindet sich die Calibre Installation? [default /opt/calibre] " CALIBRE_INSTALL_LOCATION + + if [ -z $CALIBRE_INSTALL_LOCATION ]; then + CALIBRE_INSTALL_LOCATION=/opt/calibre + fi + +# Installationsfade in der Verzeichnishierarchie +INC=$UPDATER_INSTALL_LOCATION/include/ +ETC=$UPDATER_INSTALL_LOCATION/etc/ +BIN=$UPDATER_INSTALL_LOCATION/bin/ +} + +func_check_dir() # Install oder Update Calibre Updater, Check ob Calibre überhaupt installiert ist +{ + if test ! -d $CALIBRE_INSTALL_LOCATION ; then + echo -e "\n\033[1;31mKeine Calibre Installation unter $CALIBRE_INSTALL_LOCATION gefunden. Installation des Updaters wurde abgebrochen.\e[m\n"; >&2 + exit 1 + fi + + if test -f $BIN/calibre-autoupdate ; then # Updater bereits installiert? + while ((!gueltig)); do # beginn der Ja/Nein Abfrage + echo -e "\033[1;34m" + read -sn1 -t 30 -p "Der calibre-autoupdater ist bereits installiert. Möchtest Du ein Update durchführen? [j/n] " answer + echo -e "\e[m" + case "$answer" in + [JjYy]) result=1; gueltig=1 ;; + [Nn]) result=0; gueltig=1 ;; + "") result=0; gueltig=1 ;; + *) gueltig=0 ;; + esac + done + echo + if (( ! result )); then + echo -e "\n\033[1;31mDie installation des Updaters wurde abgebrochen.\e[m\n" + exit 1 + fi + fi +} + +func_install() # Installiert den Calibre Updater +{ +func_term_output +func_change_install_dir +func_check_dir + + if [ -w "$BIN" ]; then + echo -e "\n\033[1;34mDer Calibre Autoupdater wird nun unter $UPDATER_INSTALL_LOCATION installiert...\e[m"; + echo -e "\n\033[1;32mProgrammdatei wird nach $BIN kopiert\e[m"; sleep 3 + cp -v calibre-autoupdate $BIN + chmod -v 755 $BIN/calibre-autoupdate + echo -e "\n\033[1;32mDie Header-Dateien werden nach $INC kopiert\e[m"; sleep 3 + cp -v calibre-autoupdate.h calibre-autoupdate_checks.h $INC + chmod -v 644 $INC/calibre-autoupdate.h $INC/calibre-autoupdate_checks.h + echo -e "\n\033[1;32mDie Konfigurationsdatei wird nach $ETC kopiert\e[m"; sleep 3 + cp -v calibre-autoupdate.conf $ETC + chmod -v 644 $ETC/calibre-autoupdate.conf + + else + echo -e "\n\033[1;34mDu hast kein Schreibrecht auf $UPDATER_INSTALL_LOCATION, daher wird SUDO versucht zu verwenden...\e[m"; + echo -e "\n\033[1;32mProgrammdatei wird nach $BIN kopiert\e[m\e[m"; + sudo cp -v calibre-autoupdate $BIN + sudo chmod -v 755 $BIN/calibre-autoupdate; + echo -e "\n\033[1;32mDie Header-Dateien werden nach $INC kopiert\e[m"; sleep 3 + sudo cp -v calibre-autoupdate.h calibre-autoupdate_checks.h $INC + sudo chmod -v 644 $INC/calibre-autoupdate.h $INC/calibre-autoupdate_checks.h; + echo -e "\n\033[1;32mDie Konfigurationsdatei wird nach $ETC kopiert\e[m"; sleep 3 + sudo cp -v calibre-autoupdate.conf $ETC + sudo chmod -v 644 $ETC/calibre-autoupdate.conf; + fi + echo -e "\n\033[1;36mDer Calibre-Autoupdater wurde erfolgreich installiert\e[m\n" +} + +func_uninstall() +{ +echo +# ist geplant +} + +while test "$#" -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`echo "$arg" | sed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case "$arg" in + --quiet | -q ) + QUIET=1 ;; + --help | -h ) + func_help; exit 0 ;; + --version | -V | -v ) + func_version; exit 0 ;; + --install | -i ) + func_install; exit 0 ;; + --uninstall | -u ) + func_uninstall; exit 0;; + esac + +done +func_term_output +echo -e "\033[1;34mGib eine Option an! Oder verwende -h für Hilfe\n\e[m"; +exit 0 \ No newline at end of file diff --git a/calibre-autoupdate b/calibre-autoupdate deleted file mode 100755 index 1dee23b..0000000 --- a/calibre-autoupdate +++ /dev/null @@ -1,327 +0,0 @@ -#!/bin/bash -# Calibre Auto Updater - The Skript automatically updates your Calibre (http://calibre-ebook.com/) -# Installation -# Copyright (C) 2013-2014 Leon Gaultier -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see -# - - -#################################### -#################################### -# -# Versionsverlauf -# -# v0.1 Body des Skriptes erstellt -# Abfrage neuste Version vorhanden -# Abfrage welche Version installiert -# Funktion Versionsvergleich -# Download und installation der neusten Version -# Desktopmeldungen hinzugefügt -# -# v0.2 Verbesserungen bei den Desktopmeldungen -# -# v0.3 Funktion Check Verfügbarkeit der Downloadseiten hinzugefügt -# -# v0.4 Check Verfügbarkeit auf Test Netzwerk vorhanden und Auswertung erweitert -# diverse Kommentare hinzugefügt -# -# v0.5 Funktion Check läuft noch eine Calibre Instanz mit Counter -# Ausgabe Texte verbessert und erweitert -# URL Statuscodes holen ins main verlagert. !TODO Soll eigene Funktion werden -# -# v0.6 Verbesserungen in der Terminalausgabe, Startausgabe ist eine eigene Funktion -# URL Status Code ist nun eine eigene Funktion -# -# v0.7 Der Updateprozes wurde in eine Prozedure geschrieben und die main Prozedure gibt, -# nur noch Hilfe und Verion aus oder startet sofort die Update Prozedure -# -# v0.8 Optionsschalter hinzugefügt, Kontrolle ob benötigte Programme vorhanden sind. -# Unterschiedliche Installationsart und -dialog je nach dem ob man Schreibrechte -# auf im Calibre Installationspfad hat oder nicht. -# -# TODO auslesen der Download URL von der Download Seite -# kontrolle ob alle benötigten programme für das skript vorhanden sind -# -# -###################################### -###################################### - - - -################################# -######### CONFIGURATION ######### -# Diese Version funktioniert für alle Linuxsysteme nur so lange -# bis Veränderungen auf der Internetseite durchgeführt wurden -################################# - -# Die Download Seiten URL. -export CALIBRE_DOWNLOAD_PAGE=http://calibre-ebook.com/download_linux -# The location of the installed application. -export CALIBRE_INSTALL_LOCATION=/opt -# The download URL -DOWNLOAD_URL=https://github.com/kovidgoyal/calibre/raw/master/setup/linux-installer.py - -# Variablen für den Verfügbarkeitscheck -CHECK_CALIBRE_DOWNLOAD_PAGE=http://calibre-ebook.com -CHECK_DOWNLOAD_URL=https://github.com - -# externe Programme welche benötigt werden -CURL=/usr/bin/curl -NOTIFY=/usr/bin/notify-send -AWK=/usr/bin/awk - -# Programmversion -PROGNAME=`basename $0` -VERSION="0.8" -QUIET=0 - - -################################# -##### Zusätzliche Funktionen ##### - -func_usage () -{ - echo "Usage: $PROGNAME [OPTION...]" - echo "Try '$PROGNAME --help' or '$PROGNAME -h' for more information." -} - -func_help () -{ - func_term_output - echo "Usage: $PROGNAME [OPTION...]" - echo "$PROGNAME -- the Calibre! Linux Edition calibre-autoupdater" - echo "" - echo "Options:" - echo " -q, --quiet ohne Konsolenausgabe" - echo " -h, --help zeigt die Hilfe an" - echo " -V, --version gibt die Programmversion aus" - echo " -c, --check checkt ob benötigte Programme vorhanden sind" - echo "" - echo -e "Report bugs to .\n"; -} - -func_version () -{ - echo "$PROGNAME: the Calibre! autoupdater v$VERSION" - echo "Copyright (C) Leon Gaultier 2013-2014. This program is distributed" - echo "in the hope that it will be useful, but WITHOUT ANY WARRANTY" - -} - -func_vercomp () { # Funktion zum Versionsvergleich - if [[ $1 == $2 ]] - then - return 0 - fi - local IFS=. - local i ver1=($1) ver2=($2) - # fill empty fields in ver1 with zeros - for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)) - do - ver1[i]=0 - done - for ((i=0; i<${#ver1[@]}; i++)) - do - if [[ -z ${ver2[i]} ]] - then - # fill empty fields in ver2 with zeros - ver2[i]=0 - fi - if ((10#${ver1[i]} > 10#${ver2[i]})) - then - return 1 - fi - if ((10#${ver1[i]} < 10#${ver2[i]})) - then - return 2 - fi - done - return 0 -} - -func_check_stat () { # Funktion zum Check Verfügbarkeit der Downloadseiten und der Internetverbindung -# Test for network conection -echo -e "\033[1;34m Ich schau dann mal ob Dein Computer überhaupt ein Netzwerk hat :-)"; -for INTERFACE in $(ls /sys/class/net/ | grep -v lo); -do - if [[ $(cat /sys/class/net/$INTERFACE/carrier) = 1 ]]; then - ONLINE=1 - fi -done - -if [ $ONLINE ]; then - echo -e "\033[32m Oh Wunder! Habe ein Netzwerk gefunden. Verbinde über Interface $INTERFACE, - was nicht heißt das es geht :-P"; - if [[ $stat_1 -eq 200 && $stat_2 -eq 200 ]]; then - return 1 - elif [[ $stat_1 -eq !200 ]]; then - return 2 - else - return 3 - fi -else - echo -e "\033[31m Fehler!!! Sieh Dir die verdammte Desktop Benachrichtigung an!"; - return 4 -fi -} - -func_check_run_calibre () { - CALIBRE_PID=`ps ax | grep /opt/calibre/bin/calibre | grep -v grep | awk '{printf $1}'` - - while [ $CALIBRE_PID ]; - do - $NOTIFY "Um das Update installieren zu können, muss Calibre beendet werden. Calibre wird in einer Minute vom Update Service beendet. !!!Bitte speichere alle wichtigen Daten!!!" - sleep 3 - for (( i=60; i>0; i-- )); - do - echo -e "\033[31m noch \033[32m>>$i<< \033[31m Sekunden bis zum Calibre Programmende" - sleep 1 - clear - func_term_output - done - kill -15 $CALIBRE_PID - return 0 - done - return 0 -} - -func_http_status_code () { - echo -e "\033[1;34m Hole Status Code von \"$CHECK_CALIBRE_DOWNLOAD_PAGE\". Bitte warten."; - stat_1=$(curl -o /dev/null --silent --head --write-out '%{http_code}' $CHECK_CALIBRE_DOWNLOAD_PAGE) - echo -e "\033[32m Status Codes von \"$CHECK_CALIBRE_DOWNLOAD_PAGE\" erhalten"; - echo -e "\033[1;34m Hole Status Code von \"$CHECK_DOWNLOAD_URL\". Bitte warten."; - stat_2=$(curl -o /dev/null --silent --head --write-out '%{http_code}' $CHECK_DOWNLOAD_URL) - echo -e "\033[32m Status Codes von \"$CHECK_DOWNLOAD_URL\" erhalten"; - return 0 -} - -func_term_output () { - ## Beginne mit der Ausgbe ## - tty -s && clear - echo -e "\033[44m \033[0m\033[1m $PROGNAME Version $VERSION\033[0m\n\033[44m \033[0m 2013-2014 by Leon Gaultier\n"; - return 0 -} - -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/'` - #Ermitteln der aktuell installierten Version. - CURRENT_VERSION=`calibre --version | sed 's/[^0-9.]*\([0-9.]*\).*/\1/'` - return 0 -} - - -func_check_prog () { - func_term_output - if test ! -f $CURL ; then - echo -e "\033[31mDu hast Curl nich installiert, es wird aber für die Updatefunktion benötigt\n"; >&2 - exit 1 - fi - - if test ! -f $AWK ; then - echo -e "\033[31mDu hast AWK nich installiert, es wird aber für die Updatefunktion benötigt\n"; >&2 - exit 1 - - if test ! -f $NOTIFY ; then - echo -e "\e[0;33mDu hast Notify-Send nich installiert, das Programm ist optional und wird"; >&2 - echo -e "für die Upatefunktion nicht unbedingt benötigt\n"; >&2 - sleep 10 - fi - - fi - echo -e "\033[32mAlle benötigten Programme sind installiert. Starte $PROGNAME ohne Optionen und" - echo -e "es wird nach einer aktuellen Calibre Version geschaut\n"; -} -####################################################### -####################################################### -## main vom Script --- Start des Updater Skripts - -func_update () { -# Wenn eine grafische Oberfläche vorhanden ist, wird u.a. "notify-send" für Benachrichtigungen verwendet, ansonsten immer "echo" -NOTIFY="echo" -[ -n "$DISPLAY" ] && NOTIFY="notify-send -t 10000 -i /usr/share/icons/hicolor/256x256/apps/calibre-gui.png Calibre-Auto-Updater" - -func_term_output - -func_http_status_code # Funktion hole einen http-status code - -func_check_stat # Funktion check Status Netzwerk und Downloadadressen - -case $? in - 1) - func_check_version - func_vercomp $CURRENT_VERSION $LATEST_VERSION # Funktion Versionvergleich - case $? in - 0) - $NOTIFY "Deine Calibre Version ist auf dem aktuellsten Stand ($CURRENT_VERSION).";; - 1) - $NOTIFY "Uh Oh! Deine Calibre Version ist aktueller wie die letzte Verfügbare! (Installiert: \"$CURRENT_VERSION\", Letzte Verfügbare: \"$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 - func_check_run_calibre # Aufruf der Funktion ob Calibre gestartet ist - - if [ -w "$CALIBRE_INSTALL_LOCATION" ]; then - $NOTIFY "Du hast Schreibrechte auf \"$CALIBRE_INSTALL_LOCATION\" Das Update wird nun installiert..." - echo -e "\033[1;34m" - wget -nv -O- $DOWNLOAD_URL | python -c "import sys; main=lambda x:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main('$CALIBRE_INSTALL_LOCATION')" - else - $NOTIFY "Du hast kein Schreibrecht auf \"$CALIBRE_INSTALL_LOCATION\". Das Update wird mit SUDO installiert. Bitte gib hierzu Dein Userpasswort im Terminalfenster ein..." - echo -e "\033[1;34m" - 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 upgedatet." - ;; - esac - ;; - - 2) - $NOTIFY "Versionsvergleich fehlgeschlagen!!! Die Calibre Homepage \"$CHECK_CALIBRE_DOWNLOAD_PAGE\" ist nicht verfügbar!" - ;; - 3) - $NOTIFY "Update fehlgeschlagen!!! Die Download Seite \"$CHECK_DOWNLOAD_URL\" ist nicht verfügbar!" - ;; - 4) - $NOTIFY "Update und Versionsvergleich fehlgeschlagen!!! Kann kein Netzwerkinterface finden!" - ;; -esac -} - -while test "$#" -gt 0 -do - arg="$1" - shift - - case $arg in - -*=*) optarg=`echo "$arg" | sed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - case "$arg" in - --quiet | -q ) - QUIET=1 ;; - --help | -h ) - func_help; exit 0 ;; - --version | -V | -v ) - func_version; exit 0 ;; - --check | -C | -c ) - func_check_prog; exit 0 ;; - esac - -done -func_check_prog -func_update - -exit 0 \ No newline at end of file diff --git a/calibre-autoupdate.conf b/calibre-autoupdate.conf new file mode 100644 index 0000000..1b4ebbb --- /dev/null +++ b/calibre-autoupdate.conf @@ -0,0 +1,21 @@ +# Calibre Auto Updater Configfile +# Copyright (C) 2013-2014 Leon Gaultier +# + +# Calibre Download Seite URL. +export CALIBRE_DOWNLOAD_PAGE=http://calibre-ebook.com/download_linux +# The location of the installed application. +export CALIBRE_INSTALL_LOCATION=/opt +# The download URL +DOWNLOAD_URL=https://github.com/kovidgoyal/calibre/raw/master/setup/linux-installer.py + +# Variablen für den Verfügbarkeitscheck +# Calibre Hauptseite und Downloadseite +CHECK_CALIBRE_DOWNLOAD_PAGE=http://calibre-ebook.com +CHECK_DOWNLOAD_URL=https://github.com + +# externe Programme welche benötigt werden +CURL=/usr/bin/curl +NOTIFY=/usr/bin/notify-send +AWK=/usr/bin/awk + diff --git a/calibre-autoupdate.h b/calibre-autoupdate.h new file mode 100644 index 0000000..7777abf --- /dev/null +++ b/calibre-autoupdate.h @@ -0,0 +1,63 @@ +# Calibre Auto Updater Configfile +# Copyright (C) 2013-2014 Leon Gaultier +# + +func_usage () +{ + echo "Usage: $PROGNAME [OPTION...]" + echo "Try '$PROGNAME --help' or '$PROGNAME -h' for more information." +} + +func_help () +{ + func_term_output + echo "Usage: $PROGNAME [OPTION...]" + echo "$PROGNAME -- the Calibre! Linux Edition calibre-autoupdater (CAU)" + echo "" + echo "Options:" + echo " -q, --quiet ohne Konsolenausgabe" + echo " -h, --help zeigt die Hilfe an" + echo " -V, --version gibt die Programmversion aus" + echo " -c, --check checkt ob benötigte Programme vorhanden sind" + echo "" + echo -e "Report bugs to .\n"; +} + +func_version () +{ + echo "$PROGNAME: the Calibre! autoupdater v$VERSION" + echo "Copyright (C) Leon Gaultier 2013-2014. This program is distributed" + echo "in the hope that it will be useful, but WITHOUT ANY WARRANTY" + +} + +func_vercomp () { # Funktion zum Versionsvergleich + if [[ $1 == $2 ]] + then + return 0 + fi + local IFS=. + local i ver1=($1) ver2=($2) + # fill empty fields in ver1 with zeros + for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)) + do + ver1[i]=0 + done + for ((i=0; i<${#ver1[@]}; i++)) + do + if [[ -z ${ver2[i]} ]] + then + # fill empty fields in ver2 with zeros + ver2[i]=0 + fi + if ((10#${ver1[i]} > 10#${ver2[i]})) + then + return 1 + fi + if ((10#${ver1[i]} < 10#${ver2[i]})) + then + return 2 + fi + done + return 0 +} diff --git a/calibre-autoupdate_checks.h b/calibre-autoupdate_checks.h new file mode 100644 index 0000000..8b167ac --- /dev/null +++ b/calibre-autoupdate_checks.h @@ -0,0 +1,80 @@ +# Calibre Auto Updater Configfile +# Copyright (C) 2013-2014 Leon Gaultier +# + +func_check_stat () { # Funktion zum Check Verfügbarkeit der Downloadseiten und der Internetverbindung +# Test for network conection +echo -e "\033[1;34m Ich schau dann mal ob Dein Computer überhaupt ein Netzwerk hat :-)"; +for INTERFACE in $(ls /sys/class/net/ | grep -v lo); +do + if [[ $(cat /sys/class/net/$INTERFACE/carrier) = 1 ]]; then + ONLINE=1 + fi +done + +if [ $ONLINE ]; then + echo -e "\033[32m Oh Wunder! Habe ein Netzwerk gefunden. Verbinde über Interface $INTERFACE, + was nicht heißt das es geht :-P"; + if [[ $stat_1 -eq 200 && $stat_2 -eq 200 ]]; then + return 1 + elif [[ $stat_1 -eq !200 ]]; then + return 2 + else + return 3 + fi +else + echo -e "\033[31m Fehler!!! Sieh Dir die verdammte Desktop Benachrichtigung an!"; + return 4 +fi +} + +func_check_run_calibre () { + CALIBRE_PID=`ps ax | grep /opt/calibre/bin/calibre | grep -v grep | awk '{printf $1}'` + + while [ $CALIBRE_PID ]; + do + $NOTIFY "Um das Update installieren zu können, muss Calibre beendet werden. Calibre wird in einer Minute vom Update Service beendet. !!!Bitte speichere alle wichtigen Daten!!!" + sleep 3 + for (( i=60; i>0; i-- )); + do + echo -e "\033[31m noch \033[32m>>$i<< \033[31m Sekunden bis zum Calibre Programmende" + sleep 1 + clear + funct_term_output + done + kill -15 $CALIBRE_PID + return 0 + done + return 0 +} + +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/'` + #Ermitteln der aktuell installierten Version. + CURRENT_VERSION=`calibre --version | sed 's/[^0-9.]*\([0-9.]*\).*/\1/'` + return 0 +} + + +func_check_prog () { + func_term_output + if test ! -f $CURL ; then + echo -e "\033[31mDu hast Curl nich installiert, es wird aber für die Updatefunktion benötigt\n"; >&2 + exit 1 + fi + + if test ! -f $AWK ; then + echo -e "\033[31mDu hast AWK nich installiert, es wird aber für die Updatefunktion benötigt\n"; >&2 + exit 1 + + if test ! -f $NOTIFY ; then + echo -e "\e[0;33mDu hast Notify-Send nich installiert, das Programm ist optional und wird"; >&2 + echo -e "für die Upatefunktion nicht unbedingt benötigt\n"; >&2 + sleep 10 + fi + + fi + echo -e "\033[32mAlle benötigten Programme sind installiert. Starte $PROGNAME ohne Optionen und" + echo -e "es wird nach einer aktuellen Calibre Version geschaut\n"; +} \ No newline at end of file