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