mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-01-03 12:18:11 -06:00
Linux/FreeBSD: Improvements on installation scripts (#1514)
This patch moves away from gnome-terminal -e options which is deprecated and subject to possibly be removed in the future. The -- option is nearly equivalent in behaviour. Also ensures that uninstallation script has correct privileges, adds window title to xmessage and ensures correct files are used during installation.
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
#!/bin/sh
|
||||
V="$(mount | grep veracrypt_aux_mnt)"
|
||||
[ "$V" ] && echo Error: All volumes must be dismounted first. >&2 && exit 1
|
||||
[ "$V" ] && echo "Error: All volumes must be dismounted first." 1>&2 && exit 1
|
||||
|
||||
rm -f /usr/bin/veracrypt
|
||||
rm -f /usr/sbin/mount.veracrypt
|
||||
rm -f /usr/share/applications/veracrypt.desktop
|
||||
rm -f /usr/share/pixmaps/veracrypt.xpm
|
||||
rm -f /usr/share/mime/packages/veracrypt.xml
|
||||
rm -fr /usr/share/veracrypt
|
||||
rm -fr /usr/share/doc/veracrypt
|
||||
removal_failed() {
|
||||
echo "Error: File removal failed, please run the script with elevated privileges." 1>&2 && exit 1
|
||||
}
|
||||
|
||||
rm -f /usr/bin/veracrypt || removal_failed
|
||||
rm -f /usr/sbin/mount.veracrypt || removal_failed
|
||||
rm -f /usr/share/applications/veracrypt.desktop || removal_failed
|
||||
rm -f /usr/share/pixmaps/veracrypt.xpm || removal_failed
|
||||
rm -f /usr/share/mime/packages/veracrypt.xml || removal_failed
|
||||
rm -fr /usr/share/veracrypt || removal_failed
|
||||
rm -fr /usr/share/doc/veracrypt || removal_failed
|
||||
rm -f /usr/bin/veracrypt-uninstall.sh || removal_failed
|
||||
update-mime-database /usr/share/mime >/dev/null 2>&1
|
||||
update-desktop-database -q
|
||||
|
||||
echo VeraCrypt uninstalled.
|
||||
rm -f /usr/bin/veracrypt-uninstall.sh
|
||||
|
||||
@@ -56,7 +56,7 @@ then
|
||||
|
||||
if [ $XMESSAGE -eq 0 ] || ([ $XTERM -eq 0 ] && [ $GTERM -eq 0 ] && [ $KTERM -eq 0 ])
|
||||
then
|
||||
which gnome-terminal && exec gnome-terminal -e "$0"
|
||||
which gnome-terminal && exec gnome-terminal -- "$0"
|
||||
which konsole && exec konsole -e "$0"
|
||||
which xterm && exec xterm -e "$0"
|
||||
|
||||
@@ -81,7 +81,7 @@ show_message()
|
||||
then
|
||||
if [ $XMESSAGE -eq 1 ]
|
||||
then
|
||||
xmessage -center -buttons OK -default OK "$*"
|
||||
xmessage -title "VeraCrypt Setup" -center -buttons OK -default OK "$*"
|
||||
else
|
||||
if [ $TTY -eq 1 ]
|
||||
then
|
||||
@@ -93,7 +93,7 @@ show_message()
|
||||
else
|
||||
if [ $GTERM -eq 1 ]
|
||||
then
|
||||
gnome-terminal --title='VeraCrypt Setup' -e "sh -c \"echo $*; read A\""
|
||||
gnome-terminal --title='VeraCrypt Setup' -- sh -c "echo $*; read A"
|
||||
else
|
||||
if [ $KTERM -eq 1 ]
|
||||
then
|
||||
@@ -849,7 +849,7 @@ INSTALL=-1
|
||||
if [ $XMESSAGE -eq 1 ]
|
||||
then
|
||||
|
||||
cat <<_END | xmessage -center -file - -buttons "Exit:1,Extract .$PACKAGE_TYPE Package File:20,Install VeraCrypt:10" -default 'Install VeraCrypt'
|
||||
cat <<_END | xmessage -title "VeraCrypt Setup" -center -file - -buttons "Exit:1,Extract .$PACKAGE_TYPE Package File:20,Install VeraCrypt:10" -default 'Install VeraCrypt'
|
||||
VeraCrypt $VERSION Setup
|
||||
====================
|
||||
VeraCrypt is a free disk encryption software brought to you by IDRIX
|
||||
@@ -938,7 +938,7 @@ then
|
||||
|
||||
# GUI license agreement
|
||||
|
||||
cat <<_END | cat - $LICENSE | xmessage -center -file - -buttons 'I accept and agree to be bound by the license terms:10,I do not accept:20'
|
||||
cat <<_END | cat - $LICENSE | xmessage -title "VeraCrypt Setup" -center -file - -buttons 'I accept and agree to be bound by the license terms:10,I do not accept:20'
|
||||
|
||||
Before you can use, extract, or install VeraCrypt, you must accept these
|
||||
license terms.
|
||||
@@ -1070,21 +1070,21 @@ then
|
||||
then
|
||||
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"
|
||||
exec xterm -T 'VeraCrypt Setup' -e sh -c "echo Installing package...; $SUDO $PACKAGE_INSTALLER $PACKAGE_INSTALLER_OPTS $PACKAGE; rm -f $PACKAGE; $SUDO update-mime-database /usr/share/mime >/dev/null 2>&1; $SUDO update-desktop-database -q; 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\""
|
||||
exec gnome-terminal --title='VeraCrypt Setup' -- sh -c "echo Installing package...; $SUDO $PACKAGE_INSTALLER $PACKAGE_INSTALLER_OPTS $PACKAGE; rm -f $PACKAGE; $SUDO update-mime-database /usr/share/mime >/dev/null 2>&1; $SUDO update-desktop-database -q; echo; echo Press Enter to exit...; read A"
|
||||
else
|
||||
if [ $KTERM -eq 1 ]
|
||||
then
|
||||
exec konsole --qwindowtitle '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"
|
||||
exec konsole --qwindowtitle 'VeraCrypt Setup' -e sh -c "echo Installing package...; $SUDO $PACKAGE_INSTALLER $PACKAGE_INSTALLER_OPTS $PACKAGE; rm -f $PACKAGE; $SUDO update-mime-database /usr/share/mime >/dev/null 2>&1; $SUDO update-desktop-database -q; echo; echo Press Enter to exit...; read A"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo 'Installing package...'
|
||||
$SUDO $PACKAGE_INSTALLER $PACKAGE_INSTALLER_OPTS $PACKAGE && INSTALLED=1
|
||||
$SUDO $PACKAGE_INSTALLER $PACKAGE_INSTALLER_OPTS $PACKAGE && INSTALLED=1 && $SUDO update-mime-database /usr/share/mime >/dev/null 2>&1 && $SUDO update-desktop-database -q
|
||||
|
||||
if [ $INSTALLED -eq 1 ]
|
||||
then
|
||||
|
||||
Reference in New Issue
Block a user