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