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