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