You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
267 lines
6.8 KiB
267 lines
6.8 KiB
#!/bin/bash
|
|
|
|
# TODO: 2.0: use kdialog
|
|
|
|
META_FULL_NAME="KShutDown"
|
|
META_VERSION="`cat VERSION`"
|
|
|
|
#if [[ (("$TERM" == "dumb") || ("$TERM" == "xterm")) && ("${1}" != "--launch-in-konsole") ]]; then
|
|
# echo
|
|
# echo "Press Ctrl+C to exit $META_FULL_NAME installer"
|
|
# konsole --notabbar --notoolbar --workdir `dirname "${0}"` -T "$META_FULL_NAME Installer" -e ${0} --launch-in-konsole
|
|
# exit
|
|
#fi
|
|
|
|
# installation dirs
|
|
DEFAULT_DIR=`tde-config --prefix`
|
|
if [ -z "$DEFAULT_DIR" ]; then
|
|
DEFAULT_DIR="/usr"
|
|
fi
|
|
INSTALL_DIR="$DEFAULT_DIR"
|
|
|
|
# colors
|
|
DEF_C="\E[37;40m"
|
|
KEY_C="\E[31;40m"
|
|
|
|
# configure options
|
|
CONFIGURE_OPTIONS=""
|
|
FAST_COMPILATION="true"
|
|
|
|
# i18n
|
|
# english
|
|
I18N_TITLE_DOCS="Documentation and License"
|
|
I18N_TITLE_SETUP="Compilation and Installation"
|
|
I18N_CHANGE_DIR="Change installation directory (prefix)"
|
|
I18N_DISABLE_FAST="Disable fast compilation"
|
|
I18N_ENABLE_FAST="Enable fast compilation"
|
|
I18N_INSTALL="Install"
|
|
I18N_LICENSE="License"
|
|
I18N_NEWS="What's new? (q - quit)"
|
|
I18N_PRESS_ENTER="Press <Enter> to exit"
|
|
I18N_QUIT="Quit"
|
|
I18N_THANKS="Thank you for using"
|
|
I18N_MENU="K Menu: Accessories -> KShutDown"
|
|
I18N_CONF_WITH="Configuring with"
|
|
I18N_INST_FAILED="Installation failed!"
|
|
I18N_COMP_FAILED="Compilation failed!"
|
|
I18N_CONF_FAILED="Configuration failed!"
|
|
I18N_COMP_START="Compiling..."
|
|
I18N_MINU=" This may take a few minutes."
|
|
I18N_MISSING_DEPEN1="Make sure you have installed the 'tdelibs-devel' package"
|
|
I18N_MISSING_DEPEN2=" which is required to compile any KDE application."
|
|
I18N_ENTER_DIR="Enter a new prefix"
|
|
I18N_SETUP="Setup"
|
|
I18N_README="Readme"
|
|
|
|
# polish
|
|
if [[ ("$LANG" == "pl_PL.UTF-8") || ("$LANG" == "pl_PL") || ("$LANG" == "pl") ]]; then
|
|
I18N_TITLE_DOCS="Dokumentacja i licencja"
|
|
I18N_TITLE_SETUP="Kompilacja i instalacja"
|
|
I18N_CHANGE_DIR="Zmien katalog instalacji (prefix)"
|
|
I18N_DISABLE_FAST="Wylacz szybka kompilacje"
|
|
I18N_ENABLE_FAST="Wlacz szybka kompilacje"
|
|
I18N_INSTALL="Instaluj"
|
|
I18N_LICENSE="Licencja"
|
|
I18N_NEWS="Co nowego? (q - wyjscie)"
|
|
I18N_PRESS_ENTER="Nacisnij <Enter>, aby wyjsc"
|
|
I18N_QUIT="Zakoncz"
|
|
I18N_THANKS="Dziekujemy za uzycie"
|
|
I18N_MENU="Menu K: Akcesoria -> KShutDown"
|
|
I18N_CONF_WITH="Konfigurowanie z"
|
|
I18N_INST_FAILED="Instalacja nie powiodla sie!"
|
|
I18N_COMP_FAILED="Kompilacja nie powiodla sie!"
|
|
I18N_CONF_FAILED="Konfiguracja nie powiodla sie!"
|
|
I18N_COMP_START="Kompilowanie..."
|
|
I18N_MINU=" To moze potrwac kilka minut."
|
|
I18N_MISSING_DEPEN1="Upewnij sie, ze masz zainstalowana paczke 'tdelibs-devel',"
|
|
I18N_MISSING_DEPEN2=" ktora jest wymagana do kompilacji jakiejkolwiek aplikacji KDE."
|
|
I18N_ENTER_DIR="Wprowadz nowy prefix"
|
|
I18N_SETUP="Instalator"
|
|
I18N_README="Przeczytaj (readme)"
|
|
fi
|
|
|
|
#italian
|
|
if [[ ("$LANG" == "it_IT.UTF-8") || ("$LANG" == "it_IT") || ("$LANG" == "it") ]]; then
|
|
I18N_TITLE_DOCS="Documentazione e Licenza"
|
|
I18N_TITLE_SETUP="Compilazione ed Installazione"
|
|
I18N_CHANGE_DIR="Cambia la cartella di destinazione (prefix)"
|
|
I18N_DISABLE_FAST="Disabilita compilazione veloce"
|
|
I18N_ENABLE_FAST="Abilita compilazione veloce"
|
|
I18N_INSTALL="Installa"
|
|
I18N_LICENSE="Licenza"
|
|
I18N_NEWS="Cosa c'è di nuovo? (q - esci)"
|
|
I18N_PRESS_ENTER="Premi <Enter> per uscire"
|
|
I18N_QUIT="Esci"
|
|
I18N_THANKS="Grazie di usare"
|
|
I18N_MENU="Menu K: Accessori -> KShutDown"
|
|
I18N_CONF_WITH="Configurazione con"
|
|
I18N_INST_FAILED="Installazione fallita!"
|
|
I18N_COMP_FAILED="Compilazione fallita!"
|
|
I18N_CONF_FAILED="Configurazione fallita!"
|
|
I18N_COMP_START="Compilazione..."
|
|
I18N_MINU=" Per questo potrebbero volerci alcuni minuti."
|
|
I18N_MISSING_DEPEN1="Assicurati di aver installato il pacchetto 'tdelibs-devel'"
|
|
I18N_MISSING_DEPEN2=" che è necessario per compilare ogni applicazione KDE."
|
|
I18N_ENTER_DIR="Inserisci una nuova destinazione"
|
|
I18N_SETUP="Installazione"
|
|
I18N_README="Leggimi"
|
|
fi
|
|
# internal functions
|
|
|
|
ks_kill()
|
|
{
|
|
echo
|
|
echo
|
|
echo "$I18N_SETUP: ${1}"
|
|
echo
|
|
echo "$I18N_PRESS_ENTER"
|
|
read
|
|
ks_quit 1
|
|
}
|
|
|
|
ks_quit()
|
|
{
|
|
ks_reset
|
|
exit ${1}
|
|
}
|
|
|
|
ks_reset()
|
|
{
|
|
tput sgr0
|
|
}
|
|
|
|
ks_show_finish_info()
|
|
{
|
|
echo
|
|
echo "$I18N_THANKS $META_FULL_NAME!"
|
|
echo " The $META_FULL_NAME Team"
|
|
echo
|
|
echo "HOW TO RUN?"
|
|
echo
|
|
echo "$I18N_MENU"
|
|
echo "Command: kshutdown"
|
|
echo "Command line options: kshutdown --help"
|
|
echo
|
|
echo -e "$I18N_PRESS_ENTER"
|
|
read
|
|
}
|
|
|
|
ks_show_menu()
|
|
{
|
|
echo -e "$DEF_C"
|
|
clear
|
|
echo
|
|
echo
|
|
echo " $I18N_SETUP"
|
|
echo " $META_FULL_NAME $META_VERSION"
|
|
echo
|
|
echo
|
|
echo -e " ${KEY_C}${I18N_TITLE_SETUP}${DEF_C}"
|
|
echo -e " [${KEY_C}i${DEF_C}] $I18N_INSTALL (./configure --prefix=${INSTALL_DIR}, make, tdesu -c \"make install\")"
|
|
echo -e " [${KEY_C}p${DEF_C}] $I18N_CHANGE_DIR"
|
|
if [ -n "$FAST_COMPILATION" ]; then
|
|
echo -e " [${KEY_C}f${DEF_C}] $I18N_DISABLE_FAST";
|
|
else
|
|
echo -e " [${KEY_C}f${DEF_C}] $I18N_ENABLE_FAST (--enable-final)";
|
|
fi
|
|
echo
|
|
echo -e " ${KEY_C}${I18N_TITLE_DOCS}${DEF_C}"
|
|
echo -e " [${KEY_C}n${DEF_C}] $I18N_NEWS"
|
|
echo -e " [${KEY_C}l${DEF_C}] $I18N_LICENSE (GNU GPL)"
|
|
echo -e " [${KEY_C}r${DEF_C}] $I18N_README"
|
|
echo
|
|
echo -e " [${KEY_C}q${DEF_C}] $I18N_QUIT"
|
|
echo
|
|
echo
|
|
echo " http://kshutdown.sourceforge.net"
|
|
}
|
|
|
|
while [ 1 ]; do
|
|
ks_show_menu
|
|
# wait for a single key
|
|
read -n 1 -s
|
|
|
|
# install
|
|
if [[ ("$REPLY" == "i") || ( "$REPLY" == "I" ) ]]; then
|
|
if [ -n "$FAST_COMPILATION" ]; then
|
|
CONFIGURE_OPTIONS="--prefix=${INSTALL_DIR} --enable-final";
|
|
else
|
|
CONFIGURE_OPTIONS="--prefix=${INSTALL_DIR}";
|
|
fi
|
|
echo
|
|
echo "$I18N_SETUP: $I18N_CONF_WITH '$CONFIGURE_OPTIONS'..."
|
|
echo
|
|
# configure
|
|
if ! [ -f ./configure ]; then
|
|
make -f admin/Makefile.common cvs
|
|
fi
|
|
if ./configure $CONFIGURE_OPTIONS; then
|
|
echo "$I18N_SETUP: $I18N_COMP_START"
|
|
echo "$I18N_MINU"
|
|
if make; then
|
|
if [ -w "${INSTALL_DIR}" ]; then
|
|
if make install; then
|
|
ks_show_finish_info
|
|
ks_quit
|
|
else
|
|
ks_kill "$I18N_INST_FAILED"
|
|
fi
|
|
else
|
|
if tdesu -c "make install"; then
|
|
ks_show_finish_info
|
|
ks_quit
|
|
else
|
|
ks_kill "$I18N_INST_FAILED"
|
|
fi
|
|
fi
|
|
else
|
|
ks_kill "$I18N_COMP_FAILED"
|
|
fi
|
|
else
|
|
echo
|
|
echo
|
|
echo "$I18N_SETUP: $I18N_MISSING_DEPEN1"
|
|
echo "$I18N_MISSING_DEPEN2"
|
|
ks_kill "$I18N_CONF_FAILED"
|
|
fi
|
|
ks_quit
|
|
|
|
# prefix
|
|
elif [[ ("$REPLY" == "p") || ( "$REPLY" == "P" ) ]]; then
|
|
echo
|
|
echo "$I18N_ENTER_DIR [${DEFAULT_DIR}]: "
|
|
read -e
|
|
if [ -z "$REPLY" ]; then
|
|
REPLY="$DEFAULT_DIR"
|
|
fi
|
|
INSTALL_DIR="$REPLY"
|
|
|
|
# toggle fast compilation
|
|
elif [[ ("$REPLY" == "f") || ( "$REPLY" == "F" ) ]]; then
|
|
if [ -z "$FAST_COMPILATION" ]; then
|
|
FAST_COMPILATION="true";
|
|
else
|
|
FAST_COMPILATION="";
|
|
fi
|
|
|
|
# news
|
|
elif [[ ("$REPLY" == "n") || ( "$REPLY" == "N" ) ]]; then
|
|
less "NEWS"
|
|
|
|
# license
|
|
elif [[ ("$REPLY" == "l") || ( "$REPLY" == "L" ) ]]; then
|
|
less "COPYING"
|
|
|
|
# readme
|
|
elif [[ ("$REPLY" == "r") || ( "$REPLY" == "R" ) ]]; then
|
|
less "README"
|
|
|
|
# quit
|
|
elif [[ ("$REPLY" == "q") || ( "$REPLY" == "Q" ) ]]; then
|
|
ks_reset
|
|
clear
|
|
exit
|
|
fi
|
|
|
|
done
|