🗃️ Committing everything that changed 🗃️
Some checks failed
release-tag / release-image (push) Failing after 5m16s

rootfs/usr/local/bin/copy
rootfs/usr/local/bin/symlink
This commit is contained in:
casjay 2024-09-02 14:31:18 -04:00
parent 55eeb2d7fe
commit 412f8c9456
Signed by untrusted user who does not match committer: jason
GPG Key ID: 1AB309F42A764145
2 changed files with 27 additions and 23 deletions

View File

@ -35,10 +35,10 @@ COPY_CWD="$(realpath "$PWD")"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# script functions # script functions
if [ "$SHOW_RAW" != "true" ]; then if [ "$SHOW_RAW" != "true" ]; then
__printf_color() { printf "%b" "$(tput setaf "${2:-7}" 2>/dev/null)" "$1\n" "$(tput sgr0 2>/dev/null)"; } __printf_color() { printf "%b" "$(tput setaf "${2:-$DEFAULT_COLOR}" 2>/dev/null)" "$1\n" "$(tput sgr0 2>/dev/null)"; }
else else
# Disable colorization # Disable colorization
__printf_color() { { [ -z "$2" ] || DEFAULT_COLOR=$2; } && printf '%b\n' "$1" | tr -d '\t' | sed '/^%b$/d;s,\x1B\[ 0-9;]*[a-zA-Z],,g'; } __printf_color() { printf '%b\n' "$1" | tr -d '\t' | sed '/^%b$/d;s,\x1B\[ 0-9;]*[a-zA-Z],,g'; }
fi fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# check for command # check for command
@ -49,21 +49,23 @@ __function_exists() { builtin type $1 >/dev/null 2>&1 || return 1; }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Define Variables # Define Variables
DEFAULT_COLOR="254" DEFAULT_COLOR="7"
COPY_EXIT_STATUS=0 COPY_EXIT_STATUS=0
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Main application # Main application
{ [ $# -eq 2 ] || [ "$1" = "--help" ]; } || { __printf_color "Usage: $APPNAME fromFile toFile" && exit 1; } { [ $# -eq 2 ] || [ "$1" = "--help" ]; } || { __printf_color "Usage: $APPNAME fromFile toFile" && exit 1; }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [ -d "$1" ]; then if [ "$1" != "$2" ]; then
mkdir -p "$2" if [ -d "$1" ]; then
cp -Rf "$1/." "$2/" mkdir -p "$2"
COPY_EXIT_STATUS=$? cp -Rf "$1/." "$2/"
elif [ -e "$1" ]; then COPY_EXIT_STATUS=$?
cp -Rf "$1" "$2" elif [ -e "$1" ]; then
COPY_EXIT_STATUS=$? cp -Rf "$1" "$2"
else COPY_EXIT_STATUS=$?
COPY_EXIT_STATUS=2 else
COPY_EXIT_STATUS=2
fi
fi fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# End application # End application

View File

@ -35,10 +35,10 @@ SYMLINK_CWD="$(realpath "$PWD")"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# script functions # script functions
if [ "$SHOW_RAW" != "true" ]; then if [ "$SHOW_RAW" != "true" ]; then
__printf_color() { printf "%b" "$(tput setaf "${2:-7}" 2>/dev/null)" "$1\n" "$(tput sgr0 2>/dev/null)"; } __printf_color() { printf "%b" "$(tput setaf "${2:-$DEFAULT_COLOR}" 2>/dev/null)" "$1\n" "$(tput sgr0 2>/dev/null)"; }
else else
# Disable colorization # Disable colorization
__printf_color() { { [ -z "$2" ] || DEFAULT_COLOR=$2; } && printf '%b\n' "$1" | tr -d '\t' | sed '/^%b$/d;s,\x1B\[ 0-9;]*[a-zA-Z],,g'; } __printf_color() { printf '%b\n' "$1" | tr -d '\t' | sed '/^%b$/d;s,\x1B\[ 0-9;]*[a-zA-Z],,g'; }
fi fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# check for command # check for command
@ -49,20 +49,22 @@ __function_exists() { builtin type $1 >/dev/null 2>&1 || return 1; }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Define Variables # Define Variables
DEFAULT_COLOR="254" DEFAULT_COLOR="7"
SYMLINK_EXIT_STATUS=0 SYMLINK_EXIT_STATUS=0
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Main application # Main application
{ [ $# -eq 2 ] || [ "$1" = "--help" ]; } || { __printf_color "Usage: $APPNAME fromFile toFile" && exit 1; } { [ $# -eq 2 ] || [ "$1" = "--help" ]; } || { __printf_color "Usage: $APPNAME fromFile toFile" && exit 1; }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [ -L "$2" ]; then if [ "$1" != "$2" ]; then
unlink "$2" if [ -L "$2" ]; then
elif [ -e "$2" ]; then unlink "$2"
rm -Rf "$2" elif [ -e "$2" ]; then
fi rm -Rf "$2"
if [ -e "$1" ]; then fi
ln -sf "$1" "$2" if [ -e "$1" ]; then
SYMLINK_EXIT_STATUS=$? ln -sf "$1" "$2"
SYMLINK_EXIT_STATUS=$?
fi
fi fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# End application # End application