[PATCH 1/4] gnu-linux: compatibility with POSIX `sh` and NixOS
Export this patch
From: PowerUser64 <blakelysnorth@gmail.com>
---
gnu-linux/install.sh.in | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/gnu-linux/install.sh.in b/gnu-linux/install.sh.in
index 4c11c5f..d16e1e4 100755
--- a/gnu-linux/install.sh.in
+++ b/gnu-linux/install.sh.in
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env sh
#
# Copyright (C) 2019-2020, 2022 Alexandros Theodotou <alex at zrythm dot org>
#
@@ -21,7 +21,7 @@ set -ex
uninstall=0
uninstall_prefix_txt=""
-if [[ "$1" = "-u" ]]; then
+if [ "$1" = "-u" ]; then
uninstall=1
uninstall_prefix_txt="un"
fi
@@ -33,7 +33,7 @@ zenity_width=360
have_zenity=0
command -v zenity && have_zenity=1 || true
-if [[ -z "$XDG_DATA_HOME" ]]; then
+if [ -z "$XDG_DATA_HOME" ]; then
XDG_DATA_HOME="$HOME/.local/share"
fi
trash_dir="$XDG_DATA_HOME/Trash"
@@ -85,8 +85,9 @@ if [ $have_zenity -ne 0 ]; then
proceed=1
fi
else
- read -p "$proceed_txt (type Y or y): " -n 1 -r
- if [[ $REPLY =~ ^[Yy]$ ]]; then
+ echo "$proceed_txt (type Y or y): " | tr -d '\n' &&
+ read -r
+ if [ "$REPLY" = "y" ] || [ "$REPLY" = "Y" ]; then
proceed=1
fi
fi
--
2.37.2
[PATCH 2/4] gnu-linux: hide unused output
Export this patch
From: PowerUser64 <blakelysnorth@gmail.com>
avoids potentially confusing users
---
gnu-linux/install.sh.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gnu-linux/install.sh.in b/gnu-linux/install.sh.in
index d16e1e4..78e4ed5 100755
--- a/gnu-linux/install.sh.in
+++ b/gnu-linux/install.sh.in
@@ -31,7 +31,7 @@ trial="@DASH_TRIAL@"
zenity_width=360
have_zenity=0
-command -v zenity && have_zenity=1 || true
+command -v zenity > /dev/null && have_zenity=1 || true
if [ -z "$XDG_DATA_HOME" ]; then
XDG_DATA_HOME="$HOME/.local/share"
--
2.37.2
[PATCH 3/4] gnu-linux: consolidate check
Export this patch
From: PowerUser64 <blakelysnorth@gmail.com>
---
gnu-linux/install.sh.in | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/gnu-linux/install.sh.in b/gnu-linux/install.sh.in
index 78e4ed5..41e6241 100755
--- a/gnu-linux/install.sh.in
+++ b/gnu-linux/install.sh.in
@@ -80,8 +80,7 @@ print_install_success()
proceed=0
proceed_txt="Proceed with the ${uninstall_prefix_txt}installation of Zrythm$trial v$zrythm_ver?"
if [ $have_zenity -ne 0 ]; then
- zenity --question --text="$proceed_txt" --width $zenity_width
- if [ $? -eq 0 ]; then
+ if zenity --question --text="$proceed_txt" --width $zenity_width; then
proceed=1
fi
else
--
2.37.2
[PATCH 4/4] gnu-linux: fix potential word split
Export this patch
From: PowerUser64 <blakelysnorth@gmail.com>
---
gnu-linux/install.sh.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gnu-linux/install.sh.in b/gnu-linux/install.sh.in
index 41e6241..7889365 100755
--- a/gnu-linux/install.sh.in
+++ b/gnu-linux/install.sh.in
@@ -95,7 +95,7 @@ sudo_copy_file()
{
src_path="$1"
dest_path="$2"
- sudo mkdir -p `dirname "$dest_path"`
+ sudo mkdir -p "$(dirname "$dest_path")"
sudo cp "$src_path" "$dest_path"
}
--
2.37.2