cryptomator.sh 912 B

12345678910111213141516171819202122
  1. #!/bin/sh
  2. cd $(dirname $0)
  3. # determine GTK version
  4. GTK2_PRESENT=1 # initially false
  5. GTK3_PRESENT=0 # initially true
  6. if command -v dpkg &> /dev/null; then # do stuff for debian based things
  7. GTK2_PRESENT=`dpkg -l libgtk* | grep -e '\^ii' | grep -e 'libgtk2-*' &> /dev/null; echo $?`
  8. GTK3_PRESENT=`dpkg -l libgtk* | grep -e '\^ii' | grep -e 'libgtk-3-*' &> /dev/null; echo $?`
  9. elif command -v rpm &> /dev/null; then # do stuff for rpm based things (including yum/dnf)
  10. GTK2_PRESENT=`rpm -qa | grep -e '\^gtk2-[0-9][0-9]*' &> /dev/null; echo $?`
  11. GTK3_PRESENT=`rpm -qa | grep -e '\^gtk3-[0-9][0-9]*' &> /dev/null; echo $?`
  12. elif command -v pacman &> /dev/null; then # don't forget arch
  13. GTK2_PRESENT=`pacman -Qi gtk2 &> /dev/null; echo $?`
  14. GTK3_PRESENT=`pacman -Qi gtk3 &> /dev/null; echo $?`
  15. fi
  16. if [ "$GTK2_PRESENT" -eq 0 ] && [ "$GTK3_PRESENT" -ne 0 ]; then
  17. bin/Cryptomator-gtk2 $@
  18. else
  19. bin/Cryptomator $@
  20. fi