Addl fix #619: Man page disagrees with --remote-help
[geeqie.git] / web / geeqie-install-debian.sh
1 #!/bin/bash
2 version="2018-10-23"
3 description=$'
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.
10
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
18 '
19
20 # Essential for compiling
21 essential_array=(
22 "git"
23 "build-essential"
24 "autoconf"
25 "libglib2.0-0"
26 "intltool"
27 "libtool"
28 )
29
30 # Optional for both GTK2 and GTK3
31 optional_array=(
32 "LCMS (for color management)"
33 "liblcms2-dev"
34 "exiv2 (for exif handling)"
35 "libgexiv2-dev"
36 "lua (for --remote commands)"
37 "liblua5.1-0-dev"
38 "libffmpegthumbnailer (for mpeg thumbnails)"
39 "libffmpegthumbnailer-dev"
40 "libtiff (for tiff support)"
41 "libtiff-dev"
42 "libjpeg (for jpeg support"
43 "libjpeg-dev"
44 "librsvg2 (for viewing .svg images"
45 "librsvg2-common"
46 "libwmf (for viewing .wmf images)"
47 "libwmf0.2-7-gtk"
48 "exiftran (for image rotation)"
49 "exiftran"
50 "imagemagick (for image rotation)"
51 "imagemagick"
52 "ufraw (for RAW file handling)"
53 "ufraw"
54 "exiv2 command line (for jpeg export)"
55 "exiv2"
56 "jpgicc (for jpeg export color correction)"
57 "liblcms2-utils"
58 "markdown (for generating README help file)"
59 "markdown"
60 "gphoto2 (for tethered photography and camera download plugins)"
61 "gphoto2"
62 "libimage-exiftool-perl (for jpeg extraction plugin)"
63 "libimage-exiftool-perl"
64 )
65
66 # Optional for GTK3 only
67 optional_gtk3_array=(
68 "libchamplain gtk (for GPS maps)"
69 "libchamplain-gtk-0.12-dev"
70 "libchamplain (for GPS maps)"
71 "libchamplain-0.12-dev"
72 "libpoppler (for pdf file preview)"
73 "libpoppler-glib-dev"
74 )
75
76 # Optional pixbuf loaders
77 optional_loaders_array=(
78 ".webp WebP images"
79 "webp"
80 ".psd Photoshop images"
81 "psd"
82 ".xcf Gimp files"
83 "xcf"
84 )
85
86 ####################################################################
87 # Get System Info
88 # Derived from: https://github.com/coto/server-easy-install (GPL)
89 ####################################################################
90 lowercase()
91 {
92         echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
93 }
94
95 systemProfile()
96 {
97         OS=`lowercase \`uname\``
98         KERNEL=`uname -r`
99         MACH=`uname -m`
100
101         if [ "${OS}" == "windowsnt" ]
102         then
103                 OS=windows
104         elif [ "${OS}" == "darwin" ]
105         then
106                 OS=mac
107         else
108                 OS=`uname`
109                 if [ "${OS}" = "SunOS" ]
110                 then
111                         OS=Solaris
112                         ARCH=`uname -p`
113                         OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"
114                 elif [ "${OS}" = "AIX" ]
115                 then
116                         OSSTR="${OS} `oslevel` (`oslevel -r`)"
117                 elif [ "${OS}" = "Linux" ]
118                 then
119                         if [ -f /etc/redhat-release ]
120                         then
121                                 DistroBasedOn='RedHat'
122                                 DIST=`cat /etc/redhat-release |sed s/\ release.*//`
123                                 PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
124                                 REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
125                         elif [ -f /etc/SuSE-release ]
126                         then
127                                 DistroBasedOn='SuSe'
128                                 PSUEDONAME=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`
129                                 REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`
130                         elif [ -f /etc/mandrake-release ]
131                         then
132                                 DistroBasedOn='Mandrake'
133                                 PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
134                                 REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
135                         elif [ -f /etc/debian_version ]
136                         then
137                                 DistroBasedOn='Debian'
138                                 if [ -f /etc/lsb-release ]
139                                 then
140                                         DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F=  '{ print $2 }'`
141                                         PSUEDONAME=`cat /etc/lsb-release | grep '^DISTRIB_CODENAME' | awk -F=  '{ print $2 }'`
142                                         REV=`cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F=  '{ print $2 }'`
143                                 fi
144                         fi
145                         if [ -f /etc/UnitedLinux-release ]
146                         then
147                                 DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]"
148                         fi
149                         OS=`lowercase $OS`
150                         DistroBasedOn=`lowercase $DistroBasedOn`
151                         readonly OS
152                         readonly DIST
153                         readonly DistroBasedOn
154                         readonly PSUEDONAME
155                         readonly REV
156                         readonly KERNEL
157                         readonly MACH
158                 fi
159         fi
160 }
161
162 install_essential()
163 {
164         arraylength=${#essential_array[@]}
165         for (( i=0; i<${arraylength}; i=i+1 ));
166         do
167                 package_query ${essential_array[$i]}
168                 if [ $? != 0 ]
169                 then
170                         package_install ${essential_array[$i]}
171                 fi
172         done
173
174         if [[ $1 == "GTK3" ]]
175         then
176                 package_query "libgtk-3-dev"
177                 if [ $? != 0 ]
178                 then
179                         package_install libgtk-3-dev
180                 fi
181         else
182                 package_query "libgtk2.0-dev"
183                 if [ $? != 0 ]
184                 then
185                         package_install libgtk2.0-dev
186                 fi
187         fi
188 }
189
190 install_options()
191 {
192         if [ -n "$options" ]
193         then
194                 OLDIFS=$IFS
195                 IFS='|'
196                 set $options
197                 while [ $# -gt 0 ];
198                 do
199                         package_install $1
200                         shift
201                 done
202                 IFS=$OLDIFS
203         fi
204 }
205
206 install_webp()
207 {
208         rm -rf webp-pixbuf-loader-master
209         package_install libglib2.0-dev libgdk-pixbuf2.0-dev libwebp-dev python-minimal
210         wget https://github.com/aruiz/webp-pixbuf-loader/archive/master.zip
211         unzip master.zip
212         cd webp-pixbuf-loader-master
213         ./waf configure
214         ./waf build
215         sudo --askpass ./waf install
216         sudo --askpass gdk-pixbuf-query-loaders --update-cache
217         cd -
218         rm -rf webp-pixbuf-loader-master
219         rm master.zip
220 }
221
222 install_psd()
223 {
224         rm -rf gdk-pixbuf-psd
225         git clone https://github.com/and-rom/gdk-pixbuf-psd.git
226         cd gdk-pixbuf-psd
227         ./autogen.sh
228         make
229         sudo --askpass make install
230         sudo --askpass gdk-pixbuf-query-loaders --update-cache
231         cd -
232         rm -rf gdk-pixbuf-psd
233 }
234
235 install_xcf()
236 {
237         rm -rf xcf-pixbuf-loader
238         package_install libbz2-dev
239         git clone https://github.com/StephaneDelcroix/xcf-pixbuf-loader.git
240         cd xcf-pixbuf-loader
241         ./autogen.sh
242         make
243
244         # There must be a better way...
245         loader_locn=$(gdk-pixbuf-query-loaders | grep "LoaderDir" | tr -d '#[:space:]')
246
247         OLDIFS=$IFS
248         IFS='='
249         set $loader_locn
250         OLDIFS=$IFS
251
252         if [ -d $2 ]
253         then
254                 sudo --askpass cp .libs/libioxcf.so $2
255                 sudo --askpass gdk-pixbuf-query-loaders --update-cache
256         fi
257         cd -
258         rm -rf xcf-pixbuf-loader
259 }
260
261 install_extra_loaders()
262 {
263         if [ -n "$extra_loaders" ]
264         then
265                 OLDIFS=$IFS
266                 IFS='|'
267                 set $extra_loaders
268                 while [ $# -gt 0 ];
269                 do
270                         case $1 in
271                         "webp" )
272                                 install_webp
273                         ;;
274                         "psd" )
275                                 install_psd
276                         ;;
277                         "xcf" )
278                                 install_xcf
279                         ;;
280                         esac
281
282                         shift
283                 done
284                 IFS=$OLDIFS
285         fi
286         return
287 }
288
289 uninstall()
290 {
291         current_dir=$(basename $PWD)
292         if [[ $current_dir == "geeqie" ]]
293         then
294                 sudo --askpass make uninstall
295                 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
296
297                 if [[ $? == 1 ]]
298                 then
299                         cd ..
300                         sudo --askpass rm -rf geeqie
301                 fi
302         else
303                 zenity --title="Uninstall Geeqie" --width=370 --text="This is not a geeqie installation folder!\n\n$PWD" --warning 2>/dev/null
304         fi
305
306         exit_install
307 }
308
309 package_query()
310 {
311         if [[ $DistroBasedOn == "debian" ]]
312         then
313                 res=$(dpkg-query --show --showformat='${Status}' $1 2>>$install_log)
314                 if [[ "$res" == "install ok installed"* ]]
315                 then
316                         status=0
317                 else
318                         status=1
319                 fi
320         fi
321         return $status
322 }
323
324 package_install()
325 {
326         if [[ $DistroBasedOn == "debian" ]]
327         then
328                 sudo --askpass apt-get --assume-yes install $@ >>$install_log 2>&1
329         fi
330 }
331
332 exit_install()
333 {
334         rm $install_pass_script >/dev/null 2>&1
335         #~ rm $install_log >/dev/null 2>&1
336
337         if [[ -p $zen_pipe ]]
338         then
339                 echo "100" > $zen_pipe
340                 echo "#End" > $zen_pipe
341         fi
342
343         zenity --title="$title" --width=370 --text=$'Geeqie is not installed\nLog file: '$install_log --info 2>/dev/null
344
345         rm $zen_pipe >/dev/null 2>&1
346
347         exit 1
348 }
349
350 # Entry point
351
352 # If uninstall has been run, maybe the current directory no longer exists
353 ls $PWD >/dev/null
354 if [[ $? != 0 ]]
355 then
356         zenity --error --title="Install Geeqie and dependencies" --width=370 --text="Folder $PWD does not exist!" 2>/dev/null
357
358         exit
359 fi
360
361 # Check system type
362 systemProfile
363 if [[ $DistroBasedOn != "debian" ]]
364 then
365         zenity --error --title="Install Geeqie and dependencies" --width=370 --text="Unknown operating system:\n
366 Operating System: $OS
367 Distribution: $DIST
368 Psuedoname: $PSUEDONAME
369 Revision: $REV
370 DistroBasedOn: $DistroBasedOn
371 Kernel: $KERNEL
372 Machine: $MACH" 2>/dev/null
373
374         exit
375 fi
376
377 # Parse the comand line
378 OPTS=$(getopt -o vhc:t:b:d: --long version,help,commit:,tag:,back:,debug: -- "$@")
379 eval set -- "$OPTS"
380
381 while true;
382 do
383         case "$1" in
384         -v | --version )
385                 echo "$version"
386                 exit
387                 ;;
388         -h | --help )
389                 echo "$description"
390                 exit
391                 ;;
392         -c | --commit )
393                 COMMIT="$2"
394                 shift
395                 shift
396                 ;;
397         -t | --tag )
398                 TAG="$2"
399                 shift;
400                 shift
401                 ;;
402         -b | --back )
403                 BACK="$2"
404                 shift;
405                 shift
406                 ;;
407         -d | --debug )
408                 DEBUG="$2"
409                 shift;
410                 shift
411                 ;;
412         * ) break
413                 ;;
414         esac
415 done
416
417 # If a Geeqie folder already exists here, warn the user
418 if [ -d "geeqie" ]
419 then
420         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
421
422         exit
423 fi
424
425 # If it looks like a Geeqie download folder, assume an update
426 if [ -d ".git" ] && [ -d "src" ] && [ -f "geeqie.1" ]
427 then
428         mode="update"
429 else
430         # If it looks like something else is already installed here, warn the user
431         if [ -d ".git" ] || [ -d "src" ]
432         then
433                 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
434
435                 exit
436         else
437                 mode="install"
438         fi
439 fi
440
441 # Use GTK3 as default
442 gk2_installed=FALSE
443 gtk3_installed=TRUE
444
445 if [[ $mode == "install" ]]
446 then
447         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."
448
449         title="Install Geeqie and dependencies"
450         install_option=TRUE
451 else
452         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."
453
454         title="Update Geeqie and re-install"
455         install_option=FALSE
456
457         # When updating, use previous installation as default
458         if [[ -f config.log ]]
459         then
460                 grep gtk-2.0 config.log >/dev/null
461                 if [[ $? != 0 ]]
462                 then
463                         gtk2_installed=FALSE
464                         gtk3_installed=TRUE
465                 else
466                         gtk2_installed=TRUE
467                         gtk3_installed=FALSE
468                 fi
469         fi
470 fi
471
472 # Ask whether to install GTK2 or GTK3 or uninstall
473
474 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)
475
476 if [[ $? == 1 ]]
477 then
478         exit
479 fi
480
481 # Environment variable SUDO_ASKPASS cannot be "zenity --password",
482 # so create a temporary script containing the command
483 install_pass_script=$(mktemp --tmpdir geeqie_install_XXXXXX.sh)
484 echo $'#!/bin/bash
485 zenity --password --title=\"'$title$'\" --width=370 2>/dev/null
486 if [[ $? > 0 ]]
487 then
488         exit 1
489 fi
490 \n' > $install_pass_script
491 chmod +x $install_pass_script
492 export SUDO_ASKPASS=$install_pass_script
493
494 if [[ $gtk_version == "Uninstall" ]]
495 then
496         uninstall
497         exit
498 fi
499
500 # Put the install log in tmp, to avoid writing to PWD during a new install
501 rm install.log 2>/dev/null
502 install_log=$(mktemp --tmpdir geeqie_install_XXXXXX.log)
503
504 sleep 100 | zenity --title="$title" --text="Checking for installed files" --width=370 --progress --pulsate 2>/dev/null &
505 zen_pid=$!
506
507 # Get the standard options that are not yet installed
508 arraylength=${#optional_array[@]}
509 for (( i=0; i<${arraylength}; i=i+2 ));
510 do
511         package_query ${optional_array[$i+1]}
512         if [ $? != 0 ]
513         then
514                 if [ -z "$option_string" ]
515                 then
516                         option_string="$install_option"$'\n'"${optional_array[$i]}"$'\n'"${optional_array[$i+1]}"
517                 else
518                         option_string="$option_string"$'\n'"$install_option"$'\n'"${optional_array[$i]}"$'\n'"${optional_array[$i+1]}"
519                 fi
520         fi
521 done
522
523 # If GTK3 required, get the GTK3 options not yet installed
524 if [[ "$gtk_version" == "GTK3"* ]]
525 then
526         arraylength=${#optional_gtk3_array[@]}
527         for (( i=0; i<${arraylength}; i=i+2 ));
528         do
529                 package_query ${optional_gtk3_array[$i+1]}
530                 if [ $? != 0 ]
531                 then
532                         if [ -z "$option_string" ]
533                         then
534                                 option_string="$install_option"$'\n'"${optional_gtk3_array[$i]}"$'\n'"${optional_gtk3_array[$i+1]}"
535                         else
536                                 option_string="$option_string"$'\n'"$install_option"$'\n'"${optional_gtk3_array[$i]}"$'\n'"${optional_gtk3_array[$i+1]}"
537                         fi
538                 fi
539         done
540 fi
541
542 # Get the optional loaders not yet installed
543 ((i=0))
544 gdk-pixbuf-query-loaders | grep WebP >/dev/null
545 if [[ $? == 1 ]]
546 then
547         if [ -z "$loaders_string" ]
548         then
549                 loaders_string=$'FALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
550         else
551                 loaders_string="$loaders_string"$'\nFALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
552
553         fi
554 fi
555
556 ((i=i+2))
557 gdk-pixbuf-query-loaders | grep psd >/dev/null
558 if [[ $? == 1 ]]
559 then
560         if [ -z "$loaders_string" ]
561         then
562                 loaders_string=$'FALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
563         else
564                 loaders_string="$loaders_string"$'\nFALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
565         fi
566 fi
567
568 ((i=i+2))
569 gdk-pixbuf-query-loaders | grep xcf >/dev/null
570 if [[ $? == 1 ]]
571 then
572         if [ -z "$loaders_string" ]
573         then
574                 loaders_string=$'FALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
575         else
576                 loaders_string="$loaders_string"$'\nFALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
577         fi
578 fi
579
580 kill $zen_pid 2>/dev/null
581
582 # Ask the user which options to install
583 if [ -n "$option_string" ]
584 then
585         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)
586
587         if [[ $? == 1 ]]
588         then
589                 exit_install
590         fi
591 fi
592
593 # Ask the user which extra loaders to install
594 if [ -n "$loaders_string" ]
595 then
596         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)
597
598         if [[ $? == 1 ]]
599         then
600                 exit_install
601         fi
602 fi
603
604 # Start of Zenity progress section
605 zen_pipe=$(mktemp --dry-run --tmpdir geeqie_install_pipe_XXXXXX)
606 mkfifo $zen_pipe
607 (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 &
608
609 echo "2" > $zen_pipe
610 echo "#Installing essential libraries..." > $zen_pipe
611
612 install_essential $gtk_version
613
614 echo "4" > $zen_pipe
615 echo "#Installing options..." > $zen_pipe
616
617 install_options
618
619 echo "6" > $zen_pipe
620 echo "#Installing extra loaders..." > $zen_pipe
621
622 install_extra_loaders
623
624 echo "10" > $zen_pipe
625 echo "#Getting new sources from server..." > $zen_pipe
626
627 if [[ $mode == "install" ]]
628 then
629         ret=$(git clone git://www.geeqie.org/geeqie.git >>$install_log 2>&1)
630 else
631         git checkout master >>$install_log 2>&1
632         if [[ $? != 0 ]]
633         then
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
636                 exit_install
637         fi
638         ret=$(git pull >>$install_log 2>&1)
639 fi
640
641 if [[ $? != 0 ]]
642 then
643         git_error=$(tail -n5 $install_log 2>&1)
644         zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
645         exit_install
646 fi
647
648 echo "20" > $zen_pipe
649 echo "#Cleaning installed version..." > $zen_pipe
650
651 if [[ $mode == "install" ]]
652 then
653         cd geeqie
654 else
655         sudo --askpass make uninstall >>$install_log 2>&1
656         sudo --askpass make maintainer-clean >>$install_log 2>&1
657 fi
658
659 echo "30" > $zen_pipe
660 echo "#Checkout required version..." > $zen_pipe
661
662 if [[ "$BACK" ]]
663 then
664         ret=$(git checkout master~"$BACK" >>$install_log 2>&1)
665         if [[ $? != 0 ]]
666         then
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
669                 exit_install
670         fi
671 elif [[ "$COMMIT" ]]
672 then
673         ret=$(git checkout "$COMMIT" >>$install_log 2>&1)
674         if [[ $? != 0 ]]
675         then
676                 git_error=$(tail -n5 $install_log 2>&1)
677                 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
678                 exit_install
679         fi
680 elif [[ "$TAG" ]]
681 then
682         ret=$(git checkout "$TAG" >>$install_log 2>&1)
683         if [[ $? != 0 ]]
684         then
685         echo "error"
686                 git_error=$(tail -n5 $install_log 2>&1)
687                 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
688                 exit_install
689                 exit
690         fi
691 fi
692 if [[ "$DEBUG" == "yes" ]]
693 then
694         debug_opt=""
695 else
696         debug_opt="--disable-debug-log"
697 fi
698
699 echo "40" > $zen_pipe
700 echo "#Creating configuration files..." > $zen_pipe
701
702 if [[ $gtk_version == "GTK3"* ]]
703 then
704         ./autogen.sh "$debug_opt" >>$install_log 2>&1
705 else
706         ./autogen.sh "$debug_opt" --disable-gtk3 >>$install_log 2>&1
707 fi
708
709 echo "60" > $zen_pipe
710 echo "#Compiling..." > $zen_pipe
711
712 export CFLAGS=$CFLAGS" -Wno-deprecated-declarations"
713 export CXXFLAGS=$CXXFLAGS" -Wno-deprecated-declarations"
714 make -j >>$install_log 2>&1
715
716 if [[ $? != 0 ]]
717 then
718         zenity --title="$title" --width=370 --height=400 --error --text=$'Compile error' 2>/dev/null
719         exit_install
720         exit
721 fi
722
723 echo "90 " > $zen_pipe
724 echo "#Installing Geeqie..." > $zen_pipe
725
726 sudo --askpass make install >>$install_log 2>&1
727
728 # This is a temporary fix until the ZoneDetect project releases its source code
729 zonedetect_message="ZoneDetect database not loaded"
730 if [[ -d "/usr/local/lib/geeqie" ]]
731 then
732         if [[ ! -f "/usr/local/lib/geeqie/timezone21.bin" ]]
733         then
734                 sudo --askpass wget --directory-prefix=/usr/local/lib/geeqie/ https://github.com/BertoldVdb/ZoneDetect/raw/master/database/timezone21.bin >>$install_log 2>&1
735                 if [[ $? == 0 ]]
736                 then
737                         zonedetect_message=""
738                 fi
739         else
740                 zonedetect_message=""
741         fi
742 fi
743
744 rm $install_pass_script
745 mv -f $install_log install.log;
746
747 echo "100 " > $zen_pipe
748 rm $zen_pipe
749
750 (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
751
752 exit