From e0480f8fd84fef8684e1b7e8769074359eec1a85 Mon Sep 17 00:00:00 2001 From: veto Date: Sat, 11 Jan 2025 12:19:10 +0700 Subject: [PATCH] make it work on macos by not use readline and ;& fallthrough for Darwin --- vackup | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/vackup b/vackup index 7cb2125..81edc1b 100755 --- a/vackup +++ b/vackup @@ -81,12 +81,21 @@ error() { fulldirname() { DIRECTORY=$(dirname "$1") - case "$DIRECTORY" in - /*) ;; - .*) ;& # fallthrough - *) DIRECTORY="$(pwd)/$DIRECTORY" ;; - esac - DIRECTORY=$(readlink -m "$DIRECTORY") + if ! [ "$(uname)" == "Darwin" ]; then + case "$DIRECTORY" in + /*) ;; + .*) ;& # fallthrough + *) DIRECTORY="$(pwd)/$DIRECTORY" ;; + esac + DIRECTORY=$(readlink -m "$DIRECTORY") + else + case "$DIRECTORY" in + /*) ;; + .*) ;; # fallthrough + *) DIRECTORY="$(pwd)/$DIRECTORY" ;; + esac + DIRECTORY="$(pwd)/$DIRECTORY" + fi echo "$DIRECTORY" } @@ -221,6 +230,17 @@ cmd_load() { echo "Successfully copied /volume-data from $IMAGE_NAME into volume $VOLUME_NAME" } +unameOut="$(uname -s)" +case "${unameOut}" in + Linux*) machine=Linux;; + Darwin*) machine=Mac;; + CYGWIN*) machine=Cygwin;; + MINGW*) machine=MinGw;; + MSYS_NT*) machine=MSys;; + *) machine="UNKNOWN:${unameOut}" +esac + + COMMAND="$1" case "$COMMAND" in export) cmd_export "$@" ;;