From cf1f000eb5a2b9d8da93ee52013ec368432511b7 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Mon, 14 Apr 2014 19:00:59 +0200 Subject: added include for selecting qt version --- remote/includes/qt.inc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 remote/includes/qt.inc (limited to 'remote/includes') diff --git a/remote/includes/qt.inc b/remote/includes/qt.inc new file mode 100644 index 00000000..e14aed4b --- /dev/null +++ b/remote/includes/qt.inc @@ -0,0 +1,21 @@ +activate_qt() { + [ $# -eq 1 ] || perror "activate_qt() requires the version as only argument, $# given." + local QT_VERSION="$1" + local QT_DEFAULT="$(readlink -f /usr/share/qtchooser/default.conf)" + if [ -e "$QT_DEFAULT" ]; then + [[ "$(basename "$QT_DEFAULT")" =~ ^qt$QT_VERSION.*\.conf$ ]] || perror "Something with QT4 is bad. Check '/usr/share/qtchooser'" + else + # no default active, try to set it + local QT_CANDIDATES="$(ls /usr/share/qtchooser | grep -v default.conf | grep qt$QT_VERSION)" + local QTS="$(echo $QT_CANDIDATES | wc -w)" + if [ "$QTS" -eq 1 ]; then + # we found it, lets activate it and hope for the best + ln -sf /usr/share/qtchooser/$QT_CANDIDATES /usr/share/qtchooser/default.conf \ + || perror "Could not link 'default.conf' to '/usr/share/qtchooser/$QT_CANDIDATES'" + else + # here we have the case with different qt4 files or none at all + # in both cases, there is a bigger problem we shouldn't try to guess which one is correct + perror "Either none or more than 1 qt4 version found in '/usr/share/qtchooser'. The configuration is messy. Fix it first." + fi + fi +} -- cgit v1.2.3-55-g7522