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
30 # Optional for both GTK2 and GTK3
32 "LCMS (for color management)"
34 "exiv2 (for exif handling)"
36 "lua (for --remote commands)"
38 "libffmpegthumbnailer (for mpeg thumbnails)"
39 "libffmpegthumbnailer-dev"
40 "libtiff (for tiff support)"
42 "libjpeg (for jpeg support"
44 "librsvg2 (for viewing .svg images"
46 "libwmf (for viewing .wmf images)"
48 "exiftran (for image rotation)"
50 "imagemagick (for image rotation)"
52 "ufraw (for RAW file handling)"
54 "markdown (for generating README help file)"
58 # Optional for GTK3 only
60 "libchamplain gtk (for GPS maps)"
61 "libchamplain-gtk-0.12-dev"
62 "libchamplain (for GPS maps)"
63 "libchamplain-0.12-dev"
64 "libpoppler (for pdf file preview)"
68 # Optional pixbuf loaders
69 optional_loaders_array=(
72 ".psd Photoshop images"
78 ####################################################################
80 # Derived from: https://github.com/coto/server-easy-install (GPL)
81 ####################################################################
84 echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
89 OS=`lowercase \`uname\``
93 if [ "${OS}" == "windowsnt" ]
96 elif [ "${OS}" == "darwin" ]
101 if [ "${OS}" = "SunOS" ]
105 OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"
106 elif [ "${OS}" = "AIX" ]
108 OSSTR="${OS} `oslevel` (`oslevel -r`)"
109 elif [ "${OS}" = "Linux" ]
111 if [ -f /etc/redhat-release ]
113 DistroBasedOn='RedHat'
114 DIST=`cat /etc/redhat-release |sed s/\ release.*//`
115 PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
116 REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
117 elif [ -f /etc/SuSE-release ]
120 PSUEDONAME=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`
121 REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`
122 elif [ -f /etc/mandrake-release ]
124 DistroBasedOn='Mandrake'
125 PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
126 REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
127 elif [ -f /etc/debian_version ]
129 DistroBasedOn='Debian'
130 if [ -f /etc/lsb-release ]
132 DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }'`
133 PSUEDONAME=`cat /etc/lsb-release | grep '^DISTRIB_CODENAME' | awk -F= '{ print $2 }'`
134 REV=`cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F= '{ print $2 }'`
137 if [ -f /etc/UnitedLinux-release ]
139 DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]"
142 DistroBasedOn=`lowercase $DistroBasedOn`
145 readonly DistroBasedOn
156 arraylength=${#essential_array[@]}
157 for (( i=0; i<${arraylength}; i=i+1 ));
159 package_query ${essential_array[$i]}
162 package_install ${essential_array[$i]}
166 if [[ $1 == "GTK3" ]]
168 package_query "libgtk-3-dev"
171 package_install libgtk-3-dev
174 package_query "libgtk2.0-dev"
177 package_install libgtk2.0-dev
200 rm -rf webp-pixbuf-loader-master
201 package_install libglib2.0-dev libgdk-pixbuf2.0-dev libwebp-dev python-minimal
202 wget https://github.com/aruiz/webp-pixbuf-loader/archive/master.zip
204 cd webp-pixbuf-loader-master
207 sudo --askpass ./waf install
208 sudo --askpass gdk-pixbuf-query-loaders --update-cache
210 rm -rf webp-pixbuf-loader-master
216 rm -rf gdk-pixbuf-psd
217 git clone https://github.com/and-rom/gdk-pixbuf-psd.git
221 sudo --askpass make install
222 sudo --askpass gdk-pixbuf-query-loaders --update-cache
224 rm -rf gdk-pixbuf-psd
229 rm -rf xcf-pixbuf-loader
230 package_install libbz2-dev
231 git clone https://github.com/StephaneDelcroix/xcf-pixbuf-loader.git
236 # There must be a better way...
237 loader_locn=$(gdk-pixbuf-query-loaders | grep "LoaderDir" | tr -d '#[:space:]')
246 sudo --askpass cp .libs/libioxcf.so $2
247 sudo --askpass gdk-pixbuf-query-loaders --update-cache
250 rm -rf xcf-pixbuf-loader
253 install_extra_loaders()
255 if [ -n "$extra_loaders" ]
283 current_dir=$(basename $PWD)
284 if [[ $current_dir == "geeqie" ]]
286 sudo --askpass make uninstall
287 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
292 sudo --askpass rm -rf geeqie
295 zenity --title="Uninstall Geeqie" --width=370 --text="This is not a geeqie installation folder!\n\n$PWD" --warning 2>/dev/null
303 if [[ $DistroBasedOn == "debian" ]]
305 res=$(dpkg-query --show --showformat='${Status}' $1 2>>$install_log)
306 if [[ "$res" == "install ok installed"* ]]
318 if [[ $DistroBasedOn == "debian" ]]
320 sudo --askpass apt-get --assume-yes install $@ >>$install_log 2>&1
326 rm $install_pass_script >/dev/null 2>&1
327 #~ rm $install_log >/dev/null 2>&1
329 if [[ -p $zen_pipe ]]
331 echo "100" > $zen_pipe
332 echo "#End" > $zen_pipe
335 zenity --title="$title" --width=370 --text=$'Geeqie is not installed\nLog file: '$install_log --info 2>/dev/null
337 rm $zen_pipe >/dev/null 2>&1
344 # If uninstall has been run, maybe the current directory no longer exists
348 zenity --error --title="Install Geeqie and dependencies" --width=370 --text="Folder $PWD does not exist!" 2>/dev/null
355 if [[ $DistroBasedOn != "debian" ]]
357 zenity --error --title="Install Geeqie and dependencies" --width=370 --text="Unknown operating system:\n
358 Operating System: $OS
360 Psuedoname: $PSUEDONAME
362 DistroBasedOn: $DistroBasedOn
364 Machine: $MACH" 2>/dev/null
369 # Parse the comand line
370 OPTS=$(getopt -o vhc:t:b:d: --long version,help,commit:,tag:,back:,debug: -- "$@")
409 # If a Geeqie folder already exists here, warn the user
412 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
417 # If it looks like a Geeqie download folder, assume an update
418 if [ -d ".git" ] && [ -d "src" ] && [ -f "geeqie.1" ]
422 # If it looks like something else is already installed here, warn the user
423 if [ -d ".git" ] || [ -d "src" ]
425 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
433 # Use GTK3 as default
437 if [[ $mode == "install" ]]
439 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."
441 title="Install Geeqie and dependencies"
444 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."
446 title="Update Geeqie and re-install"
449 # When updating, use previous installation as default
450 if [[ -f config.log ]]
452 grep gtk-2.0 config.log >/dev/null
464 # Ask whether to install GTK2 or GTK3 or uninstall
466 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)
473 # Environment variable SUDO_ASKPASS cannot be "zenity --password",
474 # so create a temporary script containing the command
475 install_pass_script=$(mktemp --tmpdir geeqie_install_XXXXXX.sh)
477 zenity --password --title=\"'$title$'\" --width=370 2>/dev/null
482 \n' > $install_pass_script
483 chmod +x $install_pass_script
484 export SUDO_ASKPASS=$install_pass_script
486 if [[ $gtk_version == "Uninstall" ]]
492 # Put the install log in tmp, to avoid writing to PWD during a new install
493 rm install.log 2>/dev/null
494 install_log=$(mktemp --tmpdir geeqie_install_XXXXXX.log)
496 sleep 100 | zenity --title="$title" --text="Checking for installed files" --width=370 --progress --pulsate 2>/dev/null &
499 # Get the standard options that are not yet installed
500 arraylength=${#optional_array[@]}
501 for (( i=0; i<${arraylength}; i=i+2 ));
503 package_query ${optional_array[$i+1]}
506 if [ -z "$option_string" ]
508 option_string="$install_option"$'\n'"${optional_array[$i]}"$'\n'"${optional_array[$i+1]}"
510 option_string="$option_string"$'\n'"$install_option"$'\n'"${optional_array[$i]}"$'\n'"${optional_array[$i+1]}"
515 # If GTK3 required, get the GTK3 options not yet installed
516 if [[ "$gtk_version" == "GTK3"* ]]
518 arraylength=${#optional_gtk3_array[@]}
519 for (( i=0; i<${arraylength}; i=i+2 ));
521 package_query ${optional_gtk3_array[$i+1]}
524 if [ -z "$option_string" ]
526 option_string="$install_option"$'\n'"${optional_gtk3_array[$i]}"$'\n'"${optional_gtk3_array[$i+1]}"
528 option_string="$option_string"$'\n'"$install_option"$'\n'"${optional_gtk3_array[$i]}"$'\n'"${optional_gtk3_array[$i+1]}"
534 # Get the optional loaders not yet installed
536 gdk-pixbuf-query-loaders | grep WebP >/dev/null
539 if [ -z "$loaders_string" ]
541 loaders_string=$'FALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
543 loaders_string="$loaders_string"$'\nFALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
549 gdk-pixbuf-query-loaders | grep psd >/dev/null
552 if [ -z "$loaders_string" ]
554 loaders_string=$'FALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
556 loaders_string="$loaders_string"$'\nFALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
561 gdk-pixbuf-query-loaders | grep xcf >/dev/null
564 if [ -z "$loaders_string" ]
566 loaders_string=$'FALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
568 loaders_string="$loaders_string"$'\nFALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
572 kill $zen_pid 2>/dev/null
574 # Ask the user which options to install
575 if [ -n "$option_string" ]
577 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)
585 # Ask the user which extra loaders to install
586 if [ -n "$loaders_string" ]
588 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)
596 # Start of Zenity progress section
597 zen_pipe=$(mktemp --dry-run --tmpdir geeqie_install_pipe_XXXXXX)
599 (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 &
602 echo "#Installing essential libraries..." > $zen_pipe
604 install_essential $gtk_version
607 echo "#Installing options..." > $zen_pipe
612 echo "#Installing extra loaders..." > $zen_pipe
614 install_extra_loaders
616 echo "10" > $zen_pipe
617 echo "#Getting new sources from server..." > $zen_pipe
619 if [[ $mode == "install" ]]
621 ret=$(git clone git://www.geeqie.org/geeqie.git >>$install_log 2>&1)
623 git checkout master >>$install_log 2>&1
626 git_error=$(tail -n5 $install_log 2>&1)
627 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
630 ret=$(git pull >>$install_log 2>&1)
635 git_error=$(tail -n5 $install_log 2>&1)
636 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
640 echo "20" > $zen_pipe
641 echo "#Cleaning installed version..." > $zen_pipe
643 if [[ $mode == "install" ]]
647 sudo --askpass make uninstall >>$install_log 2>&1
648 sudo --askpass make maintainer-clean >>$install_log 2>&1
651 echo "30" > $zen_pipe
652 echo "#Checkout required version..." > $zen_pipe
656 ret=$(git checkout master~"$BACK" >>$install_log 2>&1)
659 git_error=$(tail -n5 $install_log 2>&1)
660 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
665 ret=$(git checkout "$COMMIT" >>$install_log 2>&1)
668 git_error=$(tail -n5 $install_log 2>&1)
669 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
674 ret=$(git checkout "$TAG" >>$install_log 2>&1)
678 git_error=$(tail -n5 $install_log 2>&1)
679 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
684 if [[ "$DEBUG" == "yes" ]]
688 debug_opt="--disable-debug-log"
691 echo "40" > $zen_pipe
692 echo "#Creating configuration files..." > $zen_pipe
694 if [[ $gtk_version == "GTK3"* ]]
696 ./autogen.sh "$debug_opt" >>$install_log 2>&1
698 ./autogen.sh "$debug_opt" --disable-gtk3 >>$install_log 2>&1
701 echo "60" > $zen_pipe
702 echo "#Compiling..." > $zen_pipe
704 export CFLAGS=$CFLAGS" -Wno-deprecated-declarations"
705 export CXXFLAGS=$CXXFLAGS" -Wno-deprecated-declarations"
706 make -j >>$install_log 2>&1
710 zenity --title="$title" --width=370 --height=400 --error --text=$'Compile error' 2>/dev/null
715 echo "90 " > $zen_pipe
716 echo "#Installing Geeqie..." > $zen_pipe
718 sudo --askpass make install >>$install_log 2>&1
720 # This is a temporary fix until the ZoneDetect project releases its source code
721 zonedetect_message="ZoneDetect database not loaded"
722 if [[ -d "/usr/local/lib/geeqie" ]]
724 if [[ ! -f "/usr/local/lib/geeqie/timezone21.bin" ]]
726 sudo --askpass wget --directory-prefix=/usr/local/lib/geeqie/ https://github.com/BertoldVdb/ZoneDetect/raw/master/database/timezone21.bin >>$install_log 2>&1
729 zonedetect_message=""
732 zonedetect_message=""
736 rm $install_pass_script
737 mv -f $install_log install.log;
739 echo "100 " > $zen_pipe
742 (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