Installer komplett neu geschrieben. Besserer und sauberer Code, weniger abfragen.
This commit is contained in:
parent
60726764b8
commit
8db5d0e01f
376
CAU_Installer
376
CAU_Installer
@ -18,288 +18,158 @@
|
||||
|
||||
# Programmversion
|
||||
PROGNAME=`basename $0`
|
||||
VERSION="0.14.99.3"
|
||||
VERSION="0.14.99.5"
|
||||
|
||||
##### Variablen deklaration #####
|
||||
# Downloadseite der Linuxinstallation
|
||||
DOWNLOAD_URL=https://github.com/kovidgoyal/calibre/raw/master/setup/linux-installer.py
|
||||
|
||||
#################################
|
||||
########### Einbinden der Headerfiles ################
|
||||
source CAU_Installer.h
|
||||
|
||||
#################################
|
||||
|
||||
|
||||
|
||||
func_term_output () { # einheitliche Terminalausgabe
|
||||
## 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\e[m";
|
||||
return 0
|
||||
}
|
||||
|
||||
func_usage () # Gibt Auskunft über Verwendung des Scriptes
|
||||
func_change_install_dir() # Funktion zur Abfrage der Installationsorte vom Updater und von Calibre
|
||||
{
|
||||
func_term_output
|
||||
echo "Verwendung: $PROGNAME [OPTION...]"
|
||||
echo -e "Verwende $PROGNAME --help oder $PROGNAME -h für mehr Informationen.\n"
|
||||
return 0
|
||||
}
|
||||
|
||||
func_help () # Listet alle Optionsschalter auf
|
||||
{
|
||||
func_term_output
|
||||
echo "Verwende: $PROGNAME [OPTION...]"
|
||||
echo "$PROGNAME -- Der Calibre-Autoupdate-Installer (CAUI)"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
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 <leongaultier@gmail.com>.\n"
|
||||
return 0
|
||||
}
|
||||
|
||||
func_version () # Versionsauskunft des Installers
|
||||
{
|
||||
func_term_output
|
||||
echo "$PROGNAME: Der Calibre-Autoupdate-Installer (CAUI) v$VERSION"
|
||||
echo "Leon Gaultier 2013-2014. Das Programm darf verteilt werden,"
|
||||
echo -e "in der Hoffnung das es hilfreich ist, aber OHNR IRGENDEINE GARANTIE\n"
|
||||
return 0
|
||||
}
|
||||
|
||||
func_change_install_dir() # Funktion zur Abfrage des Installationsortes
|
||||
{
|
||||
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
|
||||
if [ ! -d $UPDATER_INSTALL_LOCATION ]; then
|
||||
echo -e "\n\033[1;31mDas von Dir angegebene Installationsverzeichnis $UPDATER_INSTALL_LOCATION existiert nicht\e[m"
|
||||
while ((!gueltig)); do # beginn der Ja/Nein Abfrage
|
||||
echo -e "\033[1;34m"
|
||||
read -sn1 -t 30 -p "Möchtest Du einen neuen Installationsort angeben? [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
|
||||
if (( ! result )); then
|
||||
echo -e "\n\033[1;31mDie Installation wurde durch Dich ebgebrochen\e[m\n"
|
||||
exit 0
|
||||
fi
|
||||
func_change_install_dir; return 0
|
||||
fi
|
||||
read -p "Wo befindet sich die Calibre Installation? [default /opt] " CALIBRE_INSTALL_LOCATION
|
||||
|
||||
if [ -z $CALIBRE_INSTALL_LOCATION ]; then
|
||||
CALIBRE_INSTALL_LOCATION=/opt
|
||||
fi
|
||||
if [ ! -d $CALIBRE_INSTALL_LOCATION ]; then
|
||||
echo -e "\n\033[1;31mDas Calibre Installationsverzeichnis $CALIBRE_INSTALL_LOCATION existiert nicht\e[m"
|
||||
while ((!gueltig)); do # beginn der Ja/Nein Abfrage
|
||||
echo -e "\033[1;34m"
|
||||
read -sn1 -t 30 -p "Sicherlich hast Du Dich verschrieben. Möchtest Du es erneut versuchen? [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
|
||||
if (( ! result )); then
|
||||
echo -e "\n\033[1;31mDie Installation wurde durch Dich ebgebrochen\e[m\n"
|
||||
exit 0
|
||||
fi
|
||||
func_change_install_dir; return 0
|
||||
fi
|
||||
# Verzeichnishierarchie im Installationsort
|
||||
INC=$UPDATER_INSTALL_LOCATION/include/
|
||||
ETC=$UPDATER_INSTALL_LOCATION/etc/
|
||||
BIN=$UPDATER_INSTALL_LOCATION/bin/
|
||||
return 0
|
||||
}
|
||||
|
||||
func_check_calibre_install() # Install oder Update Calibre Updater, Check ob Calibre überhaupt installiert ist
|
||||
{
|
||||
if test ! -d $CALIBRE_INSTALL_LOCATION/calibre ; then
|
||||
echo -e "\n\033[31mKeine Calibre Installation unter $CALIBRE_INSTALL_LOCATION gefunden.\033[1;34m"
|
||||
while ((!gueltig)); do # beginn der Ja/Nein Abfrage
|
||||
echo -e "\033[1;34m"
|
||||
read -sn1 -t 30 -p "Möchtest Du Calibre jetzt installieren? [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 Calibre-Autoupdaters wurde durch Dich abgebrochen.\e[m\n"
|
||||
exit 0
|
||||
fi
|
||||
echo -e "\033[1;34mNach der Calibre Installation wird die Installation des Calibre Autoupdaters durchgeführt\e[m"
|
||||
sleep 3
|
||||
func_install_calibre
|
||||
|
||||
# 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
|
||||
|
||||
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 Calibre-Autoupdaters wurde durch Dich abgebrochen.\e[m\n"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
func_progressbar()
|
||||
{
|
||||
echo -e -n $'\033[34m------------------------------------------------------------------------- 100%\r'
|
||||
echo -e -n "\033[32m0% "
|
||||
for ((i=0; i<61; i++)); do
|
||||
echo -e -n "\033[32m="
|
||||
case $i in
|
||||
15)
|
||||
echo -e -n "25%" ;;
|
||||
30)
|
||||
echo -e -n "50%" ;;
|
||||
45)
|
||||
echo -e -n "75%" ;;
|
||||
60)
|
||||
echo -e -n " 100%" ;;
|
||||
esac
|
||||
sleep 0.07
|
||||
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
|
||||
echo -e "\e[m"
|
||||
# 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
|
||||
# Verzeichnishierarchie im Installationsort
|
||||
INC=$UPDATER_INSTALL_LOCATION/include/
|
||||
ETC=$UPDATER_INSTALL_LOCATION/etc/
|
||||
BIN=$UPDATER_INSTALL_LOCATION/bin/
|
||||
return 0
|
||||
}
|
||||
|
||||
func_install_noroot()
|
||||
{
|
||||
# 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;32mProgramm-Dateien wird 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
|
||||
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
|
||||
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";
|
||||
func_progressbar
|
||||
return 0
|
||||
}
|
||||
|
||||
func_install_root()
|
||||
{
|
||||
# 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;34mDu hast kein Schreibrecht auf $UPDATER_INSTALL_LOCATION, daher wird SUDO versucht zu verwenden...\e[m";
|
||||
sudo echo -e "\033[1;36mProgramm-Dateien wird nach $BIN kopiert\e[m\e[m"
|
||||
sudo cp calibre-autoupdate $BIN
|
||||
sudo sed -i "s/_-ETC-_/${ETC//\//\/}/g" $BIN"calibre-autoupdate"
|
||||
sudo sed -i "s/_-VERSION-_/${VERSION//\//\/}/g" $BIN"calibre-autoupdate"
|
||||
sudo chmod 755 $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 wird nach $ETC kopiert\e[m"
|
||||
sudo cp calibre-autoupdate.conf $ETC
|
||||
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"
|
||||
sudo chmod 644 $ETC"calibre-autoupdate.conf";
|
||||
func_progressbar
|
||||
echo -e "\n\033[1;34mDu hast kein Schreibrecht auf $UPDATER_INSTALL_LOCATION, daher wird SUDO versucht zu verwenden...\e[m";
|
||||
sudo echo -e "\n\033[1;36mProgramm-Dateien wird 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
|
||||
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 wird nach $ETC kopiert\e[m"
|
||||
sudo cp calibre-autoupdate.conf $ETC; sudo chmod 644 $ETC"calibre-autoupdate.conf";
|
||||
func_progressbar
|
||||
return 0
|
||||
}
|
||||
|
||||
func_install_process() # Installiert den Calibre Updater
|
||||
{
|
||||
func_term_output
|
||||
func_change_install_dir
|
||||
# func_check_dir_structur
|
||||
func_check_calibre_install
|
||||
|
||||
if [ -w "$UPDATER_INSTALL_LOCATION" ]; then
|
||||
func_install_noroot
|
||||
else
|
||||
func_install_root
|
||||
fi
|
||||
echo -e "\n\n\033[1;36mDer Calibre-Autoupdater wurde erfolgreich installiert und"
|
||||
echo -e "kann nun mit calibre-update oder $BIN"calibre-update" aufgerufen werden\e[m\n"
|
||||
}
|
||||
|
||||
func_install_calibre()
|
||||
{
|
||||
if [ ! $CALIBRE_INSTALL_LOCATION ]; then
|
||||
func_term_output
|
||||
read -p "Wohin soll Calibre installiert werden? [default /opt] " CALIBRE_INSTALL_LOCATION
|
||||
fi
|
||||
if [ -z $CALIBRE_INSTALL_LOCATION ]; then
|
||||
CALIBRE_INSTALL_LOCATION=/opt
|
||||
fi
|
||||
if [ -w "$CALIBRE_INSTALL_LOCATION" ]; then
|
||||
echo -e "\033[1;32mCalibre wird nun installiert...\n\e[m"
|
||||
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
|
||||
echo -e "\033[1;34mDu hast kein Schreibrecht auf $CALIBRE_INSTALL_LOCATION. Calibre wird mit SUDO installiert. Bitte gib hierzu Dein Userpasswort ein...\n\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
|
||||
echo -e "\n\n\033[1;36mHerzlichen Glückwunsch. Calibre wurde installiert und kann nun mit "calibre" verwendet werden.\n\033[0m"
|
||||
sleep 5
|
||||
func_install_process
|
||||
func_change_install_dir
|
||||
if [ -w "$UPDATER_INSTALL_LOCATION" ]; then
|
||||
func_install_noroot
|
||||
else
|
||||
func_install_root
|
||||
fi
|
||||
echo -e "\n\n\033[1;36mDer Calibre-Autoupdater wurde erfolgreich installiert und"
|
||||
echo -e "kann nun mit \"calibre-update\" oder \"$BIN"calibre-update"\" aufgerufen werden\e[m\n"
|
||||
return 0
|
||||
}
|
||||
|
||||
while test "$#" -gt 0
|
||||
do
|
||||
arg="$1"
|
||||
shift
|
||||
|
||||
case $arg in
|
||||
-*=*) optarg=`echo "$arg" | sed -e 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
#### Main Funktion ####
|
||||
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
|
||||
--help | -h )
|
||||
case "$arg" in
|
||||
--help | -h )
|
||||
func_help; exit 0 ;;
|
||||
--version | -V | -v )
|
||||
--version | -V | -v )
|
||||
func_version; exit 0 ;;
|
||||
--install | -i | -I )
|
||||
--install | -i | -I )
|
||||
func_install_process; exit 0 ;;
|
||||
--install_calibre )
|
||||
func_install_calibre; exit 0
|
||||
esac
|
||||
esac
|
||||
done
|
||||
func_term_output
|
||||
func_usage
|
||||
echo -e "\e[m"
|
||||
exit 0
|
||||
|
||||
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
|
||||
################################################################################
|
@ -87,9 +87,6 @@
|
||||
######################################
|
||||
######################################
|
||||
|
||||
# Installationsfade in der Verzeichnishierarchie
|
||||
ETC=_-ETC-_
|
||||
|
||||
|
||||
# Programmversion
|
||||
PROGNAME=`basename $0`
|
||||
@ -101,16 +98,17 @@ VERSION="_-VERSION-_"
|
||||
# bis Veränderungen auf der Internetseite durchgeführt wurden
|
||||
#################################
|
||||
|
||||
|
||||
# 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 $INC/calibre-autoupdate.h
|
||||
source $INC/calibre-autoupdate_checks.h
|
||||
source ../include/calibre-autoupdate.h
|
||||
source ../include/calibre-autoupdate_checks.h
|
||||
|
||||
|
||||
|
||||
|
@ -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-_
|
||||
|
||||
|
@ -124,4 +124,38 @@ func_uninstall_calibre()
|
||||
fi
|
||||
echo -e "\n\033[1;32mCalibre würde DeInstalliert! Schade es ist ein tolles Programm zur eBookverwaltung :-)\n\e[m"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func_install_calibre()
|
||||
{
|
||||
if [ ! $CALIBRE_INSTALL_LOCATION ]; then
|
||||
func_term_output
|
||||
read -p "Wohin soll Calibre installiert werden? [default /opt] " CALIBRE_INSTALL_LOCATION
|
||||
fi
|
||||
if [ -z $CALIBRE_INSTALL_LOCATION ]; then
|
||||
CALIBRE_INSTALL_LOCATION=/opt
|
||||
fi
|
||||
if [ -w "$CALIBRE_INSTALL_LOCATION" ]; then
|
||||
echo -e "\033[1;32mCalibre wird nun installiert...\n\e[m"
|
||||
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
|
||||
echo -e "\033[1;34mDu hast kein Schreibrecht auf $CALIBRE_INSTALL_LOCATION. Calibre wird mit SUDO installiert. Bitte gib hierzu Dein Userpasswort ein...\n\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
|
||||
echo -e "\n\n\033[1;36mHerzlichen Glückwunsch. Calibre wurde installiert und kann nun mit "calibre" verwendet werden.\n\033[0m"
|
||||
sleep 5
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user