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.
10 Command line options are:
11 -v --version The version of this file
12 -h --help Output this text
13 -c --commit=ID Checkout and compile commit ID
14 -t --tag=TAG Checkout and compile TAG (e.g. v1.4 or v1.3)
15 -b --back=N Checkout commit -N (e.g. "-b 1" for last-but-one commit)
16 -d --debug=yes Compile with debug output
19 # 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 "exiv2 command line (for jpeg export)"
55 "jpgicc (for jpeg export color correction)"
57 "markdown (for generating README help file)"
59 "gphoto2 (for tethered photography and camera download plugins)"
61 "libimage-exiftool-perl (for jpeg extraction plugin)"
62 "libimage-exiftool-perl"
63 "libheif (for HEIF support)"
65 "libwebp (for WebP images)"
67 "libdjvulibre (for DjVu images)"
71 # Optional for GTK3 only
73 "libchamplain gtk (for GPS maps)"
74 "libchamplain-gtk-0.12-dev"
75 "libchamplain (for GPS maps)"
76 "libchamplain-0.12-dev"
77 "libpoppler (for pdf file preview)"
81 ####################################################################
83 # Derived from: https://github.com/coto/server-easy-install (GPL)
84 ####################################################################
87 echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
92 OS=`lowercase \`uname\``
96 if [ "${OS}" == "windowsnt" ]
99 elif [ "${OS}" == "darwin" ]
104 if [ "${OS}" = "SunOS" ]
108 OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"
109 elif [ "${OS}" = "AIX" ]
111 OSSTR="${OS} `oslevel` (`oslevel -r`)"
112 elif [ "${OS}" = "Linux" ]
114 if [ -f /etc/redhat-release ]
116 DistroBasedOn='RedHat'
117 DIST=`cat /etc/redhat-release |sed s/\ release.*//`
118 PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
119 REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
120 elif [ -f /etc/SuSE-release ]
123 PSUEDONAME=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`
124 REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`
125 elif [ -f /etc/mandrake-release ]
127 DistroBasedOn='Mandrake'
128 PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
129 REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
130 elif [ -f /etc/debian_version ]
132 DistroBasedOn='Debian'
133 if [ -f /etc/lsb-release ]
135 DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }'`
136 PSUEDONAME=`cat /etc/lsb-release | grep '^DISTRIB_CODENAME' | awk -F= '{ print $2 }'`
137 REV=`cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F= '{ print $2 }'`
140 if [ -f /etc/UnitedLinux-release ]
142 DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]"
145 DistroBasedOn=`lowercase $DistroBasedOn`
148 readonly DistroBasedOn
159 arraylength=${#essential_array[@]}
160 for (( i=0; i<${arraylength}; i=i+1 ));
162 package_query ${essential_array[$i]}
165 package_install ${essential_array[$i]}
169 if [[ $1 == "GTK3" ]]
171 package_query "libgtk-3-dev"
174 package_install libgtk-3-dev
177 package_query "libgtk2.0-dev"
180 package_install libgtk2.0-dev
203 current_dir=$(basename $PWD)
204 if [[ $current_dir == "geeqie" ]]
206 sudo --askpass make uninstall
207 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
212 sudo --askpass rm -rf geeqie
215 zenity --title="Uninstall Geeqie" --width=370 --text="This is not a geeqie installation folder!\n\n$PWD" --warning 2>/dev/null
223 if [[ $DistroBasedOn == "debian" ]]
225 res=$(dpkg-query --show --showformat='${Status}' $1 2>>$install_log)
226 if [[ "$res" == "install ok installed"* ]]
238 if [[ $DistroBasedOn == "debian" ]]
240 sudo --askpass apt-get --assume-yes install $@ >>$install_log 2>&1
246 rm $install_pass_script >/dev/null 2>&1
247 #~ rm $install_log >/dev/null 2>&1
249 if [[ -p $zen_pipe ]]
251 echo "100" > $zen_pipe
252 echo "#End" > $zen_pipe
255 zenity --title="$title" --width=370 --text=$'Geeqie is not installed\nLog file: '$install_log --info 2>/dev/null
257 rm $zen_pipe >/dev/null 2>&1
264 # If uninstall has been run, maybe the current directory no longer exists
268 zenity --error --title="Install Geeqie and dependencies" --width=370 --text="Folder $PWD does not exist!" 2>/dev/null
275 if [[ $DistroBasedOn != "debian" ]]
277 zenity --error --title="Install Geeqie and dependencies" --width=370 --text="Unknown operating system:\n
278 Operating System: $OS
280 Psuedoname: $PSUEDONAME
282 DistroBasedOn: $DistroBasedOn
284 Machine: $MACH" 2>/dev/null
289 # Parse the comand line
290 OPTS=$(getopt -o vhc:t:b:d: --long version,help,commit:,tag:,back:,debug: -- "$@")
329 # If a Geeqie folder already exists here, warn the user
332 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
337 # If it looks like a Geeqie download folder, assume an update
338 if [ -d ".git" ] && [ -d "src" ] && [ -f "geeqie.1" ]
342 # If it looks like something else is already installed here, warn the user
343 if [ -d ".git" ] || [ -d "src" ]
345 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
353 # Use GTK3 as default
357 if [[ $mode == "install" ]]
359 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."
361 title="Install Geeqie and dependencies"
364 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."
366 title="Update Geeqie and re-install"
369 # When updating, use previous installation as default
370 if [[ -f config.log ]]
372 grep gtk-2.0 config.log >/dev/null
384 # Ask whether to install GTK2 or GTK3 or uninstall
386 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)
393 # Environment variable SUDO_ASKPASS cannot be "zenity --password",
394 # so create a temporary script containing the command
395 install_pass_script=$(mktemp --tmpdir geeqie_install_XXXXXX.sh)
397 zenity --password --title=\"'$title$'\" --width=370 2>/dev/null
402 \n' > $install_pass_script
403 chmod +x $install_pass_script
404 export SUDO_ASKPASS=$install_pass_script
406 if [[ $gtk_version == "Uninstall" ]]
412 # Put the install log in tmp, to avoid writing to PWD during a new install
413 rm install.log 2>/dev/null
414 install_log=$(mktemp --tmpdir geeqie_install_XXXXXX.log)
416 sleep 100 | zenity --title="$title" --text="Checking for installed files" --width=370 --progress --pulsate 2>/dev/null &
419 # Get the standard options that are not yet installed
420 arraylength=${#optional_array[@]}
421 for (( i=0; i<${arraylength}; i=i+2 ));
423 package_query ${optional_array[$i+1]}
426 if [ -z "$option_string" ]
428 option_string="$install_option"$'\n'"${optional_array[$i]}"$'\n'"${optional_array[$i+1]}"
430 option_string="$option_string"$'\n'"$install_option"$'\n'"${optional_array[$i]}"$'\n'"${optional_array[$i+1]}"
435 # If GTK3 required, get the GTK3 options not yet installed
436 if [[ "$gtk_version" == "GTK3"* ]]
438 arraylength=${#optional_gtk3_array[@]}
439 for (( i=0; i<${arraylength}; i=i+2 ));
441 package_query ${optional_gtk3_array[$i+1]}
444 if [ -z "$option_string" ]
446 option_string="$install_option"$'\n'"${optional_gtk3_array[$i]}"$'\n'"${optional_gtk3_array[$i+1]}"
448 option_string="$option_string"$'\n'"$install_option"$'\n'"${optional_gtk3_array[$i]}"$'\n'"${optional_gtk3_array[$i+1]}"
454 kill $zen_pid 2>/dev/null
456 # Ask the user which options to install
457 if [ -n "$option_string" ]
459 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)
467 # Start of Zenity progress section
468 zen_pipe=$(mktemp --dry-run --tmpdir geeqie_install_pipe_XXXXXX)
470 (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 &
473 echo "#Installing essential libraries..." > $zen_pipe
475 install_essential $gtk_version
478 echo "#Installing options..." > $zen_pipe
483 echo "#Installing extra loaders..." > $zen_pipe
485 echo "10" > $zen_pipe
486 echo "#Getting new sources from server..." > $zen_pipe
488 if [[ $mode == "install" ]]
490 ret=$(git clone git://www.geeqie.org/geeqie.git >>$install_log 2>&1)
492 git checkout master >>$install_log 2>&1
495 git_error=$(tail -n5 $install_log 2>&1)
496 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
499 ret=$(git pull >>$install_log 2>&1)
504 git_error=$(tail -n5 $install_log 2>&1)
505 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
509 echo "20" > $zen_pipe
510 echo "#Cleaning installed version..." > $zen_pipe
512 if [[ $mode == "install" ]]
516 sudo --askpass make uninstall >>$install_log 2>&1
517 sudo --askpass make maintainer-clean >>$install_log 2>&1
520 echo "30" > $zen_pipe
521 echo "#Checkout required version..." > $zen_pipe
525 ret=$(git checkout master~"$BACK" >>$install_log 2>&1)
528 git_error=$(tail -n5 $install_log 2>&1)
529 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
534 ret=$(git checkout "$COMMIT" >>$install_log 2>&1)
537 git_error=$(tail -n5 $install_log 2>&1)
538 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
543 ret=$(git checkout "$TAG" >>$install_log 2>&1)
547 git_error=$(tail -n5 $install_log 2>&1)
548 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
553 if [[ "$DEBUG" == "yes" ]]
557 debug_opt="--disable-debug-log"
560 echo "40" > $zen_pipe
561 echo "#Creating configuration files..." > $zen_pipe
563 if [[ $gtk_version == "GTK3"* ]]
565 ./autogen.sh "$debug_opt" >>$install_log 2>&1
567 ./autogen.sh "$debug_opt" --disable-gtk3 >>$install_log 2>&1
570 echo "60" > $zen_pipe
571 echo "#Compiling..." > $zen_pipe
573 export CFLAGS=$CFLAGS" -Wno-deprecated-declarations"
574 export CXXFLAGS=$CXXFLAGS" -Wno-deprecated-declarations"
575 make -j >>$install_log 2>&1
579 zenity --title="$title" --width=370 --height=400 --error --text=$'Compile error' 2>/dev/null
584 echo "90 " > $zen_pipe
585 echo "#Installing Geeqie..." > $zen_pipe
587 sudo --askpass make install >>$install_log 2>&1
589 rm $install_pass_script
590 mv -f $install_log install.log;
592 echo "100 " > $zen_pipe
595 (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