From 55faa58c704b990d22226fde81da6a1c17937170 Mon Sep 17 00:00:00 2001 From: Rangga Fajar Oktariansyah <86386385+FajarKim@users.noreply.github.com> Date: Sun, 28 Jan 2024 19:57:43 +0700 Subject: [PATCH] chore: fixed small typo in install script (#3) --- tools/Linux/install.sh | 13 +++++++------ tools/Termux/install.sh | 19 +++++++------------ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/tools/Linux/install.sh b/tools/Linux/install.sh index f095246..6888448 100755 --- a/tools/Linux/install.sh +++ b/tools/Linux/install.sh @@ -28,6 +28,7 @@ set -e # Make sure important variables exist if not already defined +# # $USER is defined by login(1) which is not always executed (e.g. containers) # POSIX: https://pubs.opengroup.org/onlinepubs/009695299/utilities/id.html USER=${USER:-$(id -u -n)} @@ -38,18 +39,18 @@ HOME="${HOME:-$(getent passwd $USER 2>/dev/null | cut -d: -f6)}" # macOS does not have getent, but this works even if $HOME is unset HOME="${HOME:-$(eval echo ~$USER)}" -# Test directory 'cache' -test -d "$HOME/.cache" && test -w "$HOME/.cache" && test -x "$HOME/.cache" || { - mkdir "$HOME/.cache" >/dev/null 2>&1 +# Check directory $HOME/.config. If it doesn't exist, a folder will be created. +test -d "$HOME/.config" && test -w "$HOME/.config" && test -x "$HOME/.config" || { + mkdir "$HOME/.config" >/dev/null 2>&1 } -# Test directory '$PATH' +# Check directory $PATH. test -d "$PATH" && test -w "$PATH" && test -x "$PATH" || { - PATH=$(command -v 'bash' | sed 's|/bash||g') + PATH=$(dirname `command -v "bash"`) } # Default settings -BZSH="${BZSH:-$HOME/.cache/.bz2-shell}" +BZSH="${BZSH:-$HOME/.config/.bz2-shell}" REPO=${REPO:-FajarKim/bz2-shell} REMOTE=${REMOTE:-https://github.com/${REPO}.git} BRANCH=${BRANCH:-master} diff --git a/tools/Termux/install.sh b/tools/Termux/install.sh index 082a719..8fccfd7 100755 --- a/tools/Termux/install.sh +++ b/tools/Termux/install.sh @@ -27,30 +27,25 @@ # set -e -# Make sure important variables exist if not already defined -# $USER is defined by login(1) which is not always executed (e.g. containers) -# POSIX: https://pubs.opengroup.org/onlinepubs/009695299/utilities/id.html -USER=${USER:-$(id -u -n)} - -# Test directory '/data/data/com.termux/files/usr' +# Check directory /data/data/com.termux/files/usr. test -d "$PREFIX" && test -w "$PREFIX" && test -x "$PREFIX" || test -d /data/data/com.termux/files/usr && test -w /data/data/com.termux/files/usr && test -x /data/data/com.termux/files/usr || { mkdir "/data/data/com.termux/files/usr" >/dev/null 2>&1 } PREFIX=/data/data/com.termux/files/usr -# Test directory '/data/data/com.termux/files/usr/shared' -test -d "$PREFIX/shared" && test -w "$PREFIX/shared" && test -x "$PREFIX/shared" || { - mkdir "$PREFIX/shared" >/dev/null 2>&1 +# Check directory /data/data/com.termux/files/usr/lib. +test -d "$PREFIX/lib" && test -w "$PREFIX/lib" && test -x "$PREFIX/lib" || { + mkdir "$PREFIX/lib" >/dev/null 2>&1 } -# Test directory '$PATH' +# Check directory $PATH. test -d "$PATH" && test -w "$PATH" && test -x "$PATH" || { - PATH=$(command -v 'bash' | sed 's|/bash||g') + PATH=$(dirname `command -v "bash"`) } # Default settings -BZSH="${BZSH:-$PREFIX/shared/bz2-shell}" +BZSH="${BZSH:-$PREFIX/lib/bz2-shell}" REPO=${REPO:-FajarKim/bz2-shell} REMOTE=${REMOTE:-https://github.com/${REPO}.git} BRANCH=${BRANCH:-master}