Fix #975, #977: Change scripts from /bin/bash to /bin/sh
authorColin Clark <colin.clark@cclark.uk>
Sat, 19 Mar 2022 11:20:44 +0000 (11:20 +0000)
committerColin Clark <colin.clark@cclark.uk>
Sat, 19 Mar 2022 11:20:44 +0000 (11:20 +0000)
https://github.com/BestImageViewer/geeqie/pull/975/commits/01d45343f9de35ac6cdf696864066b9b1a5015a0
https://github.com/BestImageViewer/geeqie/pull/977/commits/c84ccd8408a6b88483e6690574390c7b27b49c01

- Change all /bin/bash to /bin/sh
- Make POSIX compliant
- Standardize mktemp calls
- Change some echo calls to printf
- Change some @brief headers
- Update CODING.md for above changes

27 files changed:
CODING.md
doc/create-doxygen-lua-api.sh
doc/create-shortcuts-xml.sh
geeqie-install-debian.sh
gen_changelog.sh
gen_readme.sh
plugins/camera-import/geeqie-camera-import
plugins/camera-import/geeqie-camera-import-hook-script
plugins/export-jpeg/geeqie-export-jpeg
plugins/geocode-parameters/geocode-parameters.awk
plugins/image-crop/geeqie-image-crop [changed mode: 0644->0755]
plugins/random-image/geeqie-random-image
plugins/rotate/geeqie-rotate
plugins/symlink/geeqie-symlink
plugins/tethered-photography/geeqie-tethered-photography
plugins/tethered-photography/geeqie-tethered-photography-hook-script
po/gen_translations_stats.sh
scripts/check-compiles.sh
scripts/doxygen-help.sh
scripts/generate-appimage.sh
scripts/generate-man-page.sh
scripts/keyword_merge.sh
scripts/new-release.sh
scripts/template-desktop.sh
scripts/untranslated-text.sh
scripts/web-help.sh
version.sh

index 2a4648b..e33bcdf 100644 (file)
--- a/CODING.md
+++ b/CODING.md
@@ -4,6 +4,7 @@
 [GPL header](#gpl-header)  
 [Git change log](#git-change-log)  
 [Source Code Style](#source-code-style)  
 [GPL header](#gpl-header)  
 [Git change log](#git-change-log)  
 [Source Code Style](#source-code-style)  
+[Shell Script Style](#shell-script-style)  
 [External Software Tools](#external-software-tools)  
 [Geeqie Software Tools](#geeqie-software-tools)  
 [Documentation](#documentation)  
 [External Software Tools](#external-software-tools)  
 [Geeqie Software Tools](#geeqie-software-tools)  
 [Documentation](#documentation)  
@@ -198,6 +199,25 @@ Use glib types when possible (ie. gint and gchar instead of int and char).
 Use glib functions when possible (i.e. `g_ascii_isspace()` instead of `isspace()`).  
 Check if used functions are not deprecated.
 
 Use glib functions when possible (i.e. `g_ascii_isspace()` instead of `isspace()`).  
 Check if used functions are not deprecated.
 
+---
+
+## Shell Script Style
+
+Use `/bin/sh` as the interpreter directive.  
+Ensure the script is POSIX compliant.  
+Use `printf` rather than `echo` except for plain text.  
+There are several versions of `mktemp`. Using the following definition helps portability (note that `template` is not optional):
+
+```sh
+mktemp [-d] [-q] template ...
+```
+
+and use for example this style:
+
+```sh
+mktemp  "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX"
+```
+
 ---
 ## External Software Tools
 
 ---
 ## External Software Tools
 
@@ -264,6 +284,36 @@ Shell scripts may also be validated, e.g.
 shellcheck --enable=add-default-case,avoid-nullary-conditions,check-unassigned-uppercase,deprecate-which,quote-safe-variables
 ```
 
 shellcheck --enable=add-default-case,avoid-nullary-conditions,check-unassigned-uppercase,deprecate-which,quote-safe-variables
 ```
 
+### shfmt
+
+Shell scripts may formatted to some extent with [shfmt](https://github.com/mvdan/sh). At the time of writing it does not format `if`, `for` or `while` statements in the style used by Geeqie.  
+However the following script can be used to achieve that:
+
+```sh
+#!/bin/sh
+
+shfmt -s -p -ci -sr -fn | awk '
+    {if ($0 ~ /; then/)
+        {
+        match($0, /^\t*/);
+        printf('%s\n', substr($0, 0, length($0) - 6));
+        printf('%s, substr("\t\t\t\t\t\t\t\t\t\t", 1, RLENGTH))
+        print("then")
+        }
+    else if ($0 ~ /; do/)
+        {
+        match($0, /^\t*/);
+        printf('%s\n', substr($0, 0, length($0) - 4));
+        printf('%s', substr("\t\t\t\t\t\t\t\t\t\t", 1, RLENGTH))
+        print("do")
+        }
+    else
+        {
+        print
+        }
+    }'
+```
+
 ### xmllint
 
 The .xml Help files may be validated with e.g. `xmllint`.
 ### xmllint
 
 The .xml Help files may be validated with e.g. `xmllint`.
index 0738d72..6730694 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 #**********************************************************************
 # Copyright (C) 2021 - The Geeqie Team
 
 #**********************************************************************
 # Copyright (C) 2021 - The Geeqie Team
@@ -21,7 +21,7 @@
 #**********************************************************************
 
 ## @file
 #**********************************************************************
 
 ## @file
-## @brief This script will create the Lua API html document, which is part of
+## @brief Create the Lua API html document, which is part of
 ## the Geeqie Help file.
 ##
 ## It is run during the generation of the help files.
 ## the Geeqie Help file.
 ##
 ## It is run during the generation of the help files.
 ##
 
 export PROJECT="Geeqie"
 ##
 
 export PROJECT="Geeqie"
-export VERSION=$(git tag --list v[1-9]* | tail -1)
+VERSION=$(git tag --list v[1-9]* | tail -1)
+export VERSION
 export SRCDIR="$PWD/.."
 export DOCDIR="$PWD/html/lua-api"
 export INLINE_SOURCES=NO
 export STRIP_CODE_COMMENTS=YES
 
 export SRCDIR="$PWD/.."
 export DOCDIR="$PWD/html/lua-api"
 export INLINE_SOURCES=NO
 export STRIP_CODE_COMMENTS=YES
 
-TMPFILE=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXX") || exit 1
+TMPFILE=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX") || exit 1
 
 # Modify the Geeqie doxygen.conf file to produce
 # only the data needed for the lua API document
 
 # Modify the Geeqie doxygen.conf file to produce
 # only the data needed for the lua API document
index a8ac2ce..05b6009 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 #**********************************************************************
 # Copyright (C) 2021 - The Geeqie Team
 
 #**********************************************************************
 # Copyright (C) 2021 - The Geeqie Team
@@ -128,19 +128,19 @@ $0 ~ /^  { "/ {
 '
 
 keys_xml=$(awk "$awk_window" ./src/dupe.c )
 '
 
 keys_xml=$(awk "$awk_window" ./src/dupe.c )
-echo -e "$pre_1_xml" "$duplicates_xml" "$pre_2_xml" "$keys_xml" "$post_xml" > ./doc/docbook/GuideReferenceDuplicatesShortcuts.xml
+printf '%b\n' "$pre_1_xml $duplicates_xml $pre_2_xml $keys_xml $post_xml" > ./doc/docbook/GuideReferenceDuplicatesShortcuts.xml
 
 keys_xml=$(awk "$awk_window" ./src/search.c )
 
 keys_xml=$(awk "$awk_window" ./src/search.c )
-echo -e "$pre_1_xml" "$search_xml" "$pre_2_xml" "$keys_xml" "$post_xml" > ./doc/docbook/GuideReferenceSearchShortcuts.xml
+printf '%b\n' "$pre_1_xml $search_xml $pre_2_xml $keys_xml $post_xml" > ./doc/docbook/GuideReferenceSearchShortcuts.xml
 
 keys_xml=$(awk "$awk_window" ./src/pan-view/pan-view.c )
 
 keys_xml=$(awk "$awk_window" ./src/pan-view/pan-view.c )
-echo -e "$pre_1_xml" "$pan_view_xml" "$pre_2_xml" "$keys_xml" "$post_xml" > ./doc/docbook/GuideReferencePanViewShortcuts.xml
+printf '%b\n' "$pre_1_xml $pan_view_xml $pre_2_xml $keys_xml $post_xml" > ./doc/docbook/GuideReferencePanViewShortcuts.xml
 
 keys_xml=$(awk "$awk_window" ./src/collect-table.c)
 
 keys_xml=$(awk "$awk_window" ./src/collect-table.c)
-echo -e "$pre_1_xml" "$collections_xml" "$pre_2_xml" "$keys_xml" "$post_xml" > ./doc/docbook/GuideReferenceCollectionsShortcuts.xml
+printf '%b\n' "$pre_1_xml $collections_xml $pre_2_xml $keys_xml $post_xml" > ./doc/docbook/GuideReferenceCollectionsShortcuts.xml
 
 keys_xml=$(awk "$awk_window" ./src/img-view.c)
 
 keys_xml=$(awk "$awk_window" ./src/img-view.c)
-echo -e "$pre_1_xml" "$image_xml" "$pre_2_xml" "$keys_xml" "$post_xml" > ./doc/docbook/GuideReferenceImageViewShortcuts.xml
+printf '%b\n' "$pre_1_xml $image_xml $pre_2_xml $keys_xml $post_xml" > ./doc/docbook/GuideReferenceImageViewShortcuts.xml
 
 keys_xml=$(awk "$awk_main_window" ./src/layout_util.c)
 
 keys_xml=$(awk "$awk_main_window" ./src/layout_util.c)
-echo -e "$pre_1_xml" "$main_window_xml" "$pre_2_xml" "$keys_xml" "$post_main_window_xml" > ./doc/docbook/GuideReferenceMainWindowShortcuts.xml
+printf '%b\n' "$pre_1_xml $main_window_xml $pre_2_xml $keys_xml $post_main_window_xml" > ./doc/docbook/GuideReferenceMainWindowShortcuts.xml
index e729436..6267613 100755 (executable)
@@ -1,15 +1,15 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 
 ## @file
-## @brief This script will download, compile, and install Geeqie on Debian-based systems.
+## @brief Download, compile, and install Geeqie on Debian-based systems.
 ##
 ##
-## If run from a folder that already contains the Geeqie sources, the source  
-## code will be updated from the repository.  
+## If run from a folder that already contains the Geeqie sources, the source
+## code will be updated from the repository.
 ## Dialogs allow the user to install additional features.
 ##
 
 ## Dialogs allow the user to install additional features.
 ##
 
-version="2022-01-15"
-description=$'
+version="2022-03-18"
+description='
 Geeqie is an image viewer.
 This script will download, compile, and install Geeqie on Debian-based systems.
 If run from a folder that already contains the Geeqie sources, the source
 Geeqie is an image viewer.
 This script will download, compile, and install Geeqie on Debian-based systems.
 If run from a folder that already contains the Geeqie sources, the source
@@ -27,73 +27,67 @@ Command line options are:
 '
 
 # Essential for compiling
 '
 
 # Essential for compiling
-essential_array=(
-"git"
-"build-essential"
-"autoconf"
-"libglib2.0-0"
-"intltool"
-"libtool"
-"yelp-tools"
-)
+essential_array="git
+build-essential
+autoconf
+libglib2.0-0
+intltool
+libtool
+yelp-tools"
 
 # Optional for both GTK2 and GTK3
 
 # Optional for both GTK2 and GTK3
-optional_array=(
-"LCMS (for color management)"
-"liblcms2-dev"
-"exiv2 (for exif handling)"
-"libgexiv2-dev"
-"lua (for --remote commands)"
-"liblua5.1-0-dev"
-"libffmpegthumbnailer (for mpeg thumbnails)"
-"libffmpegthumbnailer-dev"
-"libtiff (for tiff support)"
-"libtiff-dev"
-"libjpeg (for jpeg support)"
-"libjpeg-dev"
-"librsvg2 (for viewing .svg images)"
-"librsvg2-common"
-"libwmf (for viewing .wmf images)"
-"libwmf0.2-7-gtk"
-"exiftran (for image rotation)"
-"exiftran"
-"imagemagick (for image rotation)"
-"imagemagick"
-"exiv2 command line (for jpeg export)"
-"exiv2"
-"jpgicc (for jpeg export color correction)"
-"liblcms2-utils"
-"pandoc (for generating README help file)"
-"pandoc"
-"gphoto2 (for tethered photography and camera download plugins)"
-"gphoto2"
-"libimage-exiftool-perl (for jpeg extraction plugin)"
-"libimage-exiftool-perl"
-"libheif (for HEIF support)"
-"libheif-dev"
-"libwebp (for WebP images)"
-"libwebp-dev"
-"libdjvulibre (for DjVu images)"
-"libdjvulibre-dev"
-"libopenjp2 (for JP2 images)"
-"libopenjp2-7-dev"
-"libraw (for CR3 images)"
-"libraw-dev"
-"libomp (required by libraw)"
-"libomp-dev"
-"libarchive (for compressed files e.g. zip, including timezone)"
-"libarchive-dev"
-)
+optional_array="LCMS (for color management)
+liblcms2-dev
+exiv2 (for exif handling)
+libgexiv2-dev
+lua (for --remote commands)
+liblua5.1-0-dev
+libffmpegthumbnailer (for mpeg thumbnails)
+libffmpegthumbnailer-dev
+libtiff (for tiff support)
+libtiff-dev
+libjpeg (for jpeg support)
+libjpeg-dev
+librsvg2 (for viewing .svg images)
+librsvg2-common
+libwmf (for viewing .wmf images)
+libwmf0.2-7-gtk
+exiftran (for image rotation)
+exiftran
+imagemagick (for image rotation)
+imagemagick
+exiv2 command line (for jpeg export)
+exiv2
+jpgicc (for jpeg export color correction)
+liblcms2-utils
+pandoc (for generating README help file)
+pandoc
+gphoto2 (for tethered photography and camera download plugins)
+gphoto2
+libimage-exiftool-perl (for jpeg extraction plugin)
+libimage-exiftool-perl
+libheif (for HEIF support)
+libheif-dev
+libwebp (for WebP images)
+libwebp-dev
+libdjvulibre (for DjVu images)
+libdjvulibre-dev
+libopenjp2 (for JP2 images)
+libopenjp2-7-dev
+libraw (for CR3 images)
+libraw-dev
+libomp (required by libraw)
+libomp-dev
+libarchive (for compressed files e.g. zip, including timezone)
+libarchive-dev"
 
 # Optional for GTK3 only
 
 # Optional for GTK3 only
-optional_gtk3_array=(
-"libchamplain gtk (for GPS maps)"
-"libchamplain-gtk-0.12-dev"
-"libchamplain (for GPS maps)"
-"libchamplain-0.12-dev"
-"libpoppler (for pdf file preview)"
-"libpoppler-glib-dev"
-)
+optional_gtk3_array="libchamplain gtk (for GPS maps)
+libchamplain-gtk-0.12-dev
+libchamplain (for GPS maps)
+libchamplain-0.12-dev
+libpoppler (for pdf file preview)
+libpoppler-glib-dev"
 
 ####################################################################
 # Get System Info
 
 ####################################################################
 # Get System Info
@@ -101,65 +95,66 @@ optional_gtk3_array=(
 ####################################################################
 lowercase()
 {
 ####################################################################
 lowercase()
 {
-       echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
+       printf '%b\n' "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
 }
 
 systemProfile()
 {
 }
 
 systemProfile()
 {
-       OS=`lowercase \`uname\``
-       KERNEL=`uname -r`
-       MACH=`uname -m`
+       OS="$(lowercase "$(uname)")"
+       KERNEL=$(uname -r)
+       MACH=$(uname -m)
 
 
-       if [ "${OS}" == "windowsnt" ]
+       if [ "${OS}" = "windowsnt" ]
        then
                OS=windows
        then
                OS=windows
-       elif [ "${OS}" == "darwin" ]
+       elif [ "${OS}" = "darwin" ]
        then
                OS=mac
        else
        then
                OS=mac
        else
-               OS=`uname`
+               OS=$(uname)
                if [ "${OS}" = "SunOS" ]
                then
                        OS=Solaris
                if [ "${OS}" = "SunOS" ]
                then
                        OS=Solaris
-                       ARCH=`uname -p`
-                       OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"
+                       ARCH=$(uname -p)
+                       OSSTR="${OS} ${REV}(${ARCH} $(uname -v))"
                elif [ "${OS}" = "AIX" ]
                then
                elif [ "${OS}" = "AIX" ]
                then
-                       OSSTR="${OS} `oslevel` (`oslevel -r`)"
+                       # shellcheck disable=SC2034
+                       OSSTR="${OS} $(oslevel) ($(oslevel -r))"
                elif [ "${OS}" = "Linux" ]
                then
                        if [ -f /etc/redhat-release ]
                        then
                                DistroBasedOn='RedHat'
                elif [ "${OS}" = "Linux" ]
                then
                        if [ -f /etc/redhat-release ]
                        then
                                DistroBasedOn='RedHat'
-                               DIST=`cat /etc/redhat-release |sed s/\ release.*//`
-                               PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
-                               REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
+                               DIST=$(sed s/\ release.*// /etc/redhat-release)
+                               PSUEDONAME=$(sed s/.*\(// /etc/redhat-release | sed s/\)//)
+                               REV=$(sed s/.*release\ // /etc/redhat-release | sed s/\ .*//)
                        elif [ -f /etc/SuSE-release ]
                        then
                                DistroBasedOn='SuSe'
                        elif [ -f /etc/SuSE-release ]
                        then
                                DistroBasedOn='SuSe'
-                               PSUEDONAME=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`
-                               REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`
+                               PSUEDONAME=$(tr "\n" ' ' < /etc/SuSE-release | sed s/VERSION.*//)
+                               REV=$(tr "\n" ' ' < /etc/SuSE-release | sed s/.*=\ //)
                        elif [ -f /etc/mandrake-release ]
                        then
                                DistroBasedOn='Mandrake'
                        elif [ -f /etc/mandrake-release ]
                        then
                                DistroBasedOn='Mandrake'
-                               PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
-                               REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
+                               PSUEDONAME=$(sed s/.*\(// /etc/mandrake-release | sed s/\)//)
+                               REV=$(cat | sed s/.*release\ // /etc/mandrake-release | sed s/\ .*//)
                        elif [ -f /etc/debian_version ]
                        then
                                DistroBasedOn='Debian'
                                if [ -f /etc/lsb-release ]
                                then
                        elif [ -f /etc/debian_version ]
                        then
                                DistroBasedOn='Debian'
                                if [ -f /etc/lsb-release ]
                                then
-                                       DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F=  '{ print $2 }'`
-                                       PSUEDONAME=`cat /etc/lsb-release | grep '^DISTRIB_CODENAME' | awk -F=  '{ print $2 }'`
-                                       REV=`cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F=  '{ print $2 }'`
+                                       DIST=$(grep '^DISTRIB_ID' /etc/lsb-release | awk -F= '{ print $2 }')
+                                       PSUEDONAME=$(grep '^DISTRIB_CODENAME' /etc/lsb-release | awk -F= '{ print $2 }')
+                                       REV=$(grep '^DISTRIB_RELEASE' /etc/lsb-release | awk -F= '{ print $2 }')
                                fi
                        fi
                        if [ -f /etc/UnitedLinux-release ]
                        then
                                fi
                        fi
                        if [ -f /etc/UnitedLinux-release ]
                        then
-                               DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]"
+                               DIST="${DIST}[$(tr "\n" ' ' < /etc/UnitedLinux-release | sed s/VERSION.*//)]"
                        fi
                        fi
-                       OS=`lowercase $OS`
-                       DistroBasedOn=`lowercase $DistroBasedOn`
+                       OS=$(lowercase $OS)
+                       DistroBasedOn=$(lowercase $DistroBasedOn)
                        readonly OS
                        readonly DIST
                        readonly DistroBasedOn
                        readonly OS
                        readonly DIST
                        readonly DistroBasedOn
@@ -173,26 +168,29 @@ systemProfile()
 
 install_essential()
 {
 
 install_essential()
 {
-       arraylength=${#essential_array[@]}
-       for (( i=0; i<${arraylength}; i=i+1 ));
+       i=0
+
+       for file in $essential_array
        do
        do
-               package_query ${essential_array[$i]}
-               if [ $? != 0 ]
+               if [ $((i % 2)) -ne 0 ]
                then
                then
-                       package_install ${essential_array[$i]}
+                       if package_query "$file"
+                       then
+                               package_install "$file"
+                       fi
                fi
                fi
+
+               i=$((i + 1))
        done
 
        done
 
-       if [[ $1 == "GTK3" ]]
+       if [ "$1" = "GTK3" ]
        then
        then
-               package_query "libgtk-3-dev"
-               if [ $? != 0 ]
+               if package_query "libgtk-3-dev"
                then
                        package_install libgtk-3-dev
                fi
        else
                then
                        package_install libgtk-3-dev
                fi
        else
-               package_query "libgtk2.0-dev"
-               if [ $? != 0 ]
+               if package_query "libgtk2.0-dev"
                then
                        package_install libgtk2.0-dev
                fi
                then
                        package_install libgtk2.0-dev
                fi
@@ -205,10 +203,10 @@ install_options()
        then
                OLDIFS=$IFS
                IFS='|'
        then
                OLDIFS=$IFS
                IFS='|'
-               set $options
-               while [ $# -gt 0 ];
+               set "$options"
+               while [ $# -gt 0 ]
                do
                do
-                       package_install $1
+                       package_install "$1"
                        shift
                done
                IFS=$OLDIFS
                        shift
                done
                IFS=$OLDIFS
@@ -217,19 +215,19 @@ install_options()
 
 uninstall()
 {
 
 uninstall()
 {
-       current_dir=$(basename $PWD)
-       if [[ $current_dir == "geeqie" ]]
+       current_dir="$(basename "$PWD")"
+       if [ "$current_dir" = "geeqie" ]
        then
        then
+
                sudo --askpass make uninstall
                sudo --askpass make uninstall
-               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
 
 
-               if [[ $? == 1 ]]
+               if ! 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
                then
                        cd ..
                        sudo --askpass rm -rf geeqie
                fi
        else
                then
                        cd ..
                        sudo --askpass rm -rf geeqie
                fi
        else
-               zenity --title="Uninstall Geeqie" --width=370 --text="This is not a geeqie installation folder!\n\n$PWD" --warning 2>/dev/null
+               zenity --title="Uninstall Geeqie" --width=370 --text="This is not a geeqie installation folder!\n\n$PWD" --warning 2> /dev/null
        fi
 
        exit_install
        fi
 
        exit_install
@@ -237,14 +235,16 @@ uninstall()
 
 package_query()
 {
 
 package_query()
 {
-       if [[ $DistroBasedOn == "debian" ]]
+       if [ "$DistroBasedOn" = "debian" ]
        then
        then
-               res=$(dpkg-query --show --showformat='${Status}' $1 2>>$install_log)
-               if [[ "$res" == "install ok installed"* ]]
+
+               # shellcheck disable=SC2086
+               res=$(dpkg-query --show --showformat='${Status}' "$1" 2>> $install_log)
+               if [ "${res}" = "install ok installed" ]
                then
                then
-                       status=0
-               else
                        status=1
                        status=1
+               else
+                       status=0
                fi
        fi
        return $status
                fi
        fi
        return $status
@@ -252,44 +252,46 @@ package_query()
 
 package_install()
 {
 
 package_install()
 {
-       if [[ $DistroBasedOn == "debian" ]]
+       if [ "$DistroBasedOn" = "debian" ]
        then
        then
-               sudo --askpass apt-get --assume-yes install $@ >>$install_log 2>&1
+               # shellcheck disable=SC2024
+               sudo --askpass apt-get --assume-yes install "$@" >> "$install_log" 2>&1
        fi
 }
 
 exit_install()
 {
        fi
 }
 
 exit_install()
 {
-       rm $install_pass_script >/dev/null 2>&1
-       #~ rm $install_log >/dev/null 2>&1
+       rm "$install_pass_script" > /dev/null 2>&1
 
 
-       if [[ -p $zen_pipe ]]
+       if [ -p "$zen_pipe" ]
        then
        then
-               echo "100" > $zen_pipe
-               echo "#End" > $zen_pipe
+               printf '%b\n' "100" > "$zen_pipe"
+               printf '%b\n' "#End" > "$zen_pipe"
        fi
 
        fi
 
-       zenity --title="$title" --width=370 --text=$'Geeqie is not installed\nLog file: '$install_log --info 2>/dev/null
+       zenity --title="$title" --width=370 --text="Geeqie is not installed\nLog file: $install_log" --info 2> /dev/null
 
 
-       rm $zen_pipe >/dev/null 2>&1
+       rm "$zen_pipe" > /dev/null 2>&1
 
        exit 1
 }
 
 # Entry point
 
 
        exit 1
 }
 
 # Entry point
 
+IFS='
+'
+
 # If uninstall has been run, maybe the current directory no longer exists
 # If uninstall has been run, maybe the current directory no longer exists
-ls $PWD >/dev/null
-if [[ $? != 0 ]]
+if [ ! -d "$PWD" ]
 then
 then
-       zenity --error --title="Install Geeqie and dependencies" --width=370 --text="Folder $PWD does not exist!" 2>/dev/null
+       zenity --error --title="Install Geeqie and dependencies" --width=370 --text="Folder $PWD does not exist!" 2> /dev/null
 
        exit
 fi
 
 # Check system type
 systemProfile
 
        exit
 fi
 
 # Check system type
 systemProfile
-if [[ $DistroBasedOn != "debian" ]]
+if [ "$DistroBasedOn" != "debian" ]
 then
        zenity --error --title="Install Geeqie and dependencies" --width=370 --text="Unknown operating system:\n
 Operating System: $OS
 then
        zenity --error --title="Install Geeqie and dependencies" --width=370 --text="Unknown operating system:\n
 Operating System: $OS
@@ -298,7 +300,7 @@ Psuedoname: $PSUEDONAME
 Revision: $REV
 DistroBasedOn: $DistroBasedOn
 Kernel: $KERNEL
 Revision: $REV
 DistroBasedOn: $DistroBasedOn
 Kernel: $KERNEL
-Machine: $MACH" 2>/dev/null
+Machine: $MACH" 2> /dev/null
 
        exit
 fi
 
        exit
 fi
@@ -307,70 +309,68 @@ fi
 OPTS=$(getopt -o vhc:t:b:ld: --long version,help,commit:,tag:,back:,list,debug: -- "$@")
 eval set -- "$OPTS"
 
 OPTS=$(getopt -o vhc:t:b:ld: --long version,help,commit:,tag:,back:,list,debug: -- "$@")
 eval set -- "$OPTS"
 
-while true;
+while true
 do
        case "$1" in
 do
        case "$1" in
-       -v | --version )
-               echo "$version"
-               exit
-               ;;
-       -h | --help )
-               echo "$description"
-               exit
-               ;;
-       -c | --commit )
-               COMMIT="$2"
-               shift
-               shift
-               ;;
-       -t | --tag )
-               TAG="$2"
-               shift;
-               shift
-               ;;
-       -b | --back )
-               BACK="$2"
-               shift;
-               shift
-               ;;
-       -l | --list )
-               LIST="$2"
-               shift;
-               shift
-               ;;
-       -d | --debug )
-               DEBUG="$2"
-               shift;
-               shift
-               ;;
-       * ) break
-               ;;
+               -v | --version)
+                       printf '%b\n' "$version"
+                       exit
+                       ;;
+               -h | --help)
+                       printf '%b\n' "$description"
+                       exit
+                       ;;
+               -c | --commit)
+                       COMMIT="$2"
+                       shift
+                       shift
+                       ;;
+               -t | --tag)
+                       TAG="$2"
+                       shift
+                       shift
+                       ;;
+               -b | --back)
+                       BACK="$2"
+                       shift
+                       shift
+                       ;;
+               -l | --list)
+                       LIST="$2"
+                       shift
+                       shift
+                       ;;
+               -d | --debug)
+                       DEBUG="$2"
+                       shift
+                       shift
+                       ;;
+               *)
+                       break
+                       ;;
        esac
 done
 
        esac
 done
 
-if [[ "$LIST" ]]
+if [ "$LIST" ]
 then
 then
-       echo "Essential libraries:"
-       arraylength=${#essential_array[@]}
-       for (( i=0; i<${arraylength}; i=i+1 ));
+       printf '%b\n' "Essential libraries:"
+       for file in $essential_array
        do
        do
-               echo ${essential_array[$i]}
+               printf '%b\n' "$file"
        done
 
        done
 
-       echo " "
-       echo "Optional libraries:"
-       arraylength=${#optional_array[@]}
-       for (( i=0; i<${arraylength}; i=i+1 ));
+       printf '\n'
+       printf '%b\n' "Optional libraries:"
+       for file in $optional_array
        do
        do
-               echo ${optional_array[$i]}
+               printf '%b\n' "$file"
        done
 
        done
 
-       echo " "
-       echo "Optional for GTK3:"
-       arraylength=${#optional_gtk3_array[@]}
-       for (( i=0; i<${arraylength}; i=i+1 ));
+       printf '\n'
+       printf '%b\n' "Optional for GTK3:"
+       for file in $optional_gtk3_array
        do
        do
-               echo ${optional_gtk3_array[$i]}
+               printf '%b\n' "$file"
        done
 
        exit
        done
 
        exit
@@ -379,7 +379,7 @@ fi
 # If a Geeqie folder already exists here, warn the user
 if [ -d "geeqie" ]
 then
 # If a Geeqie folder already exists here, warn the user
 if [ -d "geeqie" ]
 then
-       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
+       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
 
        exit
 fi
 
        exit
 fi
@@ -392,7 +392,7 @@ else
        # If it looks like something else is already installed here, warn the user
        if [ -d ".git" ] || [ -d "src" ]
        then
        # If it looks like something else is already installed here, warn the user
        if [ -d ".git" ] || [ -d "src" ]
        then
-               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
+               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
 
                exit
        else
 
                exit
        else
@@ -401,10 +401,10 @@ else
 fi
 
 # Use GTK3 as default
 fi
 
 # Use GTK3 as default
-gk2_installed=FALSE
+gtk2_installed=FALSE
 gtk3_installed=TRUE
 
 gtk3_installed=TRUE
 
-if [[ $mode == "install" ]]
+if [ "$mode" = "install" ]
 then
        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."
 
 then
        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."
 
@@ -417,231 +417,239 @@ else
        install_option=FALSE
 
        # When updating, use previous installation as default
        install_option=FALSE
 
        # When updating, use previous installation as default
-       if [[ -f config.log ]]
+       if [ -f config.log ]
        then
        then
-               grep gtk-2.0 config.log >/dev/null
-               if [[ $? != 0 ]]
+               if grep gtk-2.0 config.log > /dev/null
                then
                then
-                       gtk2_installed=FALSE
-                       gtk3_installed=TRUE
-               else
                        gtk2_installed=TRUE
                        gtk3_installed=FALSE
                        gtk2_installed=TRUE
                        gtk3_installed=FALSE
+               else
+                       gtk2_installed=FALSE
+                       gtk3_installed=TRUE
                fi
        fi
 fi
 
 # Ask whether to install GTK2 or GTK3 or uninstall
 
                fi
        fi
 fi
 
 # Ask whether to install GTK2 or GTK3 or uninstall
 
-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)
-
-if [[ $? == 1 ]]
+if ! 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)
 then
        exit
 fi
 
 # Environment variable SUDO_ASKPASS cannot be "zenity --password",
 # so create a temporary script containing the command
 then
        exit
 fi
 
 # Environment variable SUDO_ASKPASS cannot be "zenity --password",
 # so create a temporary script containing the command
-install_pass_script=$(mktemp --tmpdir geeqie_install_XXXXXX.sh)
-echo $'#!/bin/bash
-zenity --password --title=\"'$title$'\" --width=370 2>/dev/null
-if [[ $? > 0 ]]
+install_pass_script=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
+printf '%b\n' "#!/bin/sh
+if zenity --password --title=\"$title\" --width=370 2>/dev/null
 then
        exit 1
 then
        exit 1
-fi
-\n' > $install_pass_script
-chmod +x $install_pass_script
+fi" > "$install_pass_script"
+chmod +x "$install_pass_script"
 export SUDO_ASKPASS=$install_pass_script
 
 export SUDO_ASKPASS=$install_pass_script
 
-if [[ $gtk_version == "Uninstall" ]]
+if [ "$gtk_version" = "Uninstall" ]
 then
        uninstall
        exit
 fi
 
 # Put the install log in tmp, to avoid writing to PWD during a new install
 then
        uninstall
        exit
 fi
 
 # Put the install log in tmp, to avoid writing to PWD during a new install
-rm install.log 2>/dev/null
-install_log=$(mktemp --tmpdir geeqie_install_XXXXXX.log)
+rm install.log 2> /dev/null
+install_log=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
 
 
-sleep 100 | zenity --title="$title" --text="Checking for installed files" --width=370 --progress --pulsate 2>/dev/null &
+sleep 100 | zenity --title="$title" --text="Checking for installed files" --width=370 --progress --pulsate 2> /dev/null &
 zen_pid=$!
 
 # Get the standard options that are not yet installed
 zen_pid=$!
 
 # Get the standard options that are not yet installed
-arraylength=${#optional_array[@]}
-for (( i=0; i<${arraylength}; i=i+2 ));
+i=0
+for file in $optional_array
 do
 do
-       package_query ${optional_array[$i+1]}
-       if [ $? != 0 ]
+       if [ $((i % 2)) -eq 0 ]
        then
        then
-               if [ -z "$option_string" ]
+               package_title="$file"
+       else
+               if package_query "$file"
                then
                then
-                       option_string="$install_option"$'\n'"${optional_array[$i]}"$'\n'"${optional_array[$i+1]}"
-               else
-                       option_string="$option_string"$'\n'"$install_option"$'\n'"${optional_array[$i]}"$'\n'"${optional_array[$i+1]}"
+                       if [ -z "$option_string" ]
+                       then
+                               option_string="${install_option:+${install_option}}\n${file}\n${file}"
+                       else
+                               option_string="${option_string:+${option_string}}\n$install_option\n${package_title}\n${file}"
+                       fi
                fi
        fi
                fi
        fi
+       i=$((i + 1))
 done
 
 # If GTK3 required, get the GTK3 options not yet installed
 done
 
 # If GTK3 required, get the GTK3 options not yet installed
-if [[ "$gtk_version" == "GTK3"* ]]
+if [ -z "${gtk_version%%GTK3*}" ]
 then
 then
-       arraylength=${#optional_gtk3_array[@]}
-       for (( i=0; i<${arraylength}; i=i+2 ));
+       i=0
+       for file in $optional_gtk3_array
        do
        do
-               package_query ${optional_gtk3_array[$i+1]}
-               if [ $? != 0 ]
+               if [ $((i % 2)) -eq 0 ]
                then
                then
-                       if [ -z "$option_string" ]
+                       package_title="$file"
+               else
+                       if package_query "$file"
                        then
                        then
-                               option_string="$install_option"$'\n'"${optional_gtk3_array[$i]}"$'\n'"${optional_gtk3_array[$i+1]}"
-                       else
-                               option_string="$option_string"$'\n'"$install_option"$'\n'"${optional_gtk3_array[$i]}"$'\n'"${optional_gtk3_array[$i+1]}"
+                               if [ -z "$option_string" ]
+                               then
+                                       option_string="${install_option:+${install_option}}\n${file}\n${file}"
+                               else
+                                       option_string="${option_string:+${option_string}}\n$install_option\n${package_title}\n${file}"
+                               fi
                        fi
                fi
                        fi
                fi
+               i=$((i + 1))
        done
 fi
 
        done
 fi
 
-kill $zen_pid 2>/dev/null
+kill $zen_pid 2> /dev/null
 
 # Ask the user which options to install
 if [ -n "$option_string" ]
 then
 
 # Ask the user which options to install
 if [ -n "$option_string" ]
 then
-       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)
-
-       if [[ $? == 1 ]]
+       if ! options=$(printf '%b\n' "$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)
        then
                exit_install
        fi
 fi
 
 # Start of Zenity progress section
        then
                exit_install
        fi
 fi
 
 # Start of Zenity progress section
-zen_pipe=$(mktemp --dry-run --tmpdir geeqie_install_pipe_XXXXXX)
-mkfifo $zen_pipe
-(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 &
+zen_pipe=$(mktemp -u "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
+mkfifo "$zen_pipe"
+(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 &
 
 
-echo "2" > $zen_pipe
-echo "#Installing essential libraries..." > $zen_pipe
+printf '%b\n' "2" > "$zen_pipe"
+printf '%b\n' "#Installing essential libraries..." > "$zen_pipe"
 
 
-install_essential $gtk_version
+install_essential "$gtk_version"
 
 
-echo "4" > $zen_pipe
-echo "#Installing options..." > $zen_pipe
+printf '%b\n' "4" > "$zen_pipe"
+printf '%b\n' "#Installing options..." > "$zen_pipe"
 
 install_options
 
 
 install_options
 
-echo "6" > $zen_pipe
-echo "#Installing extra loaders..." > $zen_pipe
+printf '%b\n' "6" > "$zen_pipe"
+printf '%b\n' "#Installing extra loaders..." > "$zen_pipe"
 
 
-echo "10" > $zen_pipe
-echo "#Getting new sources from server..." > $zen_pipe
+printf '%b\n' "10" > "$zen_pipe"
+printf '%b\n' "#Getting new sources from server..." > "$zen_pipe"
 
 
-if [[ $mode == "install" ]]
+if [ "$mode" = "install" ]
 then
 then
-       ret=$(git clone git://geeqie.org/geeqie.git >>$install_log 2>&1)
+       if ! git clone git://geeqie.org/geeqie.git >> "$install_log" 2>&1
+       then
+               git_error=$(tail -n5 "$install_log" 2>&1)
+               zenity --title="$title" --width=370 --height=400 --error --text="Git error:\n\n$git_error" 2> /dev/null
+               exit_install
+       fi
 else
 else
-       git checkout master >>$install_log 2>&1
-       if [[ $? != 0 ]]
+       if ! git checkout master >> "$install_log" 2>&1
        then
        then
-               git_error=$(tail -n5 $install_log 2>&1)
-               zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
+               git_error="$(tail -n25 "$install_log" 2>&1)"
+               zenity --title="$title" --width=370 --height=400 --error --text="Git error:\n\n$git_error" 2> /dev/null
+               exit_install
+       fi
+       if ! git pull >> "$install_log" 2>&1
+       then
+               git_error=$(tail -n5 "$install_log" 2>&1)
+               zenity --title="$title" --width=370 --height=400 --error --text="Git error:\n\n$git_error" 2> /dev/null
                exit_install
        fi
                exit_install
        fi
-       ret=$(git pull >>$install_log 2>&1)
-fi
-
-if [[ $? != 0 ]]
-then
-       git_error=$(tail -n5 $install_log 2>&1)
-       zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
-       exit_install
 fi
 
 fi
 
-echo "20" > $zen_pipe
-echo "#Cleaning installed version..." > $zen_pipe
+printf '%b\n' "20" > "$zen_pipe"
+printf '%b\n' "#Cleaning installed version..." > "$zen_pipe"
 
 
-if [[ $mode == "install" ]]
+if [ $mode = "install" ]
 then
 then
-       cd geeqie
+       cd geeqie || exit 1
 else
 else
-       sudo --askpass make uninstall >>$install_log 2>&1
-       sudo --askpass make maintainer-clean >>$install_log 2>&1
+       # shellcheck disable=SC2024
+       sudo --askpass make uninstall >> "$install_log" 2>&1
+       # shellcheck disable=SC2024
+       sudo --askpass make maintainer-clean >> "$install_log" 2>&1
 fi
 
 fi
 
-echo "30" > $zen_pipe
-echo "#Checkout required version..." > $zen_pipe
+printf '%b\n' "30" > "$zen_pipe"
+printf '%b\n' "#Checkout required version..." > "$zen_pipe"
 
 
-if [[ "$BACK" ]]
+if [ "$BACK" ]
 then
 then
-       ret=$(git checkout master~"$BACK" >>$install_log 2>&1)
-       if [[ $? != 0 ]]
+       if ! git checkout master~"$BACK" >> "$install_log" 2>&1
        then
        then
-               git_error=$(tail -n5 $install_log 2>&1)
-               zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
+               git_error=$(tail -n5 "$install_log" 2>&1)
+               zenity --title="$title" --width=370 --height=400 --error --text="Git error:\n\n$git_error" 2> /dev/null
                exit_install
        fi
                exit_install
        fi
-elif [[ "$COMMIT" ]]
+elif [ "$COMMIT" ]
 then
 then
-       ret=$(git checkout "$COMMIT" >>$install_log 2>&1)
-       if [[ $? != 0 ]]
+
+       if ! git checkout "$COMMIT" >> "$install_log" 2>&1
        then
        then
-               git_error=$(tail -n5 $install_log 2>&1)
-               zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
+               git_error=$(tail -n5 "$install_log" 2>&1)
+               zenity --title="$title" --width=370 --height=400 --error --text="Git error:\n\n$git_error" 2> /dev/null
                exit_install
        fi
                exit_install
        fi
-elif [[ "$TAG" ]]
+elif [ "$TAG" ]
 then
 then
-       ret=$(git checkout "$TAG" >>$install_log 2>&1)
-       if [[ $? != 0 ]]
+       if ! git checkout "$TAG" >> "$install_log" 2>&1
        then
        then
-       echo "error"
-               git_error=$(tail -n5 $install_log 2>&1)
-               zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
+               git_error=$(tail -n5 "$install_log" 2>&1)
+               zenity --title="$title" --width=370 --height=400 --error --text="Git error:\n\n$git_error" 2> /dev/null
                exit_install
                exit
        fi
 fi
                exit_install
                exit
        fi
 fi
-if [[ "$DEBUG" == "yes" ]]
+if [ "$DEBUG" = "yes" ]
 then
        debug_opt=""
 else
        debug_opt="--disable-debug-log"
 fi
 
 then
        debug_opt=""
 else
        debug_opt="--disable-debug-log"
 fi
 
-echo "40" > $zen_pipe
-echo "#Creating configuration files..." > $zen_pipe
+printf '%b\n' "40" > "$zen_pipe"
+printf '%b\n' "#Creating configuration files..." > "$zen_pipe"
 
 
-if [[ $gtk_version == "GTK3"* ]]
+if [ -z "${gtk_version%%GTK3*}" ]
 then
 then
-       ./autogen.sh "$debug_opt" >>$install_log 2>&1
+       ./autogen.sh "$debug_opt" >> "$install_log" 2>&1
 else
 else
-       ./autogen.sh "$debug_opt" --disable-gtk3 >>$install_log 2>&1
+       ./autogen.sh "$debug_opt" --disable-gtk3 >> "$install_log" 2>&1
 fi
 
 fi
 
-echo "60" > $zen_pipe
-echo "#Compiling..." > $zen_pipe
+printf '%b\n' "60" > "$zen_pipe"
+printf '%b\n' "#Compiling..." > "$zen_pipe"
 
 export CFLAGS=$CFLAGS" -Wno-deprecated-declarations"
 export CXXFLAGS=$CXXFLAGS" -Wno-deprecated-declarations"
 
 export CFLAGS=$CFLAGS" -Wno-deprecated-declarations"
 export CXXFLAGS=$CXXFLAGS" -Wno-deprecated-declarations"
-make -j >>$install_log 2>&1
 
 
-if [[ $? != 0 ]]
+if ! make -j >> "$install_log" 2>&1
 then
 then
-       zenity --title="$title" --width=370 --height=400 --error --text=$'Compile error' 2>/dev/null
+       zenity --title="$title" --width=370 --height=400 --error --text="Compile error" 2> /dev/null
        exit_install
        exit
 fi
 
        exit_install
        exit
 fi
 
-echo "90 " > $zen_pipe
-echo "#Installing Geeqie..." > $zen_pipe
+printf '%b\n' "90 " > "$zen_pipe"
+printf '%b\n' "#Installing Geeqie..." > "$zen_pipe"
 
 
-sudo --askpass make install >>$install_log 2>&1
+# shellcheck disable=SC2024
+sudo --askpass make install >> "$install_log" 2>&1
 
 
-rm $install_pass_script
-mv -f $install_log install.log;
+rm "$install_pass_script"
+mv -f "$install_log" install.log
 
 
-echo "100 " > $zen_pipe
-rm $zen_pipe
+printf '%b\n' "100 " > "$zen_pipe"
+rm "$zen_pipe"
 
 
-(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
+(for i in $(seq 0 4 100)
+do
+       printf '%b\n' "$i"
+       sleep 0.1
+done) | zenity --progress --title="$title" --width=370 --text="Geeqie installation complete...\n" --auto-close --percentage=0 2> /dev/null
 
 exit
 
 exit
index 2d42d13..e74bd59 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 ## @file
 #!/bin/sh
 
 ## @file
-## @brief Script to update ChangeLog file  
+## @brief Update ChangeLog file  
 ## - it keeps "pre-svn" history and inserts git log at top,  
 ## - it uses C locale for date format.  
 ## - It has to be run where ChangeLog.gqview is.  
 ## - it keeps "pre-svn" history and inserts git log at top,  
 ## - it uses C locale for date format.  
 ## - It has to be run where ChangeLog.gqview is.  
index 5ebf172..4ffa123 100755 (executable)
@@ -1,20 +1,20 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 ## @brief Convert README.md to README.html
 ##
 
 ## @file
 ## @brief Convert README.md to README.html
 ##
-## Script to create README.html file,
+## Ceate README.html file,
 ##
 
 if [ ! -e "README.md" ]
 then
 ##
 
 if [ ! -e "README.md" ]
 then
-       echo "ERROR: README.md not found"
+       printf '%s\n' "ERROR: README.md not found"
        exit 1
 fi
 
        exit 1
 fi
 
-if [ ! -x "$(command -v pandoc)" ]
+if ! command -v pandoc > /dev/null 2>&1
 then
 then
-       echo "ERROR: File pandoc not installed"
+       printf '%s\n' "ERROR: File pandoc not installed"
        exit 1
 fi
 
        exit 1
 fi
 
index 2054b67..7dd131a 100755 (executable)
@@ -1,38 +1,35 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 ## @brief Import all images from camera
 ##
 ## Requires gphoto2
 ##
 
 ## @file
 ## @brief Import all images from camera
 ##
 ## Requires gphoto2
 ##
-
-function finish 
+finish()
 {
        if [ -f /tmp/geeqie-camera-import-files ]
        then
                rm /tmp/geeqie-camera-import-files
        fi
 
 {
        if [ -f /tmp/geeqie-camera-import-files ]
        then
                rm /tmp/geeqie-camera-import-files
        fi
 
-       if [ -p $zen_pipe ]
+       if [ -p "$zen_pipe" ]
        then
        then
-               rm $zen_pipe
+               rm "$zen_pipe"
        fi
 
        if [ "$gphoto2_pid" != "" ]
        then
        fi
 
        if [ "$gphoto2_pid" != "" ]
        then
-               ps -p $gphoto2_pid > /dev/null
-               if [ $? -eq 0 ]
+               if ps -p "$gphoto2_pid" > /dev/null
                then
                then
-                       kill $gphoto2_pid
+                       kill "$gphoto2_pid"
                fi
        fi
 
        if [ "$zen_pid" != "" ]
        then
                fi
        fi
 
        if [ "$zen_pid" != "" ]
        then
-               ps -p $zen_pid > /dev/null
-               if [ $? -eq 0 ]
+               if ps -p "$zen_pid" > /dev/null
                then
                then
-                       kill $zen_pid
+                       kill "$zen_pid"
                fi
        fi
 }
                fi
        fi
 }
@@ -40,7 +37,7 @@ trap finish EXIT
 
 if ! [ -x "$(command -v gphoto2)" ]
 then
 
 if ! [ -x "$(command -v gphoto2)" ]
 then
-       zenity --title="Geeqie camera import" --info --width=200 --text="gphoto2 is not installed" 2>/dev/null
+       zenity --title="Geeqie camera import" --info --width=200 --text="gphoto2 is not installed" 2> /dev/null
        exit 0
 fi
 
        exit 0
 fi
 
@@ -49,34 +46,35 @@ then
        rm /tmp/geeqie-camera-import.log
 fi
 
        rm /tmp/geeqie-camera-import.log
 fi
 
-if [ $(gphoto2 --auto-detect | wc -l) -le 2 ]
+if [ "$(gphoto2 --auto-detect | wc -l)" -le 2 ]
 then
 then
-       zenity --error --title="Geeqie camera import" --text="No camera detected" --window-icon=/usr/local/share/pixmaps/geeqie.png --width=250 2>/dev/null
+       zenity --error --title="Geeqie camera import" --text="No camera detected" --window-icon=/usr/local/share/pixmaps/geeqie.png --width=250 2> /dev/null
        exit 0
 fi
 
        exit 0
 fi
 
-list=$(gphoto2 --auto-detect | tail +3)
-readarray -t split_list <<<"$list"
+IFS='
+'
 
 
+list=$(gphoto2 --auto-detect | tail -n +3)
 camera_list=""
 n=1
 camera_list=""
 n=1
-count=$(gphoto2 --auto-detect | tail +3 | wc -l)
-if [[ $count -gt 1 ]]
+count=$(gphoto2 --auto-detect | tail -n +3 | wc -l)
+if [ "$count" -gt 1 ]
 then
 then
-       for camera in "${split_list[@]}"
+       for camera in $list
        do
        do
-               if [[ $n -eq $count ]]
+               if [ "$n" -eq "$count" ]
                then
                then
-                       camera_list="$camera_list"$'TRUE\n'"$camera"$'\n'"$n"
+                       camera_list="${camera_list:+${camera_list}}TRUE\n$camera\n$n"
                else
                else
-                       camera_list="$camera_list"$'FALSE\n'"$camera"$'\n'"$n"$'\n'
+                       camera_list="${camera_list:+${camera_list}}FALSE\n$camera\n$n\n"
                fi
                fi
-               n=$((n+1))
+               n=$((n + 1))
        done
 
        done
 
-       camera_selected=$(echo "$camera_list" | zenity  --width=500 --height=250 --title="Geeqie camera import" --list  --text "Select camera" --radiolist  --column "Select" --column "Camera" --column "n" --hide-column=3 --print-column=2 2>/dev/null) 
+       camera_selected=$(printf '%b' "$camera_list" | zenity --width=500 --height=250 --title="Geeqie camera import" --list --text "Select camera" --radiolist --column "Select" --column "Camera" --column "n" --print-column=2 2> /dev/null)
 
 
-       if [[ $? == 1 ]]
+       if [ $? = 1 ]
        then
                exit 0
        fi
        then
                exit 0
        fi
@@ -84,58 +82,56 @@ else
        camera_selected=$(gphoto2 --auto-detect | tail +3)
 fi
 
        camera_selected=$(gphoto2 --auto-detect | tail +3)
 fi
 
-port_type=$(echo $camera_selected |awk -F ':' '{print $1}' | awk '{print $NF}')
-camera=$(echo $camera_selected | awk -F $port_type '{print $1}')
-port_address=$(echo $camera_selected | awk -F ':' '{print $2}')
+port_type=$(printf '%s\n' "$camera_selected" | awk -F ':' '{print $1}' | awk '{print $NF}')
+camera=$(printf '%s\n' "$camera_selected" | awk -F "$port_type" '{print $1}')
+port_address=$(printf '%s\n' "$camera_selected" | awk -F ':' '{print $2}')
 port="$port_type:$port_address"
 
 script_dir=$(dirname "$0")
 
 port="$port_type:$port_address"
 
 script_dir=$(dirname "$0")
 
-zenity --question --title="Geeqie camera import" --text="Camera: $camera\n\nDownloading to folder:\n<b>$PWD</b>" --ok-label="OK" --cancel-label="Cancel" --window-icon=/usr/local/share/pixmaps/geeqie.png --width=350 2>/dev/null
-
-if [[ $? == 1 ]]
+if ! zenity --question --title="Geeqie camera import" --text="Camera: $camera\n\nDownloading to folder:\n<b>$PWD</b>" --ok-label="OK" --cancel-label="Cancel" --window-icon=/usr/local/share/pixmaps/geeqie.png --width=350 2> /dev/null
 then
        exit 0
 fi
 
 then
        exit 0
 fi
 
-src_files_sorted=$(mktemp --tmpdir geeqie_camera_import_camera_files_sorted_XXXXXX)
-dest_files_sorted=$(mktemp --tmpdir geeqie_camera_import_computer_files_sorted_XXXXXX)
+src_files_sorted=$(mktemp -d "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
+dest_files_sorted=$(mktemp -d "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
 
 (
 
 (
-gphoto2 --port "$port" --list-files  2>/tmp/geeqie-camera-import.log | awk '/#/ {print $2}' | sort > $src_files_sorted
-) | zenity --progress --auto-close --auto-kill --title="Geeqie camera import" --text="Searching for files to download..."  --pulsate --window-icon=/usr/local/share/pixmaps/geeqie.png --width=250 
+       gphoto2 --port "$port" --list-files 2> /tmp/geeqie-camera-import.log | awk '/#/ {print $2}' | sort > "$src_files_sorted"
+) | zenity --progress --auto-close --auto-kill --title="Geeqie camera import" --text="Searching for files to download..." --pulsate --window-icon=/usr/local/share/pixmaps/geeqie.png --width=250
 
 error=$(grep -i error /tmp/geeqie-camera-import.log)
 
 
 error=$(grep -i error /tmp/geeqie-camera-import.log)
 
-if [ ! -z "$error" ]
+if [ -n "$error" ]
 then
 then
-       cat /tmp/geeqie-camera-import.log | zenity --text-info --title="Geeqie camera import" - --window-icon=error --width=250 2>/dev/null
+       zenity --text-info --title="Geeqie camera import" - --window-icon=error --width=250 < /tmp/geeqie-camera-import.log 2> /dev/null
        exit 1
 fi
 
        exit 1
 fi
 
-ls -1 | sort > $dest_files_sorted
-existing_file_count=$(comm -12 $src_files_sorted $dest_files_sorted | wc -l)
+find . -maxdepth 1 -type f | sort > "$dest_files_sorted"
+existing_file_count=$(comm -12 "$src_files_sorted" "$dest_files_sorted" | wc -l)
 
 
-repeated=$(uniq --repeated $src_files_sorted)
-if [ ! -z "$repeated" ]
+repeated=$(uniq --repeated "$src_files_sorted")
+if [ -n "$repeated" ]
 then
        repeated="Warning: The following source filenames are not unique.\nSome files may not be downloaded.\nSee the Help file.\n\n$repeated"
 then
        repeated="Warning: The following source filenames are not unique.\nSome files may not be downloaded.\nSee the Help file.\n\n$repeated"
-       zenity --question --text="$repeated" --title="Geeqie camera import" --cancel-label="OK" --ok-label="Cancel" --width=400 --window-icon=/usr/local/share/pixmaps/geeqie.png 2>/dev/null
-       if [[ $? == 0 ]]
+
+       if zenity --question --text="$repeated" --title="Geeqie camera import" --cancel-label="OK" --ok-label="Cancel" --width=400 --window-icon=/usr/local/share/pixmaps/geeqie.png 2> /dev/null
        then
                exit 1
        fi
 fi
 
        then
                exit 1
        fi
 fi
 
-total=$(cat $src_files_sorted | wc -l)
-files_to_load=$(( $total - $existing_file_count ))
+total=$(wc -l < "$src_files_sorted")
+files_to_load=$((total - existing_file_count))
 
 
-rm $src_files_sorted
-rm $dest_files_sorted
+rm "$src_files_sorted"
+rm "$dest_files_sorted"
 
 if [ "$files_to_load" -eq 0 ]
 then
 
 if [ "$files_to_load" -eq 0 ]
 then
-       zenity --info --title="Geeqie camera download" --text="No photos to download" --width=250 --window-icon=usr/local/share/pixmaps/geeqie.png 2>/dev/null
+       zenity --info --title="Geeqie camera download" --text="No photos to download" --width=250 --window-icon=usr/local/share/pixmaps/geeqie.png 2> /dev/null
        exit 0
 fi
 
        exit 0
 fi
 
@@ -145,29 +141,29 @@ then
 fi
 touch /tmp/geeqie-camera-import-files
 
 fi
 touch /tmp/geeqie-camera-import-files
 
-zen_pipe=$(mktemp --dry-run --tmpdir geeqie_camera_import_pipe_XXXXXX)
-mkfifo $zen_pipe
+zen_pipe=$(mktemp -u "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
+mkfifo "$zen_pipe"
 
 
-gphoto2 --port "$port" --hook-script "$script_dir/"geeqie-camera-import-hook-script --get-all-files --skip-existing 2>/tmp/geeqie-camera-import.log &
+gphoto2 --port "$port" --hook-script "$script_dir/"geeqie-camera-import-hook-script --get-all-files --skip-existing 2> /tmp/geeqie-camera-import.log &
 
 gphoto2_pid=$!
 
 
 gphoto2_pid=$!
 
-(tail -f $zen_pipe 2>/dev/null) | zenity --progress --title="Geeqie camera import" --width=370 --text="Downloading: total: $files_to_load existing: $existing_file_count\n" --auto-close --auto-kill --percentage=0 window-icon=/usr/local/share/pixmaps/geeqie.png 2>/dev/null &
+(tail -f "$zen_pipe" 2> /dev/null) | zenity --progress --title="Geeqie camera import" --width=370 --text="Downloading: total: $files_to_load existing: $existing_file_count\n" --auto-close --auto-kill --percentage=0 window-icon=/usr/local/share/pixmaps/geeqie.png 2> /dev/null &
 zen_pid=$!
 
 n=0
 zen_pid=$!
 
 n=0
-while [ -f /tmp/geeqie-camera-import-files ] &&  [ "$n" -lt 100 ]
+while [ -f /tmp/geeqie-camera-import-files ] && [ "$n" -lt 100 ]
 do
 do
-       i=$(cat "/tmp/geeqie-camera-import-files" | wc -l)
-       n=$(( $((i * 100)) / $files_to_load))
-       echo "$n" >$zen_pipe
+       i=$(wc -l < "/tmp/geeqie-camera-import-files")
+       n=$(($((i * 100)) / files_to_load))
+       printf '%s\n' "$n" > "$zen_pipe"
 
        latest_file=$(tail -n 1 /tmp/geeqie-camera-import-files)
        if [ -z "$latest_file" ]
        then
                latest_file="Skipping existing files, if any..."
        fi
 
        latest_file=$(tail -n 1 /tmp/geeqie-camera-import-files)
        if [ -z "$latest_file" ]
        then
                latest_file="Skipping existing files, if any..."
        fi
-       echo "#Downloading: total: $files_to_load existing: $existing_file_count\n$latest_file" >$zen_pipe
+       printf '#Downloading: total: %s existing: %s\n%s' "$files_to_load existing" "$existing_file_count" "$latest_file" > "$zen_pipe"
 
        sleep 1
 done
 
        sleep 1
 done
index 5ddb776..d89cbd9 100755 (executable)
@@ -1,14 +1,14 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 ## @brief Camera import hook script
 ##
 
 
 ## @file
 ## @brief Camera import hook script
 ##
 
-if [ "$ACTION" == "download" ]
+if [ "$ACTION" = "download" ]
 then
 then
-       echo "$ARGUMENT" >> /tmp/geeqie-camera-import-files
+       printf '%s\n' "$ARGUMENT" >> /tmp/geeqie-camera-import-files
 
 
-elif [ "$ACTION" == "stop" ]
+elif [ "$ACTION" = "stop" ]
 then
        zenity --info --title="Geeqie camera download" --text="Import ended" --width=200 --timeout=5 --window-icon=usr/local/share/pixmaps/geeqie.png 2>/dev/null 
        if [ -f /tmp/geeqie-camera-import-files ]
 then
        zenity --info --title="Geeqie camera download" --text="Import ended" --width=200 --timeout=5 --window-icon=usr/local/share/pixmaps/geeqie.png 2>/dev/null 
        if [ -f /tmp/geeqie-camera-import-files ]
index 3396592..088979a 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 ## @brief Extract embedded jpegs from a raw file
 
 ## @file
 ## @brief Extract embedded jpegs from a raw file
 ## - Set Geeqie focus to the newly generated image
 ##
 
 ## - Set Geeqie focus to the newly generated image
 ##
 
-count=$(exiv2 -pp "$1" | wc -l)
-
-if [[ $count -eq 0 ]]
-then
-       zenity --info --width=300 --height=100 --text="Export jpeg from raw file\n\nFile contains no embedded images" --title="Geeqie export jpeg" 2>/dev/null
-       exit
-fi
-
 if ! [ -x "$(command -v exiv2)" ]
 then
        zenity --info --width=300 --height=100 --text="Export jpeg from raw file\n\nexiv2 is not installed" --title="Geeqie export jpeg" 2>/dev/null
 if ! [ -x "$(command -v exiv2)" ]
 then
        zenity --info --width=300 --height=100 --text="Export jpeg from raw file\n\nexiv2 is not installed" --title="Geeqie export jpeg" 2>/dev/null
@@ -29,28 +21,36 @@ then
        zenity --info --width=300 --height=100 --text="Export jpeg from raw file\n\njpgicc is not installed\ncolor corrections will not be made\nYou may install via liblcms2-utils" --title="Geeqie export jpeg" 2>/dev/null
 fi
 
        zenity --info --width=300 --height=100 --text="Export jpeg from raw file\n\njpgicc is not installed\ncolor corrections will not be made\nYou may install via liblcms2-utils" --title="Geeqie export jpeg" 2>/dev/null
 fi
 
-list=$(exiv2 -pp "$1")
-readarray -t split_list <<<"$list"
+count=$(exiv2 -pp "$1" | wc -l)
+if [ "$count" -eq 0 ]
+then
+       zenity --info --width=300 --height=100 --text="Export jpeg from raw file\n\nFile contains no embedded images" --title="Geeqie export jpeg" 2>/dev/null
+       exit 1
+fi
+
+IFS='
+'
 
 
+list=$(exiv2 -pp "$1")
 image_list=""
 n=1
 
 image_list=""
 n=1
 
-for image in "${split_list[@]}"
+for image in $list
 do
 do
-       if [[ $n -eq $count ]]
+       if [ "$n" -eq "$count" ]
        then
        then
-               image_list="$image_list"$'TRUE\n'"$image"$'\n'"$n"
+               image_list="${image_list:+${image_list}}TRUE\n$image\n$n"
        else
        else
-               image_list="$image_list"$'FALSE\n'"$image"$'\n'"$n"$'\n'
+               image_list="${image_list:+${image_list}}FALSE\n$image\n$n\n"
        fi
        fi
-       n=$((n+1))
+       n=$((n + 1))
 done
 
 image_selected=$(echo "$image_list" | zenity  --width=500 --height=250 --title="Geeqie export jpeg" --list  --text "Select embedded image" --radiolist  --column "Select" --column "Image" --column "n" --hide-column=3 --print-column=3 2>/dev/null) 
 
 done
 
 image_selected=$(echo "$image_list" | zenity  --width=500 --height=250 --title="Geeqie export jpeg" --list  --text "Select embedded image" --radiolist  --column "Select" --column "Image" --column "n" --hide-column=3 --print-column=3 2>/dev/null) 
 
-if [[ ! -z "$image_selected" ]]
+if [ -n "$image_selected" ]
 then
 then
-       tmpdir=$(mktemp --tmpdir --directory geeqie_export_jpeg_XXXXXX)
+       tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
 
        exiv2 --location "$tmpdir" -ep"$image_selected" "$1"
 
 
        exiv2 --location "$tmpdir" -ep"$image_selected" "$1"
 
index 2f2a262..e1be292 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/awk -f
 #
 ## @file
 #!/usr/bin/awk -f
 #
 ## @file
-## @brief This file is used by the Search option "search on geo-position".
+## @brief Used by the Search option "search on geo-position".
 ##
 ## It is used to decode the results of internet or other searches
 ## to extract a geo-position from a text string.
 ##
 ## It is used to decode the results of internet or other searches
 ## to extract a geo-position from a text string.
old mode 100644 (file)
new mode 100755 (executable)
index feb08e9..0cc9dcb
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 ## @brief Crop image
 
 ## @file
 ## @brief Crop image
@@ -9,14 +9,13 @@
 
 process_raw ()
 {
 
 process_raw ()
 {
-       tmpdir=$(mktemp --tmpdir --directory geeqie_crop_image_XXXXXX)
+       tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
 
 
-       list=$(exiv2 -pp "$1")
-       if [[ ! -z "$list" ]]
-       then
-               readarray -t split_list <<<"$list"
+       array_length=$(exiv2 -pp "$1" | wc -l)
 
 
-               array_length="${#split_list[@]}" 
+       if [ "$array_length" -gt 0 ]
+       then
+               # Take last item - should be highest resolution
                exiv2 --location "$tmpdir" -ep"$array_length" "$1"
 
                src_filename=$(ls "$tmpdir/")
                exiv2 --location "$tmpdir" -ep"$array_length" "$1"
 
                src_filename=$(ls "$tmpdir/")
@@ -25,7 +24,7 @@ process_raw ()
                rotation=$(exiftool -Orientation -n "$1" | cut -d':' -f2 | xargs)
                convert "$tmpdir/$src_filename" -crop "$2" "$tmpdir/$filename-crop.$extension"
 
                rotation=$(exiftool -Orientation -n "$1" | cut -d':' -f2 | xargs)
                convert "$tmpdir/$src_filename" -crop "$2" "$tmpdir/$filename-crop.$extension"
 
-               exiftool -Orientation=$rotation -n "$tmpdir/$filename-crop.$extension"
+               exiftool -Orientation="$rotation" -n "$tmpdir/$filename-crop.$extension"
 
                rm "$tmpdir/$src_filename"
 
 
                rm "$tmpdir/$src_filename"
 
@@ -40,7 +39,7 @@ process_raw ()
 
 process_plain ()
 {
 
 process_plain ()
 {
-       tmpdir=$(mktemp --tmpdir --directory geeqie_crop_image_XXXXXX)
+       tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
 
        src_filename=$(basename -- "$1")
        filename="${src_filename%.*}"
 
        src_filename=$(basename -- "$1")
        filename="${src_filename%.*}"
@@ -67,45 +66,40 @@ then
 
                if [ -z "$coords" ]
                then
 
                if [ -z "$coords" ]
                then
-                       zenity --error --title="$title" --text="Rectangle coordinates have not been set" --width="$width" --window-icon="$window_icon" 2>/dev/null
+                       zenity --error --title="$title" --text="Rectangle coordinates have not been set" --width="$width" --window-icon="$window_icon" 2> /dev/null
                        exit 0
                fi
 
                filename=$(basename -- "$1")
                        exit 0
                fi
 
                filename=$(basename -- "$1")
-               extension="${filename##*.}"
-
-               if [ "${extension,,}" = "jpeg" ]
+               extension=$(printf '%b' "${filename##*.}" | tr '[:upper:]' '[:lower:]')
+               if [ "${extension}" = "jpeg" ]
                then
                then
-                       source_file="$1"
-                       process_plain "$1" $coords
-               elif [ "${extension,,}" = "jpg" ]
+                       process_plain "$1" "$coords"
+               elif [ "${extension}" = "jpg" ]
                then
                then
-                       source_file="$1"
-                       process_plain "$1" $coords
-               elif [ "${extension,,}" = "png" ]
+                       process_plain "$1" "$coords"
+               elif [ "${extension}" = "png" ]
                then
                then
-                       source_file="$1"
-                       process_plain "$1" $coords
-               elif [ "${extension,,}" = "tif" ]
+                       process_plain "$1" "$coords"
+               elif [ "${extension}" = "tif" ]
                then
                then
-                       source_file="$1"
-                       process_plain "$1" $coords
-               elif [ "${extension,,}" = "tiff" ]
+                       process_plain "$1" "$coords"
+               elif [ "${extension}" = "tiff" ]
                then
                then
-                       source_file="$1"
-                       process_plain "$1" $coords
+                       process_plain "$1" "$coords"
                else
                else
-                       process_raw "$1" $coords
+                       process_raw "$1" "$coords"
                        if [ $? = 1 ]
                        then
                        if [ $? = 1 ]
                        then
-                               process_plain "$1" $coords
+                               process_plain "$1" "$coords"
                        fi
                fi
        else
                        fi
                fi
        else
-               zenity --info --title="$title" --width="$width" --height=100 --text="Crop image\n\nexiftool is not installed" --title="$title" --window-icon="$window_icon" 2>/dev/null
+               zenity --info --title="$title" --width="$width" --height=100 --text="Crop image\n\nexiftool is not installed" --title="$title" --window-icon="$window_icon" 2> /dev/null
                exit 0
        fi
 else
                exit 0
        fi
 else
-       zenity --info --title="$title" --width="$width" --height=100 --text="Crop image\n\nImageMagick is not installed" --title="$title" --window-icon="$window_icon" 2>/dev/null
+       zenity --info --title="$title" --width="$width" --height=100 --text="Crop image\n\nImageMagick is not installed" --title="$title" --window-icon="$window_icon" 2> /dev/null
        exit 0
 fi
        exit 0
 fi
+
index ccfd311..8f221f2 100755 (executable)
@@ -1,59 +1,64 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 ## @brief Select and display a random image from a list of all images
 ## in Collections and the currently displayed folder
 ##
 
 
 ## @file
 ## @brief Select and display a random image from a list of all images
 ## in Collections and the currently displayed folder
 ##
 
+IFS='
+'
+
 # get list of images in all collections
 collection_list=$(geeqie --remote --get-collection-list)
 # get list of images in all collections
 collection_list=$(geeqie --remote --get-collection-list)
-OLDIFS=$IFS
-while IFS= read -r line
+
+for collection_name in $collection_list
 do
 do
-       collection=$(geeqie --remote --get-collection:"$line")
-       list="$list""$collection"$'\n'
-done <<< "$collection_list"
-IFS=$OLDIFS
+       collection_file_list=$(geeqie --remote --get-collection:"$collection_name")
+       for collection_file in $collection_file_list
+               do
+               list="${list:+${list}}\n${collection_file}"
+               done
+done
 
 # get list of images in current folder
 file_list=$(geeqie --remote --get-filelist:)
 
 # get list of images in current folder
 file_list=$(geeqie --remote --get-filelist:)
-OLDIFS=$IFS
-while IFS= read -r line
+
+for file_name in $file_list
 do
 do
-       class_whitespace="${line##*Class:}"
+       class_whitespace="${file_name##*Class:}"
        class="${class_whitespace#"${class_whitespace%%[![:space:]]*}"}"
 
        class="${class_whitespace#"${class_whitespace%%[![:space:]]*}"}"
 
-       if [ "$class" == "Image" ]
+       if [ "$class" = "Image" ]
        then
        then
-               list="$list""${line%%Class*}"$'\n'
+               list="$list${file_name%%Class*}\n"
        fi
 
        fi
 
-       if [ "$class" == "RAW Image" ]
+       if [ "$class" = "RAW Image" ]
        then
        then
-               list="$list""${line%%Class*}"$'\n'
+               list="$list""${file_name%%Class*}\n"
        fi
        fi
-done <<< "$file_list"
-IFS=$OLDIFS
+done
 
 # remove blank lines
 
 # remove blank lines
-files_no_blanks=$(echo "$list" | sed -e 's/^[[:blank:]]*$//')
+files_no_blanks=$(printf '%b\n' "$list" | sed -e 's/^[[:blank:]]*$//')
+
 # remove leading trailing whitespace
 # remove leading trailing whitespace
-files_no_spaces=$(echo "$files_no_blanks" | sed 's/^[ \t]*//;s/[ \t]*$//')
+files_no_spaces=$(printf '%b\n' "$files_no_blanks" | sed 's/^[ \t]*//;s/[ \t]*$//')
 
 # remove duplicate lines and select random line
 
 # remove duplicate lines and select random line
-display_image="$(echo "$files_no_spaces" | sort --uniq | shuf -n 1)"
+display_image=$( (printf '%b\n'  "$files_no_spaces")  | sort --uniq | shuf -n 1)
 
 # get image currently displayed
 current_image_collection=$(geeqie --remote --tell)
 # remove collection name, if it is there
 current_image_spaces="${current_image_collection%%Collection:*}"
 # remove leading trailing whitespace
 
 # get image currently displayed
 current_image_collection=$(geeqie --remote --tell)
 # remove collection name, if it is there
 current_image_spaces="${current_image_collection%%Collection:*}"
 # remove leading trailing whitespace
-curent_image=$(echo "$current_image_spaces" | sed 's/^[ \t]*//;s/[ \t]*$//')
+current_image=$(printf '%b\n' "$current_image_spaces" | sed 's/^[ \t]*//;s/[ \t]*$//')
 
 # if the selected random image is currently displayed, try again
 
 # if the selected random image is currently displayed, try again
-if [ "$current_image" == "$display_image" ]
+if [ "$current_image" = "$display_image" ]
 then
 then
-       display_image="$(echo "$files_no_spaces" | sort --uniq | shuf -n 1)"
+       display_image=$(printf '%b' "$files_no_spaces" | sort --uniq | shuf -n 1)
 fi
 
 geeqie --remote file:"$display_image"
 fi
 
 geeqie --remote file:"$display_image"
index fcca7ae..1a6f0da 100755 (executable)
@@ -82,7 +82,7 @@ rotate_image_file()
                ;;
 
        tif|tiff|png)
                ;;
 
        tif|tiff|png)
-               mogrify $2 "$3"
+               mogrify "$2" "$3"
                [ $? != 0 ]  && return 7
                return 0;
                ;;
                [ $? != 0 ]  && return 7
                return 0;
                ;;
@@ -153,7 +153,7 @@ for file in "$@" ; do
     if [ -n "$get_sidecars" ] ; then
         # we got only one file for each group, typically the main one
         # get the sidecars:
     if [ -n "$get_sidecars" ] ; then
         # we got only one file for each group, typically the main one
         # get the sidecars:
-        geeqie -r --get-sidecars:"$file" |while read sidecar ; do
+        geeqie -r --get-sidecars:"$file" |while read -r sidecar ; do
             # the main file is included in the sidecar file list, no special handling is required
                        [ ! -w "$sidecar" ] && exit 5
             rotate "$sidecar"
             # the main file is included in the sidecar file list, no special handling is required
                        [ ! -w "$sidecar" ] && exit 5
             rotate "$sidecar"
@@ -166,7 +166,7 @@ for file in "$@" ; do
                [ ! -w "$file" ] && exit 5
                if [ -n "$rotate_image_file" ] ; then
                        if [ -n "$preserve_mtime" ] ; then
                [ ! -w "$file" ] && exit 5
                if [ -n "$rotate_image_file" ] ; then
                        if [ -n "$preserve_mtime" ] ; then
-                               mtime=`mktemp /tmp/geeqie-rotate.XXXXXXXXXX` || exit 3
+                               mtime=`mktemp "${TMPDIR:-/tmp}/geeqie-rotate.XXXXXXXXXX"` || exit 3
                                touch --reference="$file" "$mtime"
                        fi
 
                                touch --reference="$file" "$mtime"
                        fi
 
index 9b2ea09..51504e1 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 ## @file
 #!/bin/sh
 
 ## @file
-## @brief This is a helper script that symlinks grouped files
+## @brief Symlink grouped files
 ##
 ## It uses geeqie remote connection to get details about grouped files
 ##
 ##
 ## It uses geeqie remote connection to get details about grouped files
 ##
index 4d04aff..380c6ff 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 ## @brief Simple tethered photography helper
 
 ## @file
 ## @brief Simple tethered photography helper
@@ -12,7 +12,7 @@
 ## gphoto2=filename=<see the manual>
 ##
 
 ## gphoto2=filename=<see the manual>
 ##
 
-n=$(ps -e | grep "geeqie-tethered" | wc -l)
+n=$(pgrep "geeqie-tethered" | wc -l)
 if [ "$n" -ge 3 ]
 then
        exit 0
 if [ "$n" -ge 3 ]
 then
        exit 0
@@ -24,7 +24,7 @@ then
        exit 0
 fi
 
        exit 0
 fi
 
-if [ $(gphoto2 --auto-detect | wc -l) -le 2 ]
+if [ "$(gphoto2 --auto-detect | wc -l)" -le 2 ]
 then
        zenity --error --title="Geeqie tethered photography" --text="No camera detected" --window-icon=/usr/local/share/pixmaps/geeqie.png --width=250 2>/dev/null
        exit 0
 then
        zenity --error --title="Geeqie tethered photography" --text="No camera detected" --window-icon=/usr/local/share/pixmaps/geeqie.png --width=250 2>/dev/null
        exit 0
@@ -34,18 +34,18 @@ notify-send --expire-time=2000 "$(gphoto2 --auto-detect | sed -n '3p')" --icon=g
 
 script_dir=$(dirname "$0")
 
 
 script_dir=$(dirname "$0")
 
-tmpfile=$(mktemp --tmpdir geeqie_tethered_photography_XXXXXX)
+tmpfile=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
 
 
-yes n | gphoto2 --hook-script "$script_dir/"geeqie-tethered-photography-hook-script --capture-tethered >$tmpfile &
+yes n | gphoto2 --hook-script "$script_dir/"geeqie-tethered-photography-hook-script --capture-tethered >"$tmpfile" &
 
 gphoto2_pid=$!
 
 zenity --question --title="Geeqie tethered photography" --ok-label="Stop" --cancel-label="Show log data" --text="Tethered photography is running.\n\n\nDownloading to folder:\n""$PWD\n\n\nExisting files will not be overwritten,\nbut the download will not take place.\n\n(Use gphoto2 --filename default option\nfor auto-rename on download)" --width=300 --window-icon=/usr/local/share/pixmaps/geeqie.png 2>/dev/null
 
 
 gphoto2_pid=$!
 
 zenity --question --title="Geeqie tethered photography" --ok-label="Stop" --cancel-label="Show log data" --text="Tethered photography is running.\n\n\nDownloading to folder:\n""$PWD\n\n\nExisting files will not be overwritten,\nbut the download will not take place.\n\n(Use gphoto2 --filename default option\nfor auto-rename on download)" --width=300 --window-icon=/usr/local/share/pixmaps/geeqie.png 2>/dev/null
 
-if [ $? == 1 ]
+if [ $? = 1 ]
 then
 then
-       zenity --text-info --title="Geeqie tethered photography" --window-icon=/usr/local/share/pixmaps/geeqie.png --ok-label="Stop" --cancel-label="Abort" <$tmpfile 2>/dev/null
+       zenity --text-info --title="Geeqie tethered photography" --window-icon=/usr/local/share/pixmaps/geeqie.png --ok-label="Stop" --cancel-label="Abort" <"$tmpfile" 2>/dev/null
 fi
 
 kill $gphoto2_pid
 fi
 
 kill $gphoto2_pid
-rm $tmpfile
+rm "$tmpfile"
index 0f8dc48..6b83e1c 100755 (executable)
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 ## @brief Tethered photography hook script
 ##
 
 
 ## @file
 ## @brief Tethered photography hook script
 ##
 
-if [ "$ACTION" == "download" ]
+if [ "$ACTION" = "download" ]
 then
        notify-send --expire-time=4000 "$ARGUMENT"  --icon=geeqie
        geeqie --remote File:"$PWD/$ARGUMENT"
 then
        notify-send --expire-time=4000 "$ARGUMENT"  --icon=geeqie
        geeqie --remote File:"$PWD/$ARGUMENT"
index e1c90d6..1888f49 100755 (executable)
@@ -1,14 +1,14 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 
 ## @file
-## @brief This script prints translations statistics for .po files
+## @brief Print translations statistics for .po files
 ## existing in the current directory
 ##
 
 export LC_ALL=C
 
 echo "Translations statistics"
 ## existing in the current directory
 ##
 
 export LC_ALL=C
 
 echo "Translations statistics"
-echo "Date: "$(date -R)
+echo "Date: $(date -R)"
 echo
 
 echo "Note: completion % in the chart below may not be quite correct"
 echo
 
 echo "Note: completion % in the chart below may not be quite correct"
@@ -19,7 +19,7 @@ echo
 
 (echo "Language  Comp(%) Trans Fuzzy Untrans Total"; \
 for i in *.po; do
 
 (echo "Language  Comp(%) Trans Fuzzy Untrans Total"; \
 for i in *.po; do
-       msgfmt --statistics -o /dev/null $i 2>&1 \
+       msgfmt --statistics -o /dev/null "$i" 2>&1 \
        | perl -ne '
                my ($tr_done, $tr_fuzz, $tr_un) = (0, 0, 0);
                $tr_done = $1 if /(\d+) translated messages?/;
        | perl -ne '
                my ($tr_done, $tr_fuzz, $tr_un) = (0, 0, 0);
                $tr_done = $1 if /(\d+) translated messages?/;
index 03c0e39..734c540 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 #/*
 # * Copyright (C) 2021 The Geeqie Team
 
 #/*
 # * Copyright (C) 2021 The Geeqie Team
 
 compile()
 {
 
 compile()
 {
-       # Cannot have --enable-debug-flags with --disable-gtk3
+       compiler="$1"
 
 
-       declare -A variant
-       variant[0]="$disable_list --disable-gtk3"
-       variant[1]="--disable-gtk3"
-       variant[2]="--enable-debug-flags $disable_list"
-       variant[3]="--enable-debug-flags"
-       variant[4]="$disable_list"
-       variant[5]=""
+       # Cannot have --enable-debug-flags with --disable-gtk3
+       set -- "$disable_list --disable-gtk3" "--disable-gtk3" "$disable_list --enable-debug-flags" "--enable-debug-flags" "$disable_list" ""
 
 
-       for ((i = 0; i <= 5; i++))
+       i=1
+       while [ $i -le 6 ]
        do
        do
-               if [[ "${variant[$i]}" =~ "gtk3" ]]; then
+               variant=""
+               eval variant="\$${i}"
+
+               if [ "$variant" != "${variant%gtk3*}" ]
+               then
                        gtk="GTK2"
                else
                        gtk="GTK3"
                fi
                        gtk="GTK2"
                else
                        gtk="GTK3"
                fi
-               if [[ "${variant[$i]}" =~ "disable-threads" ]]; then
+               if [ "$variant" != "${variant%disable-threads*}" ]
+               then
                        disabled="all disabled"
                else
                        disabled="none disabled"
                fi
                        disabled="all disabled"
                else
                        disabled="none disabled"
                fi
-               if [[ "${variant[$i]}" =~ "--enable-debug-flags" ]]; then
+               if [ "$variant" != "${variant%--enable-debug-flags*}" ]
+               then
                        debug_flags="enable-debug-flags"
                else
                        debug_flags=""
                fi
 
                        debug_flags="enable-debug-flags"
                else
                        debug_flags=""
                fi
 
-               echo -e " \e[32m $1 $gtk $debug_flags $disabled "
+               printf '\e[32m%s\n' "$compiler $gtk $debug_flags $disabled"
                sudo make maintainer-clean > /dev/null 2>&1
                sudo make maintainer-clean > /dev/null 2>&1
-               ./autogen.sh "${variant[$i]}" > /dev/null 2>&1
+               ./autogen.sh "$variant" > /dev/null 2>&1
                make -j > /dev/null
                make -j > /dev/null
+
+               i=$((i+1))
        done
 }
 
        done
 }
 
-disable_list=" "$(awk --field-separator '[][]' '/AC_HELP_STRING\(\[--disable-/ {if ($2 != "gtk3") print $2}' configure.ac | tr '\n' ' ')
+disable_list=" "$(awk -F '[][]' '/AC_HELP_STRING\(\[--disable-/ {if ($2 != "gtk3") print $2}' configure.ac | tr '\n' ' ')
 
 
-echo "Disabled list: :$disable_list"
+printf '%s\n' "Disabled list: :$disable_list"
 
 export CFLAGS="-Wno-deprecated-declarations"
 
 
 export CFLAGS="-Wno-deprecated-declarations"
 
index e1c3ec5..75b00ca 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 #**********************************************************************
 # Copyright (C) 2021 - The Geeqie Team
 
 #**********************************************************************
 # Copyright (C) 2021 - The Geeqie Team
 ## Then run 'doxygen doxygen.conf'
 ##
  
 ## Then run 'doxygen doxygen.conf'
 ##
  
-if [[ -z "${DOCDIR}" ]]
+if [ -z "${DOCDIR}" ]
 then
 then
-       echo "Environment variable DOCDIR not set"
+       printf '%s\n' "Environment variable DOCDIR not set"
        zenity --title="Geeqie" --width=200 --warning --text="Environment variable DOCDIR not set"
        zenity --title="Geeqie" --width=200 --warning --text="Environment variable DOCDIR not set"
-elif [[ -z "${PROJECT}" ]]
+elif [ -z "${PROJECT}" ]
 then
 then
-       echo "Environment variable PROJECT not set"
+       printf '%s\n' "Environment variable PROJECT not set"
        zenity --title="Geeqie" --width=200 --warning --text="Environment variable PROJECT not set"
 else
        url_found=$(awk  -v search_param="$1" -v docdir="$DOCDIR" '
        zenity --title="Geeqie" --width=200 --warning --text="Environment variable PROJECT not set"
 else
        url_found=$(awk  -v search_param="$1" -v docdir="$DOCDIR" '
@@ -96,7 +96,7 @@ else
                        }
                ' "$DOCDIR"/"$PROJECT".tag)
 
                        }
                ' "$DOCDIR"/"$PROJECT".tag)
 
-       if [[ -z $url_found ]]
+       if [ -z "$url_found" ]
        then
                exit 1
        else
        then
                exit 1
        else
index f5df698..e8ff83d 100755 (executable)
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
 #**********************************************************************
 # Copyright (C) 2021 - The Geeqie Team
 #
 #**********************************************************************
 # Copyright (C) 2021 - The Geeqie Team
 #
 #**********************************************************************
 
 ## @file
 #**********************************************************************
 
 ## @file
-## @brief This script will generate a Geeqie AppImage.
+## @brief Generate a Geeqie AppImage.
 ##
 ## It must be run from the base Geeqie folder.  
 ## The single parameter is the directory where the AppDir
 ## will be created.
 ##
 
 ##
 ## It must be run from the base Geeqie folder.  
 ## The single parameter is the directory where the AppDir
 ## will be created.
 ##
 
-if [[ ! -f geeqie.spec.in ]] || [[ ! -d .git ]]
+if [ ! -f geeqie.spec.in ] || [ ! -d .git ]
 then
 then
-       echo "This is not a Geeqie folder"
+       printf '%s\n' "This is not a Geeqie folder"
        exit 1
 fi
 
 if ! target_dir=$(realpath "$1");
 then
        exit 1
 fi
 
 if ! target_dir=$(realpath "$1");
 then
-       echo "No target dir specified"
+       printf '%s\n' "No target dir specified"
        exit 1
 fi
 
 rm -rf "$target_dir"/AppDir
        exit 1
 fi
 
 rm -rf "$target_dir"/AppDir
-mkdir "$target_dir"/AppDir || { echo "Cannot make $target_dir/AppDir"; exit 1; }
+mkdir "$target_dir"/AppDir || { printf '%s\n' "Cannot make $target_dir/AppDir"; exit 1; }
 
 sudo rm -rf doc/html
 
 
 sudo rm -rf doc/html
 
@@ -52,7 +52,7 @@ make install DESTDIR="$target_dir"/AppDir
 VERSION=$(git tag | tail -1)
 export VERSION
 
 VERSION=$(git tag | tail -1)
 export VERSION
 
-cd "$target_dir" || { echo "Cannot cd to $target_dir"; exit 1; }
+cd "$target_dir" || { printf '%s\n' "Cannot cd to $target_dir"; exit 1; }
 
 linuxdeploy-x86_64.AppImage \
        --appdir ./AppDir --output appimage \
 
 linuxdeploy-x86_64.AppImage \
        --appdir ./AppDir --output appimage \
index 26efeff..7794eb1 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 ## @brief Create the man page from the output of the "geeqie--help" command
 
 ## @file
 ## @brief Create the man page from the output of the "geeqie--help" command
@@ -9,24 +9,22 @@
 ## The programs help2man and doclifter are required - both are available as .deb packages.
 ##
 
 ## The programs help2man and doclifter are required - both are available as .deb packages.
 ##
 
-command -v help2man > /dev/null
-if [ $? -eq 1 ]
+if ! command -v help2man > /dev/null
 then
 then
-       echo "help2man not installed"
-       exit
+       printf '%s\n' "help2man not installed"
+       exit 1
 fi
 
 fi
 
-command -v doclifter > /dev/null
-if [ $? -eq 1 ]
+if ! command -v doclifter > /dev/null
 then
 then
-       echo "doclifter not installed"
-       exit
+       printf '%s\n' "doclifter not installed"
+       exit 1
 fi
 
 fi
 
-options_file=$(mktemp)
+options_file=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
 year=$(date +"%Y")
 
 year=$(date +"%Y")
 
-echo "[NAME]
+printf '%s\n' "[NAME]
 Geeqie - GTK based multiformat image viewer
 
 [DESCRIPTION]
 Geeqie - GTK based multiformat image viewer
 
 [DESCRIPTION]
@@ -46,7 +44,6 @@ Copyright (C) 1999-2004 by John Ellis. Copyright (C) 2004-$year by The Geeqie Te
 own  risk! This  software released under the GNU General Public License. Please read the COPYING file for more
 information." > "$options_file"
 
 own  risk! This  software released under the GNU General Public License. Please read the COPYING file for more
 information." > "$options_file"
 
-
 help2man --no-info --include="$options_file" src/geeqie > geeqie.1
 
 doclifter geeqie.1
 help2man --no-info --include="$options_file" src/geeqie > geeqie.1
 
 doclifter geeqie.1
index 7df2125..c533331 100755 (executable)
@@ -1,8 +1,7 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 
 ## @file
-## @brief This is a simple script to merge the keyword tree of one Geeqie
-## configuration file into another.  
+## @brief Merge the keyword tree of one Geeqie configuration file into another.  
 ##
 ## The keyword trees are simply concatenated. When Geeqie loads
 ## the resulting configuration file, any duplicates are discarded.
 ##
 ## The keyword trees are simply concatenated. When Geeqie loads
 ## the resulting configuration file, any duplicates are discarded.
@@ -15,18 +14,18 @@ merge_file()
 flag=0
 while read -r line_merge
 do
 flag=0
 while read -r line_merge
 do
-       if [[ flag -eq 0 ]]
+       if [ $flag -eq 0 ]
        then
        then
-               if [[ $line_merge =~ "<keyword_tree>" ]]
+               if [ "$line_merge" != "${line_merge%<keyword_tree>*}" ]
                then
                        flag=1
                fi
        else
                then
                        flag=1
                fi
        else
-               if [[ $line_merge =~ "</keyword_tree>" ]]
+               if [ "$line_merge" != "${line_merge%<keyword_tree>*}" ]
                then
                        flag=0
                else
                then
                        flag=0
                else
-                       echo "$line_merge" >> "$2"
+                       printf '%s\n' "$line_merge" >> "$2"
                fi
        fi
 done < "$1"
                fi
        fi
 done < "$1"
@@ -34,51 +33,51 @@ done < "$1"
 
 np=$#
 
 
 np=$#
 
-zenity --info --text="This script will merge the keywords from one Geeqie\nconfiguration file into another.\n\n\The command format is:\nmerge.sh {config. file to merge into} {config. file to merge from}\n\nIf you do not supply parameters, you are prompted.\n\nYou are given the option to backup the main config. file before it is overwritten with the merged data.\n\nEnsure that Geeqie is not running." --title="Geeqie merge keywords" --width=400 --height=200
-if [[ $? -eq 1 ]]
+zenity --info --text="This script will merge the keywords from one Geeqie\nconfiguration file into another.\n\n\The command format is:\nkeyword_merge.sh {config. file to merge into} {config. file to merge from}\n\nIf you do not supply parameters, you are prompted.\n\nYou are given the option to backup the main config. file before it is overwritten with the merged data.\n\nEnsure that Geeqie is not running." --title="Geeqie merge keywords" --width=400 --height=200
+if [ $? -eq 1 ]
 then
        exit
 fi
 
 
 then
        exit
 fi
 
 
-if [[ $np -ge 3 ]]
+if [ $np -ge 3 ]
 then
        zenity --error --text "Too many parameters"
        exit
 then
        zenity --error --text "Too many parameters"
        exit
-elif [[ $np -eq 0 ]]
+elif [ $np -eq 0 ]
 then
        config_main=$(zenity --file-selection --file-filter="geeqierc.xml" --file-filter="*.xml" --file-filter="*" --title="Select main configuration file")
 then
        config_main=$(zenity --file-selection --file-filter="geeqierc.xml" --file-filter="*.xml" --file-filter="*" --title="Select main configuration file")
-       if [[ $? -eq 1 ]]
+       if [ $? -eq 1 ]
        then
                exit
        fi
        config_merge=$(zenity --file-selection --file-filter="geeqierc.xml" --file-filter="*.xml" --file-filter="*"-- title="Select configuration file to merge from")
        then
                exit
        fi
        config_merge=$(zenity --file-selection --file-filter="geeqierc.xml" --file-filter="*.xml" --file-filter="*"-- title="Select configuration file to merge from")
-       if [[ $? -eq 1 ]]
+       if [ $? -eq 1 ]
        then
                exit
        fi
        then
                exit
        fi
-elif [[ $np -eq 1 ]]
+elif [ $np -eq 1 ]
 then
        config_merge=$(zenity --file-selection --file-filter="geeqierc.xml" --file-filter="*.xml" --file-filter="*" --title="Select configuration file to merge from")
 then
        config_merge=$(zenity --file-selection --file-filter="geeqierc.xml" --file-filter="*.xml" --file-filter="*" --title="Select configuration file to merge from")
-       if [[ $? -eq 1 ]]
+       if [ $? -eq 1 ]
        then
                exit
        fi
 fi
 
        then
                exit
        fi
 fi
 
-tmp_file=$(mktemp)
+tmp_file=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
 
 while read -r line_main
 do
 
 while read -r line_main
 do
-       if [[ $line_main =~ "</keyword_tree>" ]]
+       if [ "$line_main" != "${line_merge%<keyword_tree>*}" ]
        then
                merge_file "$config_merge" "$tmp_file"
        fi
        then
                merge_file "$config_merge" "$tmp_file"
        fi
-       echo "$line_main" >> "$tmp_file"
+       printf '%s\n' "$line_main" >> "$tmp_file"
 done < "$config_main"
 
 done < "$config_main"
 
-zenity --question --text="Backup configuration file before overwriting?"
-if [[ $? -eq 0 ]]
+
+if zenity --question --text="Backup configuration file before overwriting?"
 then
        cp "$config_main" "$config_main.$(date +%Y%m%d%H%M%S)"
 fi
 then
        cp "$config_main" "$config_main.$(date +%Y%m%d%H%M%S)"
 fi
index 5f68843..1df9cf5 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 ## @brief Create a new release
 
 ## @file
 ## @brief Create a new release
@@ -19,7 +19,7 @@
 
 if [ ! -d .git ]
 then
 
 if [ ! -d .git ]
 then
-       echo "Directory .git does not exist"
+       printf '%s\n' "Directory .git does not exist"
        exit 1
 fi
 
        exit 1
 fi
 
@@ -35,7 +35,7 @@ push=
 while getopts "v:s:p:hr" option; do
        case $option in
        h)
 while getopts "v:s:p:hr" option; do
        case $option in
        h)
-               echo -e "-v <a.b> release major.minor e.g 1.9\n-s <c> start hash e.g. 728172681 (optional)\n-p <d> release patch version e.g. 2 for 1.6.2\n-r push to repo.\n-h help"
+               printf '%s\n%s\n%s\n%s\n%s\n' "-v <a.b> release major.minor e.g 1.9" "-s <c> start hash e.g. 728172681 (optional)" "-p <d> release patch version e.g. 2 for 1.6.2" "-r push to repo." "-h help"
                exit 0
                ;;
        v) version="$OPTARG" ;;
                exit 0
                ;;
        v) version="$OPTARG" ;;
@@ -48,13 +48,13 @@ done
 
 if [ "$start" ] && [ "$patch" ]
 then
 
 if [ "$start" ] && [ "$patch" ]
 then
-       echo "Cannot have start-hash and patch number together"
+       printf '%s\n' "Cannot have start-hash and patch number together"
        exit 1
 fi
 
        exit 1
 fi
 
-if [ "$(echo "$version" | awk -F"." '{print NF-1}')" -ne 1 ]
+if [ "$(printf '%s\n' "$version" | awk -F"." '{print NF-1}')" -ne 1 ]
 then
 then
-       echo "Version major.minor $version is not valid"
+       printf '%s\n' "Version major.minor $version is not valid"
        exit 1
 fi
 
        exit 1
 fi
 
@@ -62,7 +62,7 @@ if [ "$start" ]
 then
        if ! git branch master --contains "$start" > /dev/null 2>&1
        then
 then
        if ! git branch master --contains "$start" > /dev/null 2>&1
        then
-               echo "Start hash is not in master branch"
+               printf '%s\n' "Start hash is not in master branch"
                exit 1
        fi
 fi
                exit 1
        fi
 fi
@@ -71,19 +71,19 @@ if [ "$patch" ]
 then
        if ! git rev-parse "v$version" > /dev/null 2>&1
        then
 then
        if ! git rev-parse "v$version" > /dev/null 2>&1
        then
-               echo "Version $version does not exist"
+               printf '%s\n' "Version $version does not exist"
                exit 1
        fi
 
                exit 1
        fi
 
-       if [[ ! $patch =~ ^-?[0-9]+$ ]]
+       if ! [ "$patch" -ge 0 ] 2>/dev/null
        then
        then
-               echo "Patch $patch is not an integer"
+               printf '%s\n' "Patch $patch is not an integer"
                exit 1
        fi
 else
        if git rev-parse "v$version" > /dev/null 2>&1
        then
                exit 1
        fi
 else
        if git rev-parse "v$version" > /dev/null 2>&1
        then
-               echo "Version $version already exists"
+               printf '%s\n' "Version $version already exists"
                exit 1
        fi
 fi
                exit 1
        fi
 fi
index 25940f2..273cef8 100755 (executable)
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/bin/sh
 
 
 ## @file
 
 
 ## @file
@@ -7,7 +7,7 @@
 ## This needs to be run only when the menus have changed.
 ##
 
 ## This needs to be run only when the menus have changed.
 ##
 
-tmp_file=$(mktemp)
+tmp_file=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
 path=$(dirname "$(realpath "$0")")
 srcpath=$(dirname "$path")/src/layout_util.c
 templatepath=$(dirname "$path")/plugins/template.desktop.in
 path=$(dirname "$(realpath "$0")")
 srcpath=$(dirname "$path")/src/layout_util.c
 templatepath=$(dirname "$path")/plugins/template.desktop.in
@@ -78,12 +78,10 @@ function get_menus()
 (template_flag == 0) {print}
 '  "$templatepath" > "$tmp_file"
 
 (template_flag == 0) {print}
 '  "$templatepath" > "$tmp_file"
 
-cat $tmp_file
-echo $PWD
+cat "$tmp_file"
+printf '%s\n' "$PWD"
 
 
-diff --unified=0 "./plugins/template.desktop.in" "$tmp_file" | zenity --title="Plugin template update" --text-info --width=700 --height=400
-
-if [ "$?" == 0 ]
+if diff --unified=0 "./plugins/template.desktop.in" "$tmp_file" | zenity --title="Plugin template update" --text-info --width=700 --height=400
 then
        mv "$tmp_file" "$templatepath"
 else
 then
        mv "$tmp_file" "$templatepath"
 else
index cb13cfc..3738818 100755 (executable)
@@ -1,7 +1,7 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 
 ## @file
-## @brief A simple script to locate strings not marked for translation
+## @brief Locate strings not marked for translation
 ##
 ## Checks all .c files under ./src
 ##
 ##
 ## Checks all .c files under ./src
 ##
@@ -13,6 +13,6 @@ for file in src/*.c src/view_file/*.c
 do
        for search_text in "label" "menu_item_add" "tooltip" "_button" "_text"
        do
 do
        for search_text in "label" "menu_item_add" "tooltip" "_button" "_text"
        do
-               cat -n "$file" | grep --extended-regexp --ignore-case "$search_text.*\(\"" | grep --invert-match "_(" | grep --invert-match "(\"\")" && echo -e "$file \n"
+               cat -n "$file" | grep --extended-regexp --ignore-case "$search_text.*\(\"" | grep --invert-match "_(" | grep --invert-match "(\"\")" && printf '%s\n\n' "$file"
        done
 done
        done
 done
index 4a9fb1e..0029232 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 ## @brief Update the Geeqie webpage Help files
 
 ## @file
 ## @brief Update the Geeqie webpage Help files
 
 if [ ! -d ".git" ] || [ ! -d "src" ] || [ ! -f "geeqie.1" ]
 then
 
 if [ ! -d ".git" ] || [ ! -d "src" ] || [ ! -f "geeqie.1" ]
 then
-       echo "This is not a Geeqie project folder"
+       printf '%s\n' "This is not a Geeqie project folder"
        exit 1
 fi
 
 if [ ! -d "../geeqie.github.io/.git" ] || [ ! -d "../geeqie.github.io/help" ]
 then
        exit 1
 fi
 
 if [ ! -d "../geeqie.github.io/.git" ] || [ ! -d "../geeqie.github.io/help" ]
 then
-       echo "The Geeqie webpage project folder geeqie.github.io was not found"
+       printf '%s\n' "The Geeqie webpage project folder geeqie.github.io was not found"
        exit 1
 fi
 
 rm -rf doc/html
        exit 1
 fi
 
 rm -rf doc/html
-tmpdir=$(mktemp --tmpdir --directory)
+tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
 
 make -j install DESTDIR="$tmpdir"
 rm -r "$tmpdir"
 
 make -j install DESTDIR="$tmpdir"
 rm -r "$tmpdir"
index fb52741..2fe3fde 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 ## @file
 ## @brief Generate the Geeqie version number
 
 ## @file
 ## @brief Generate the Geeqie version number
@@ -22,27 +22,27 @@ if [ -d .git ]
 then
        branch=$(git rev-parse --abbrev-ref HEAD)
 
 then
        branch=$(git rev-parse --abbrev-ref HEAD)
 
-       if [ "$branch" == "master" ]
+       if [ "$branch" = "master" ]
        then
        then
-               IFS=$'.'
-# shellcheck disable=SC2046
+               IFS='.'
+               # shellcheck disable=SC2046
                set -- $(git tag --list v[1-9]* | tail -n 1 | tr -d 'v')
 
                major_version=$1
                minor_version=$2
 #              patch_version=$3  # not used on master branch
 
                set -- $(git tag --list v[1-9]* | tail -n 1 | tr -d 'v')
 
                major_version=$1
                minor_version=$2
 #              patch_version=$3  # not used on master branch
 
-               echo "$major_version" && echo "." && echo "$minor_version" && echo "+git" && git log --max-count=1 --date=format:"%Y%m%d" --format="%ad" && echo "-" && git rev-parse --quiet --verify --short HEAD
+               printf '%s' "$major_version" && printf '%s' "." && printf '%s' "$minor_version" && printf '%s' "+git" && git log --max-count=1 --date=format:"%Y%m%d" --format="%ad" && printf '%s' "-" && git rev-parse --quiet --verify --short HEAD
        else
                version=$(head -1 NEWS)
        else
                version=$(head -1 NEWS)
-# shellcheck disable=SC2086
+               # shellcheck disable=SC2086
                set -- $version
                set -- $version
-               echo "$2"
+               printf '%s' "$2"
        fi
 else
        version=$(head -1 NEWS)
        fi
 else
        version=$(head -1 NEWS)
-# shellcheck disable=SC2086
+       # shellcheck disable=SC2086
        set -- $version
        set -- $version
-       echo "$2"
+       printf '%s' "$2"
 fi
 
 fi