Run using:
for file in $(find . -not \( -path ./subprojects -prune \) -name "*.sh")
do
realfile=$(realpath "$file")
shellcheck --norc --format=diff --shell sh
--enable=add-default-case,avoid-nullary-conditions,check-unassigned-uppercase,deprecate-which,quote-safe-variables
"$realfile"| patch "$realfile"
done
exit
Plus manual edits.
13 files changed:
then
DIST="${DIST}[$(tr "\n" ' ' < /etc/UnitedLinux-release | sed s/VERSION.*//)]"
fi
then
DIST="${DIST}[$(tr "\n" ' ' < /etc/UnitedLinux-release | sed s/VERSION.*//)]"
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
then
printf '%b\n' "Essential libraries:"
for file in $essential_array
then
printf '%b\n' "Essential libraries:"
for file in $essential_array
exit 1
fi" > "$install_pass_script"
chmod +x "$install_pass_script"
exit 1
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" ]
then
uninstall
if [ "$gtk_version" = "Uninstall" ]
then
uninstall
fi
# Put the install log in tmp, to avoid writing to PWD during a new install
fi
# Put the install log in tmp, to avoid writing to PWD during a new install
-kill $zen_pid 2> /dev/null
+kill "$zen_pid" 2> /dev/null
# Ask the user which options to install
if [ -n "$option_string" ]
# Ask the user which options to install
if [ -n "$option_string" ]
printf '%b\n' "20" > "$zen_pipe"
printf '%b\n' "#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
cd geeqie || exit 1
else
then
cd geeqie || exit 1
else
printf '%b\n' "30" > "$zen_pipe"
printf '%b\n' "#Checkout required version..." > "$zen_pipe"
printf '%b\n' "30" > "$zen_pipe"
printf '%b\n' "#Checkout required version..." > "$zen_pipe"
then
if ! git checkout master~"$BACK" >> "$install_log" 2>&1
then
then
if ! git checkout master~"$BACK" >> "$install_log" 2>&1
then
zenity --title="$title" --width=370 --height=400 --error --text="Git error:\n\n$git_error" 2> /dev/null
exit_install
fi
zenity --title="$title" --width=370 --height=400 --error --text="Git error:\n\n$git_error" 2> /dev/null
exit_install
fi
then
if ! git checkout "$COMMIT" >> "$install_log" 2>&1
then
if ! git checkout "$COMMIT" >> "$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
zenity --title="$title" --width=370 --height=400 --error --text="Git error:\n\n$git_error" 2> /dev/null
exit_install
fi
then
if ! git checkout "$TAG" >> "$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
then
if ! git checkout "$TAG" >> "$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
[ ! -e "ChangeLog.gqview" ] && exit 1
[ ! -x "$(command -v git)" ] && exit 1
[ ! -e "ChangeLog.gqview" ] && exit 1
[ ! -x "$(command -v git)" ] && exit 1
# Meson: distribute in tarballs. The first variable is more reliable, but requires Meson 0.58.
# Fallback to the older one if necessary
# Meson: distribute in tarballs. The first variable is more reliable, but requires Meson 0.58.
# Fallback to the older one if necessary
+# shellcheck disable=SC2154
for distdir in "$MESON_PROJECT_DIST_ROOT" "$MESON_DIST_ROOT"; do
if [ -n "$distdir" ]; then
cp -f "$builddir/ChangeLog.html" "$distdir/ChangeLog.html"
for distdir in "$MESON_PROJECT_DIST_ROOT" "$MESON_DIST_ROOT"; do
if [ -n "$distdir" ]; then
cp -f "$builddir/ChangeLog.html" "$distdir/ChangeLog.html"
## @brief Camera import hook script
##
## @brief Camera import hook script
##
+# shellcheck disable=2154
if [ "$ACTION" = "download" ]
then
printf '%s\n' "$ARGUMENT" >> /tmp/geeqie-camera-import-files
if [ "$ACTION" = "download" ]
then
printf '%s\n' "$ARGUMENT" >> /tmp/geeqie-camera-import-files
- ext=`echo "${1##*.}" |tr "[:upper:]" "[:lower:]"`
- [ "x$ext" = "x" ] && return 1 #no extension
+ ext=$(echo "${1##*.}" |tr "[:upper:]" "[:lower:]")
+ [ "$ext" = "" ] && return 1 #no extension
gq_metadata="$GQ_METADATA_DIR/$1.gq.xmp"
if [ -f "$gq_metadata" ] ; then
gq_metadata="$GQ_METADATA_DIR/$1.gq.xmp"
if [ -f "$gq_metadata" ] ; then
- gq_orientation=`exiv2 -PXkv "$gq_metadata"|grep Xmp.tiff.Orientation|sed -e "s|Xmp.tiff.Orientation *||"`
+ gq_orientation=$(exiv2 -PXkv "$gq_metadata"|grep Xmp.tiff.Orientation|sed -e "s|Xmp.tiff.Orientation *||")
+# shellcheck disable=2181
[ $? != 0 ] && exit 1
else
gq_orientation=
[ $? != 0 ] && exit 1
else
gq_orientation=
jpg|jpeg)
if [ -n "$gq_orientation" ] ; then
exiv2 -M "set Exif.Image.Orientation $gq_orientation" "$1"
jpg|jpeg)
if [ -n "$gq_orientation" ] ; then
exiv2 -M "set Exif.Image.Orientation $gq_orientation" "$1"
+# shellcheck disable=2181
[ $? != 0 ] && exit 1
fi
if exiftran -aip "$1" ; then
# exiftran ignores xmp, set it manually
exiv2 -M "set Xmp.tiff.Orientation 1" "$1"
[ $? != 0 ] && exit 1
fi
if exiftran -aip "$1" ; then
# exiftran ignores xmp, set it manually
exiv2 -M "set Xmp.tiff.Orientation 1" "$1"
+# shellcheck disable=2181
[ $? != 0 ] && exit 1
#http://dev.exiv2.org/issues/639
if [ -n "$gq_orientation" ] ; then
exiv2 -M "set Xmp.tiff.Orientation 1" \
-M "set Exif.Image.Orientation 1" "$gq_metadata"
[ $? != 0 ] && exit 1
#http://dev.exiv2.org/issues/639
if [ -n "$gq_orientation" ] ; then
exiv2 -M "set Xmp.tiff.Orientation 1" \
-M "set Exif.Image.Orientation 1" "$gq_metadata"
+# shellcheck disable=2181
[ $? != 0 ] && exit 1
fi
return 0
[ $? != 0 ] && exit 1
fi
return 0
tif|tiff|png)
if [ -n "$gq_orientation" ] ; then
exiv2 -M "set Exif.Image.Orientation $gq_orientation" "$1"
tif|tiff|png)
if [ -n "$gq_orientation" ] ; then
exiv2 -M "set Exif.Image.Orientation $gq_orientation" "$1"
+# shellcheck disable=2181
[ $? != 0 ] && exit 1
fi
if mogrify -auto-orient "$1" ; then
# mogrify ignores xmp, set it manually
exiv2 -M "set Xmp.tiff.Orientation 1" "$1"
[ $? != 0 ] && exit 1
fi
if mogrify -auto-orient "$1" ; then
# mogrify ignores xmp, set it manually
exiv2 -M "set Xmp.tiff.Orientation 1" "$1"
+# shellcheck disable=2181
[ $? != 0 ] && exit 1
#http://dev.exiv2.org/issues/639
if [ -n "$gq_orientation" ] ; then
exiv2 -M "set Xmp.tiff.Orientation 1" \
-M "set Exif.Image.Orientation 1" "$gq_metadata"
[ $? != 0 ] && exit 1
#http://dev.exiv2.org/issues/639
if [ -n "$gq_orientation" ] ; then
exiv2 -M "set Xmp.tiff.Orientation 1" \
-M "set Exif.Image.Orientation 1" "$gq_metadata"
+# shellcheck disable=2181
[ $? != 0 ] && exit 1
fi
return 0
[ $? != 0 ] && exit 1
fi
return 0
- ext=`echo "${3##*.}" |tr "[:upper:]" "[:lower:]"`
- [ "x$ext" = "x" ] && return 1 #no extension
+ ext=$(echo "${3##*.}" |tr "[:upper:]" "[:lower:]")
+ [ "$ext" = "" ] && return 1 #no extension
case "$ext" in
jpg|jpeg)
exiftran -i "$1" "$3"
case "$ext" in
jpg|jpeg)
exiftran -i "$1" "$3"
+# shellcheck disable=2181
[ $? != 0 ] && return 6
return 0;
;;
tif|tiff|png)
mogrify "$2" "$3"
[ $? != 0 ] && return 6
return 0;
;;
tif|tiff|png)
mogrify "$2" "$3"
+# shellcheck disable=2181
[ $? != 0 ] && return 7
return 0;
;;
[ $? != 0 ] && return 7
return 0;
;;
-if [ "x$1" = "x-g" ] ; then
+if [ "$1" = "-g" ] ; then
get_sidecars=yes
shift
fi
rotate_image_file=
rotation=
get_sidecars=yes
shift
fi
rotate_image_file=
rotation=
-if [ "x$1" = "x-r" ] ; then
+if [ "$1" = "-r" ] ; then
rotate_image_file=yes
shift
rotation="$1"
rotate_image_file=yes
shift
rotation="$1"
-if [ "x$1" = "x-t" ] ; then
+if [ "$1" = "-t" ] ; then
preserve_mtime=yes
shift
fi
if [ -n "$rotation" ] ; then
preserve_mtime=yes
shift
fi
if [ -n "$rotation" ] ; then
- if [ "x$rotation" = "x0" ] ; then
+ if [ "$rotation" = "0" ] ; then
- if [ "x$rotation" = "x2" ] ; then
+ if [ "$rotation" = "2" ] ; then
mogrify_param="-flop"
exiftran_param="-F"
fi
mogrify_param="-flop"
exiftran_param="-F"
fi
- if [ "x$rotation" = "x3" ] ; then
+ if [ "$rotation" = "3" ] ; then
mogrify_param="-rotate 180"
exiftran_param="-1"
fi
mogrify_param="-rotate 180"
exiftran_param="-1"
fi
- if [ "x$rotation" = "x4" ] ; then
+ if [ "$rotation" = "4" ] ; then
mogrify_param="-flip"
exiftran_param="-f"
fi
mogrify_param="-flip"
exiftran_param="-f"
fi
- if [ "x$rotation" = "x5" ] ; then
+ if [ "$rotation" = "5" ] ; then
mogrify_param="-transpose"
exiftran_param="-t"
fi
mogrify_param="-transpose"
exiftran_param="-t"
fi
- if [ "x$rotation" = "x6" ] ; then
+ if [ "$rotation" = "6" ] ; then
mogrify_param="-rotate 90"
exiftran_param="-9"
fi
mogrify_param="-rotate 90"
exiftran_param="-9"
fi
- if [ "x$rotation" = "x7" ] ; then
+ if [ "$rotation" = "7" ] ; then
mogrify_param="-transverse"
exiftran_param="-T"
fi
mogrify_param="-transverse"
exiftran_param="-T"
fi
- if [ "x$rotation" = "x8" ] ; then
+ if [ "$rotation" = "8" ] ; then
mogrify_param="-rotate -90"
exiftran_param="-2"
fi
mogrify_param="-rotate -90"
exiftran_param="-2"
fi
done
# Bourne shell runs DO loops in a sub-shell
ret=$?
done
# Bourne shell runs DO loops in a sub-shell
ret=$?
- [ $ret != 0 ] && exit $ret
+ [ "$ret" != 0 ] && exit "$ret"
else
[ ! -w "$file" ] && exit 5
if [ -n "$rotate_image_file" ] ; then
if [ -n "$preserve_mtime" ] ; then
else
[ ! -w "$file" ] && exit 5
if [ -n "$rotate_image_file" ] ; then
if [ -n "$preserve_mtime" ] ; then
- mtime=`mktemp "${TMPDIR:-/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
touch --reference="$mtime" "$file"
rm "$mtime"
fi
touch --reference="$mtime" "$file"
rm "$mtime"
fi
- [ $ret != 0 ] && exit $ret
+ [ "$ret" != 0 ] && exit "$ret"
else
rotate "$file"
ret=$?
else
rotate "$file"
ret=$?
- [ $ret != 0 ] && exit $ret
+ [ "$ret" != 0 ] && exit "$ret"
for file in "$@" ; do
# we got only one file for each group, typically the main one
# get the sidecars:
for file in "$@" ; do
# 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
# get destination path for each sidecar file:
# the main file is included in the sidecar file list, no special handling is required
# get destination path for each sidecar file:
- geeqie -r --get-destination:"$sidecar" | if read destination ; then
+ geeqie -r --get-destination:"$sidecar" | if read -r destination ; then
ln -s "$sidecar" "$destination"
fi
done
ln -s "$sidecar" "$destination"
fi
done
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
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
## @brief Tethered photography hook script
##
## @brief Tethered photography hook script
##
+# shellcheck disable=SC2154
if [ "$ACTION" = "download" ]
then
notify-send --expire-time=4000 "$ARGUMENT" --icon=geeqie
if [ "$ACTION" = "download" ]
then
notify-send --expire-time=4000 "$ARGUMENT" --icon=geeqie
# TODO(xsdg): Re-write this in a simpler way and test that it works: (cd ..; find ... | sort > $TMP)
TMP=POTFILES.$$
# TODO(xsdg): Re-write this in a simpler way and test that it works: (cd ..; find ... | sort > $TMP)
TMP=POTFILES.$$
-((find ../src/ -type f \( -name '*.c' -o -name '*.cc' \) ; find ../ -type f -name '*.desktop.in' ; find ../ -type f -name '*.appdata.xml.in') | while read f; do
- (echo $f | sed 's#^../##')
-done) | sort > $TMP
-diff -u POTFILES $TMP
-rm -f $TMP
+( (find ../src/ -type f \( -name '*.c' -o -name '*.cc' \) ; find ../ -type f -name '*.desktop.in' ; find ../ -type f -name '*.appdata.xml.in') | while read -r f; do
+ (echo "$f" | sed 's#^../##')
+done) | sort > "$TMP"
+diff -u POTFILES "$TMP"
+rm -f "$TMP"
rm -rf /tmp/linuxdeploy-*
rm -rf /tmp/linuxdeploy-*
if [ ! -d bin ]
then
mkdir bin
fi
if [ ! -d bin ]
then
mkdir bin
fi
if [ ! -f appimagetool-aarch64.AppImage ]
then
if [ ! -f appimagetool-aarch64.AppImage ]
then
mv linuxdeploy linuxdeploy-download
fi
mv linuxdeploy linuxdeploy-download
fi
+cd linuxdeploy-download || exit
# Use arm architecture
sed -i 's/"x86_64"/"aarch64"/g' ./ci/build.sh
# Use arm architecture
sed -i 's/"x86_64"/"aarch64"/g' ./ci/build.sh
git clone --recursive https://github.com/linuxdeploy/linuxdeploy-plugin-appimage.git
fi
git clone --recursive https://github.com/linuxdeploy/linuxdeploy-plugin-appimage.git
fi
-cd linuxdeploy-plugin-appimage
+cd linuxdeploy-plugin-appimage || exit
# Always use /tmp
sed -i 's/TEMP_BASE=\/dev\/shm/TEMP_BASE=\/tmp/' ./ci/build-appimage.sh
# Always use /tmp
sed -i 's/TEMP_BASE=\/dev\/shm/TEMP_BASE=\/tmp/' ./ci/build-appimage.sh
flag=0
while read -r line_merge
do
flag=0
while read -r line_merge
do
then
if [ "$line_merge" != "${line_merge%<keyword_tree>*}" ]
then
then
if [ "$line_merge" != "${line_merge%<keyword_tree>*}" ]
then
then
zenity --error --text "Too many parameters"
exit
then
zenity --error --text "Too many parameters"
exit
then
config_main=$(zenity --file-selection --file-filter="geeqierc.xml" --file-filter="*.xml" --file-filter="*" --title="Select main configuration file")
if [ $? -eq 1 ]
then
config_main=$(zenity --file-selection --file-filter="geeqierc.xml" --file-filter="*.xml" --file-filter="*" --title="Select main configuration file")
if [ $? -eq 1 ]
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 ]
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 ]
## @file
## @brief Create a new release
## @file
## @brief Create a new release
## It is expected that the first line of NEWS is in the form "Geeqie \<a.b[.d]\>
##
## It is expected that the first line of NEWS is in the form "Geeqie \<a.b[.d]\>
##
-error_handler ()
-{
- echo "Error on line: $1"
- exit 1
-}
-trap 'error_handler ${LINENO}' ERR
-
-
minor_version=$2
# patch_version=$3 # not used on master branch
minor_version=$2
# patch_version=$3 # not used on master branch
- printf '%s%s%s%s%s%s%s' "$major_version" "." "$minor_version" "+git" $(git log --max-count=1 --date=format:"%Y%m%d" --format="%ad") "-" $(git rev-parse --quiet --verify --short HEAD)
+ printf '%s%s%s%s%s%s%s' "$major_version" "." "$minor_version" "+git" "$(git log --max-count=1 --date=format:"%Y%m%d" --format="%ad")" "-" "$(git rev-parse --quiet --verify --short HEAD)"
else
version=$(head -1 NEWS)
# shellcheck disable=SC2086
else
version=$(head -1 NEWS)
# shellcheck disable=SC2086