Add a script for checking whether a value is truthy

This commit is contained in:
Manuel Thalmann 2023-05-04 19:51:05 +02:00
parent c4ecd89bf6
commit 7728cf9e87
2 changed files with 13 additions and 2 deletions

View file

@ -3,8 +3,9 @@ NEXTCLOUD_DIR="${NEXTCLOUD_DIR:-Nextcloud}";
INSTALL_FONTS="${INSTALL_FONTS}"; INSTALL_FONTS="${INSTALL_FONTS}";
dir="${BASH_SOURCE%/*}"; dir="${BASH_SOURCE%/*}";
pushd "$dir" > /dev/null; pushd "$dir" > /dev/null;
. "../../Scripts/is-truthy.sh";
if [ ! -z "$INSTALL_FONTS" ] if isTruthy "$INSTALL_FONTS"
then then
# Microsoft Windows Fonts # Microsoft Windows Fonts
source "../Fonts/MicrosoftFonts/install.sh"; source "../Fonts/MicrosoftFonts/install.sh";
@ -13,7 +14,7 @@ fi;
# Sync clouds # Sync clouds
NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" . "../rclone/InstallSync.sh" nextcloud "$NEXTCLOUD_DIR"; NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" . "../rclone/InstallSync.sh" nextcloud "$NEXTCLOUD_DIR";
if [ ! -z "$INSTALL_FONTS" ] if isTruthy "$INSTALL_FONTS"
then then
# Install fonts # Install fonts
NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" source "../Fonts/NerdFont/install.sh"; NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" source "../Fonts/NerdFont/install.sh";

View file

@ -0,0 +1,10 @@
function isTruthy() {
local value;
value="$1";
[ ! -z "$value" ] &&
[ "$value" != "0" ] &&
[ "$value" != "false" ] &&
[ "$value" != "n" ] &&
[ "$value" != "no" ];
}