From b47ee048d387ed5e54f51b2739e5d91535d1311b Mon Sep 17 00:00:00 2001 From: casjay Date: Tue, 27 Aug 2024 14:03:43 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20Committing=20everything?= =?UTF-8?q?=20that=20changed=20=F0=9F=97=83=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rootfs/usr/local/bin/copy rootfs/usr/local/bin/symlink --- rootfs/usr/local/bin/copy | 13 +++++++++---- rootfs/usr/local/bin/symlink | 17 ++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/rootfs/usr/local/bin/copy b/rootfs/usr/local/bin/copy index f45a3f9..23a7156 100755 --- a/rootfs/usr/local/bin/copy +++ b/rootfs/usr/local/bin/copy @@ -53,12 +53,17 @@ DEFAULT_COLOR="254" COPY_EXIT_STATUS=0 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Main application -if [ $# -ne 2 ] || [ ! -e "$1" ]; then - __printf_color "Usage: $APPNAME from to" - exit 1 -else +{ [ $# -eq 2 ] || [ "$1" = "--help" ]; } || { __printf_color "Usage: $APPNAME fromFile toFile" && exit 1; } +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +if [ -d "$1" ]; then + mkdir -p "$2" + cp -Rf "$1/." "$2/" + COPY_EXIT_STATUS=$? +elif [ -e "$1" ]; then cp -Rf "$1" "$2" COPY_EXIT_STATUS=$? +else + COPY_EXIT_STATUS=2 fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # End application diff --git a/rootfs/usr/local/bin/symlink b/rootfs/usr/local/bin/symlink index 22f885b..4f7c66a 100755 --- a/rootfs/usr/local/bin/symlink +++ b/rootfs/usr/local/bin/symlink @@ -53,15 +53,14 @@ DEFAULT_COLOR="254" SYMLINK_EXIT_STATUS=0 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Main application -if [ $# -ne 2 ] || [ ! -e "$1" ]; then - __printf_color "Usage: $APPNAME from to" - exit 1 -else - if [ -L "$2" ]; then - unlink "$2" - elif [ -e "$2" ]; then - rm -Rf "$2" - fi +{ [ $# -eq 2 ] || [ "$1" = "--help" ]; } || { __printf_color "Usage: $APPNAME fromFile toFile" && exit 1; } +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +if [ -L "$2" ]; then + unlink "$2" +elif [ -e "$2" ]; then + rm -Rf "$2" +fi +if [ -e "$1" ]; then ln -sf "$1" "$2" SYMLINK_EXIT_STATUS=$? fi