From 5012e0941a7f9fd00342513b4857969fd867cc30 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Tue, 10 Feb 2015 12:40:49 +0100 Subject: Linux: Add graphical installer support when xterm is not available (Linux Mint case) --- src/Main/Main.make | 2 +- src/Setup/Linux/veracrypt_install_template.sh | 40 ++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/Main/Main.make b/src/Main/Main.make index 39221b46..7d3a9cf5 100644 --- a/src/Main/Main.make +++ b/src/Main/Main.make @@ -197,7 +197,7 @@ endif @echo "VERSION=$(TC_VERSION)" >> $(INTERNAL_INSTALLER_NAME) @echo "PACKAGE_TYPE=tar" >> $(INTERNAL_INSTALLER_NAME) @echo "PACKAGE_NAME=$(PACKAGE_NAME)" >> $(INTERNAL_INSTALLER_NAME) - @echo "PACKAGE_START=864" >> $(INTERNAL_INSTALLER_NAME) + @echo "PACKAGE_START=896" >> $(INTERNAL_INSTALLER_NAME) @echo "INSTALLER_TYPE=$(INSTALLER_TYPE)" >> $(INTERNAL_INSTALLER_NAME) @cat $(PWD)/Setup/Linux/veracrypt_install_template.sh >> $(INTERNAL_INSTALLER_NAME) diff --git a/src/Setup/Linux/veracrypt_install_template.sh b/src/Setup/Linux/veracrypt_install_template.sh index 305fd4ad..427f9320 100644 --- a/src/Setup/Linux/veracrypt_install_template.sh +++ b/src/Setup/Linux/veracrypt_install_template.sh @@ -21,6 +21,8 @@ tty >/dev/null 2>/dev/null && TTY=1 GUI=0 XMESSAGE=0 XTERM=0 +GTERM=0 +KTERM=0 case $PACKAGE_TYPE in @@ -36,13 +38,15 @@ then GUI=1 which xmessage >/dev/null 2>/dev/null && XMESSAGE=1 which xterm >/dev/null 2>/dev/null && XTERM=1 + which gnome-terminal >/dev/null 2>/dev/null && GTERM=1 + which konsole >/dev/null 2>/dev/null && KTERM=1 fi if [ $TTY -eq 0 ] then [ $GUI -eq 0 ] && echo 'Error: Terminal required' >&2 && exit 1 - if [ $XMESSAGE -eq 0 ] || [ $XTERM -eq 0 ] + if [ $XMESSAGE -eq 0 ] || ([ $XTERM -eq 0 ] && [ $GTERM -eq 0 ] && [ $KTERM -eq 0 ]) then which gnome-terminal && exec gnome-terminal -e "$0" which konsole && exec konsole -e "$0" @@ -53,11 +57,13 @@ then fi fi -if [ $XMESSAGE -eq 0 ] || [ $XTERM -eq 0 ] +if [ $XMESSAGE -eq 0 ] || ([ $XTERM -eq 0 ] && [ $GTERM -eq 0 ] && [ $KTERM -eq 0 ]) then GUI=0 XMESSAGE=0 XTERM=0 + GTERM=0 + KTERM=0 fi @@ -73,7 +79,20 @@ show_message() then echo "$*" else - xterm -T 'VeraCrypt Setup' -e sh -c "echo $*; read A" + if [ $XTERM -eq 1 ] + then + xterm -T 'VeraCrypt Setup' -e sh -c "echo $*; read A" + else + if [ $GTERM -eq 1 ] + then + gnome-terminal --title='VeraCrypt Setup' -e "sh -c \"echo $*; read A\"" + else + if [ $KTERM -eq 1 ] + then + konsole -T 'VeraCrypt Setup' -e "sh -c \"echo $*; read A\"" + fi + fi + fi fi fi else @@ -833,7 +852,20 @@ then if [ $GUI -eq 1 ] then - exec xterm -T 'VeraCrypt Setup' -e sh -c "echo Installing package...; $SUDO $PACKAGE_INSTALLER $PACKAGE_INSTALLER_OPTS $PACKAGE; rm -f $PACKAGE; echo; echo Press Enter to exit...; read A" + if [ $XTERM -eq 1 ] + then + exec xterm -T 'VeraCrypt Setup' -e sh -c "echo Installing package...; $SUDO $PACKAGE_INSTALLER $PACKAGE_INSTALLER_OPTS $PACKAGE; rm -f $PACKAGE; echo; echo Press Enter to exit...; read A" + else + if [ $GTERM -eq 1 ] + then + exec gnome-terminal --title='VeraCrypt Setup' -e "sh -c \"echo Installing package...; $SUDO $PACKAGE_INSTALLER $PACKAGE_INSTALLER_OPTS $PACKAGE; rm -f $PACKAGE; echo; echo Press Enter to exit...; read A\"" + else + if [ $KTERM -eq 1 ] + then + exec konsole -T 'VeraCrypt Setup' -e "sh -c \"echo Installing package...; $SUDO $PACKAGE_INSTALLER $PACKAGE_INSTALLER_OPTS $PACKAGE; rm -f $PACKAGE; echo; echo Press Enter to exit...; read A\"" + fi + fi + fi else echo 'Installing package...' $SUDO $PACKAGE_INSTALLER $PACKAGE_INSTALLER_OPTS $PACKAGE && INSTALLED=1 -- cgit v1.2.3