4 Geeqie is an image viewer.
5 This script will download, compile, and install Geeqie on Debian-based systems.
6 If run from a folder that already contains the Geeqie sources, the source
7 code will be updated from the repository.
8 Dialogs allow the user to install additional features, including
9 additional pixbuf loaders.
11 Command line options are:
12 -v --version The version of this file
13 -h --help Output this text
14 -c --commit=ID Checkout and compile commit ID
15 -t --tag=TAG Checkout and compile TAG (e.g. v1.4 or v1.3)
16 -b --back=N Checkout commit -N (e.g. "-b 1" for last-but-one commit)
17 -d --debug=yes Compile with debug output
20 # Essential for compiling
29 # Optional for both GTK2 and GTK3
31 "LCMS (for color management)"
33 "exiv2 (for exif handling)"
35 "lua (for --remote commands)"
37 "libffmpegthumbnailer (for mpeg thumbnails)"
38 "libffmpegthumbnailer-dev"
39 "libtiff (for tiff support)"
41 "libjpeg (for jpeg support"
43 "librsvg2 (for viewing .svg images"
45 "libwmf (for viewing .wmf images)"
47 "exiftran (for image rotation)"
49 "imagemagick (for image rotation)"
51 "ufraw (for RAW file handling)"
53 "markdown (for generating README help file)"
57 # Optional for GTK3 only
59 "libchamplain gtk (for GPS maps)"
60 "libchamplain-gtk-0.12-dev"
61 "libchamplain (for GPS maps)"
62 "libchamplain-0.12-dev"
63 "libpoppler (for pdf file preview)"
67 # Optional pixbuf loaders
68 optional_loaders_array=(
71 ".psd Photoshop images"
77 ####################################################################
79 # Derived from: https://github.com/coto/server-easy-install (GPL)
80 ####################################################################
83 echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
88 OS=`lowercase \`uname\``
92 if [ "${OS}" == "windowsnt" ]
95 elif [ "${OS}" == "darwin" ]
100 if [ "${OS}" = "SunOS" ]
104 OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"
105 elif [ "${OS}" = "AIX" ]
107 OSSTR="${OS} `oslevel` (`oslevel -r`)"
108 elif [ "${OS}" = "Linux" ]
110 if [ -f /etc/redhat-release ]
112 DistroBasedOn='RedHat'
113 DIST=`cat /etc/redhat-release |sed s/\ release.*//`
114 PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
115 REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
116 elif [ -f /etc/SuSE-release ]
119 PSUEDONAME=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`
120 REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`
121 elif [ -f /etc/mandrake-release ]
123 DistroBasedOn='Mandrake'
124 PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
125 REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
126 elif [ -f /etc/debian_version ]
128 DistroBasedOn='Debian'
129 if [ -f /etc/lsb-release ]
131 DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }'`
132 PSUEDONAME=`cat /etc/lsb-release | grep '^DISTRIB_CODENAME' | awk -F= '{ print $2 }'`
133 REV=`cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F= '{ print $2 }'`
136 if [ -f /etc/UnitedLinux-release ]
138 DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]"
141 DistroBasedOn=`lowercase $DistroBasedOn`
144 readonly DistroBasedOn
155 arraylength=${#essential_array[@]}
156 for (( i=0; i<${arraylength}; i=i+1 ));
158 package_query ${essential_array[$i]}
161 package_install ${essential_array[$i]}
165 if [[ $1 == "GTK3" ]]
167 package_query "libgtk-3-dev"
170 package_install libgtk-3-dev
173 package_query "libgtk2.0-dev"
176 package_install libgtk2.0-dev
199 rm -rf webp-pixbuf-loader-master
200 package_install libglib2.0-dev libgdk-pixbuf2.0-dev libwebp-dev python-minimal
201 wget https://github.com/aruiz/webp-pixbuf-loader/archive/master.zip
203 cd webp-pixbuf-loader-master
206 sudo --askpass ./waf install
207 sudo --askpass gdk-pixbuf-query-loaders --update-cache
209 rm -rf webp-pixbuf-loader-master
215 rm -rf gdk-pixbuf-psd
216 git clone https://github.com/and-rom/gdk-pixbuf-psd.git
220 sudo --askpass make install
221 sudo --askpass gdk-pixbuf-query-loaders --update-cache
223 rm -rf gdk-pixbuf-psd
228 rm -rf xcf-pixbuf-loader
229 package_install libbz2-dev
230 git clone https://github.com/StephaneDelcroix/xcf-pixbuf-loader.git
235 # There must be a better way...
236 loader_locn=$(gdk-pixbuf-query-loaders | grep "LoaderDir" | tr -d '#[:space:]')
245 sudo --askpass cp .libs/libioxcf.so $2
246 sudo --askpass gdk-pixbuf-query-loaders --update-cache
249 rm -rf xcf-pixbuf-loader
252 install_extra_loaders()
254 if [ -n "$extra_loaders" ]
282 current_dir=$(basename $PWD)
283 if [[ $current_dir == "geeqie" ]]
285 sudo --askpass make uninstall
286 zenity --title="Uninstall Geeqie" --width=370 --text="WARNING.\nThis will delete folder:\n\n$PWD\n\nand all sub-folders!" --question --ok-label="Cancel" --cancel-label="OK" 2>/dev/null
291 sudo --askpass rm -rf geeqie
294 zenity --title="Uninstall Geeqie" --width=370 --text="This is not a geeqie installation folder!\n\n$PWD" --warning 2>/dev/null
302 if [[ $DistroBasedOn == "debian" ]]
304 res=$(dpkg-query --show --showformat='${Status}' $1 2>>$install_log)
305 if [[ "$res" == "install ok installed"* ]]
317 if [[ $DistroBasedOn == "debian" ]]
319 sudo --askpass apt-get --assume-yes install $@ >>$install_log 2>&1
325 rm $install_pass_script >/dev/null 2>&1
326 #~ rm $install_log >/dev/null 2>&1
328 if [[ -p $zen_pipe ]]
330 echo "100" > $zen_pipe
331 echo "#End" > $zen_pipe
334 zenity --title="$title" --width=370 --text=$'Geeqie is not installed\nLog file: '$install_log --info 2>/dev/null
336 rm $zen_pipe >/dev/null 2>&1
343 # If uninstall has been run, maybe the current directory no longer exists
347 zenity --error --title="Install Geeqie and dependencies" --width=370 --text="Folder $PWD does not exist!" 2>/dev/null
354 if [[ $DistroBasedOn != "debian" ]]
356 zenity --error --title="Install Geeqie and dependencies" --width=370 --text="Unknown operating system:\n
357 Operating System: $OS
359 Psuedoname: $PSUEDONAME
361 DistroBasedOn: $DistroBasedOn
363 Machine: $MACH" 2>/dev/null
368 # Parse the comand line
369 OPTS=$(getopt -o vhc:t:b:d: --long version,help,commit:,tag:,back:,debug: -- "$@")
408 # If a Geeqie folder already exists here, warn the user
411 zenity --info --title="Install Geeqie and dependencies" --width=370 --text="This script is for use on Ubuntu and other\nDebian-based installations.\nIt will download, compile, and install Geeqie source\ncode and its dependencies.\n\nA sub-folder named \"geeqie\" will be created in the\nfolder this script is run from, and the source code\nwill be downloaded to that sub-folder.\n\nA sub-folder of that name already exists.\nPlease try another folder." 2>/dev/null
416 # If it looks like a Geeqie download folder, assume an update
417 if [ -d ".git" ] && [ -d "src" ] && [ -f "geeqie.1" ]
421 # If it looks like something else is already installed here, warn the user
422 if [ -d ".git" ] || [ -d "src" ]
424 zenity --info --title="Install Geeqie and dependencies" --width=370 --text="This script is for use on Ubuntu and other\nDebian-based installations.\nIt will download, compile, and install Geeqie source\ncode and its dependencies.\n\nIt looks like you are running this script from a folder which already has software installed.\n\nPlease try another folder." 2>/dev/null
432 # Use GTK3 as default
436 if [[ $mode == "install" ]]
438 message="This script is for use on Ubuntu and other\nDebian-based installations.\nIt will download, compile, and install Geeqie source\ncode and its dependencies.\n\nA sub-folder named \"geeqie\" will be created in the\nfolder this script is run from, and the source code\nwill be downloaded to that sub-folder.\n\nIn this dialog you must select whether to compile\nfor GTK2 or GTK3.\nIf you want to use GPS maps or pdf preview,\nyou must choose GTK3.\nThe GTK2 version has a slightly different\nlook-and-feel compared to the GTK3 version,\nbut otherwise has the same features.\nYou may easily switch between the two after\ninstallation.\n\nIn subsequent dialogs you may choose which\noptional features to install."
440 title="Install Geeqie and dependencies"
443 message="This script is for use on Ubuntu and other\nDebian-based installations.\nIt will update the Geeqie source code and its\ndependencies, and will compile and install Geeqie.\n\nYou may also switch the installed version from\nGTK2 to GTK3 and vice versa.\n\nIn this dialog you must select whether to compile\nfor GTK2 or GTK3.\nIf you want to use GPS maps or pdf preview,\nyou must choose GTK3.\nThe GTK2 version has a slightly different\nlook-and-feel compared to the GTK3 version,\nbut otherwise has the same features.\n\nIn subsequent dialogs you may choose which\noptional features to install."
445 title="Update Geeqie and re-install"
448 # When updating, use previous installation as default
449 if [[ -f config.log ]]
451 grep gtk-2.0 config.log >/dev/null
463 # Ask whether to install GTK2 or GTK3 or uninstall
465 gtk_version=$(zenity --title="$title" --width=370 --text="$message" --list --radiolist --column "" --column "" "$gtk3_installed" "GTK3 (required for GPS maps and pdf preview)" "$gtk2_installed" "GTK2" FALSE "Uninstall" --cancel-label="Cancel" --ok-label="OK" --hide-header 2>/dev/null)
472 # Environment variable SUDO_ASKPASS cannot be "zenity --password",
473 # so create a temporary script containing the command
474 install_pass_script=$(mktemp --tmpdir geeqie_install_XXXXXX.sh)
476 zenity --password --title=\"'$title$'\" --width=370 2>/dev/null
481 \n' > $install_pass_script
482 chmod +x $install_pass_script
483 export SUDO_ASKPASS=$install_pass_script
485 if [[ $gtk_version == "Uninstall" ]]
491 # Put the install log in tmp, to avoid writing to PWD during a new install
492 rm install.log 2>/dev/null
493 install_log=$(mktemp --tmpdir geeqie_install_XXXXXX.log)
495 sleep 100 | zenity --title="$title" --text="Checking for installed files" --width=370 --progress --pulsate 2>/dev/null &
498 # Get the standard options that are not yet installed
499 arraylength=${#optional_array[@]}
500 for (( i=0; i<${arraylength}; i=i+2 ));
502 package_query ${optional_array[$i+1]}
505 if [ -z "$option_string" ]
507 option_string="$install_option"$'\n'"${optional_array[$i]}"$'\n'"${optional_array[$i+1]}"
509 option_string="$option_string"$'\n'"$install_option"$'\n'"${optional_array[$i]}"$'\n'"${optional_array[$i+1]}"
514 # If GTK3 required, get the GTK3 options not yet installed
515 if [[ "$gtk_version" == "GTK3"* ]]
517 arraylength=${#optional_gtk3_array[@]}
518 for (( i=0; i<${arraylength}; i=i+2 ));
520 package_query ${optional_gtk3_array[$i+1]}
523 if [ -z "$option_string" ]
525 option_string="$install_option"$'\n'"${optional_gtk3_array[$i]}"$'\n'"${optional_gtk3_array[$i+1]}"
527 option_string="$option_string"$'\n'"$install_option"$'\n'"${optional_gtk3_array[$i]}"$'\n'"${optional_gtk3_array[$i+1]}"
533 # Get the optional loaders not yet installed
535 gdk-pixbuf-query-loaders | grep WebP >/dev/null
538 if [ -z "$loaders_string" ]
540 loaders_string=$'FALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
542 loaders_string="$loaders_string"$'\nFALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
548 gdk-pixbuf-query-loaders | grep psd >/dev/null
551 if [ -z "$loaders_string" ]
553 loaders_string=$'FALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
555 loaders_string="$loaders_string"$'\nFALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
560 gdk-pixbuf-query-loaders | grep xcf >/dev/null
563 if [ -z "$loaders_string" ]
565 loaders_string=$'FALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
567 loaders_string="$loaders_string"$'\nFALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
571 kill $zen_pid 2>/dev/null
573 # Ask the user which options to install
574 if [ -n "$option_string" ]
576 options=$(echo "$option_string" | zenity --title="$title" --width=400 --height=500 --list --checklist --text 'Select which library files to install:' --column='Select' --column='Library files' --column='Library' --hide-column=3 --print-column=3 2>/dev/null)
584 # Ask the user which extra loaders to install
585 if [ -n "$loaders_string" ]
587 extra_loaders=$(echo "$loaders_string" | zenity --title="$title" --width=370 --height=400 --list --checklist --text 'These loaders are not part of the main repository,\nbut are known to work to some extent.' --column='Select' --column='Library files' --column='Library' --hide-column=3 --print-column=3 2>/dev/null)
595 # Start of Zenity progress section
596 zen_pipe=$(mktemp --dry-run --tmpdir geeqie_install_pipe_XXXXXX)
598 (tail -f $zen_pipe 2>/dev/null) | zenity --progress --title="$title" --width=370 --text="Installing options..." --auto-close --auto-kill --percentage=0 2>/dev/null &
601 echo "#Installing essential libraries..." > $zen_pipe
603 install_essential $gtk_version
606 echo "#Installing options..." > $zen_pipe
611 echo "#Installing extra loaders..." > $zen_pipe
613 install_extra_loaders
615 echo "10" > $zen_pipe
616 echo "#Getting new sources from server..." > $zen_pipe
618 if [[ $mode == "install" ]]
620 ret=$(git clone git://www.geeqie.org/geeqie.git >>$install_log 2>&1)
622 git checkout master >>$install_log 2>&1
625 git_error=$(tail -n5 $install_log 2>&1)
626 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
629 ret=$(git pull >>$install_log 2>&1)
634 git_error=$(tail -n5 $install_log 2>&1)
635 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
639 echo "20" > $zen_pipe
640 echo "#Cleaning installed version..." > $zen_pipe
642 if [[ $mode == "install" ]]
646 sudo --askpass make uninstall >>$install_log 2>&1
647 sudo --askpass make maintainer-clean >>$install_log 2>&1
650 echo "30" > $zen_pipe
651 echo "#Checkout required version..." > $zen_pipe
655 ret=$(git checkout master~"$BACK" >>$install_log 2>&1)
658 git_error=$(tail -n5 $install_log 2>&1)
659 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
664 ret=$(git checkout "$COMMIT" >>$install_log 2>&1)
667 git_error=$(tail -n5 $install_log 2>&1)
668 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
673 ret=$(git checkout "$TAG" >>$install_log 2>&1)
677 git_error=$(tail -n5 $install_log 2>&1)
678 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
683 if [[ "$DEBUG" == "yes" ]]
687 debug_opt="--disable-debug-log"
690 echo "40" > $zen_pipe
691 echo "#Creating configuration files..." > $zen_pipe
693 if [[ $gtk_version == "GTK3"* ]]
695 ./autogen.sh "$debug_opt" >>$install_log 2>&1
697 ./autogen.sh "$debug_opt" --disable-gtk3 >>$install_log 2>&1
700 echo "60" > $zen_pipe
701 echo "#Compiling..." > $zen_pipe
703 export CFLAGS=$CFLAGS" -Wno-deprecated-declarations"
704 export CXXFLAGS=$CXXFLAGS" -Wno-deprecated-declarations"
705 make -j >>$install_log 2>&1
709 zenity --title="$title" --width=370 --height=400 --error --text=$'Compile error' 2>/dev/null
714 echo "90 " > $zen_pipe
715 echo "#Installing Geeqie..." > $zen_pipe
717 sudo --askpass make install >>$install_log 2>&1
719 # This is a temporary fix until the ZoneDetect project releases its source code
720 zonedetect_message="ZoneDetect database not loaded"
721 if [[ -d "/usr/local/lib/geeqie" ]]
723 if [[ ! -f "/usr/local/lib/geeqie/timezone21.bin" ]]
725 sudo --askpass wget --directory-prefix=/usr/local/lib/geeqie/ https://github.com/BertoldVdb/ZoneDetect/raw/master/database/timezone21.bin >>$install_log 2>&1
728 zonedetect_message=""
731 zonedetect_message=""
735 rm $install_pass_script
736 mv -f $install_log install.log;
738 echo "100 " > $zen_pipe
741 (for i in $(seq 0 4 100); do echo "$i"; sleep 0.1; done) | zenity --progress --title="$title" --width=370 --text="Geeqie installation complete...\n$zonedetect_message" --auto-close --percentage=0 2>/dev/null