🗃️ Committing everything that changed 🗃️

rootfs/usr/local/bin/copy
rootfs/usr/local/bin/symlink
This commit is contained in:
casjay 2024-08-27 14:02:45 -04:00
parent b3063f4d19
commit 7439aa3aba
Signed by untrusted user who does not match committer: jason
GPG Key ID: 1AB309F42A764145
2 changed files with 17 additions and 13 deletions

View File

@ -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

View File

@ -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
{ [ $# -eq 2 ] || [ "$1" = "--help" ]; } || { __printf_color "Usage: $APPNAME fromFile toFile" && exit 1; }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [ -L "$2" ]; then
unlink "$2"
elif [ -e "$2" ]; then
elif [ -e "$2" ]; then
rm -Rf "$2"
fi
fi
if [ -e "$1" ]; then
ln -sf "$1" "$2"
SYMLINK_EXIT_STATUS=$?
fi