Add ditto command stub

This commit is contained in:
Ariel Abreu 2023-10-04 23:28:25 -04:00
parent 47c204a243
commit 55bcc0bf89
No known key found for this signature in database
GPG Key ID: 5B88AAAF4280706F
3 changed files with 32 additions and 0 deletions

View File

@ -277,6 +277,7 @@ if (COMPONENT_cli)
add_subdirectory(external/lzfse)
add_subdirectory(clt)
add_subdirectory(diskutil)
add_subdirectory(ditto)
# these aren't used by anything we build (they're just included because they're also present in macOS)
# TODO: maybe we should introduce another component (e.g. `lib_stock`) for libraries we don't need but are expected in a stock macOS installation.

8
src/ditto/CMakeLists.txt Normal file
View File

@ -0,0 +1,8 @@
project(ditto)
install(FILES ditto DESTINATION libexec/darling/usr/bin
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)

23
src/ditto/ditto Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
#
# FIXME: implement an actual version of ditto
#
# This is just a stub that works well enough for xcodebuild.
#
if [ "$#" -lt 3 ]; then
>&2 cat <<- 'EOF'
ditto command stub
Only supports "ditto -rsrc <source> <dest>"
EOF
exit 1
fi
if [ "$1" != "--rsrc" ] && [ "$1" != "-rsrc" ]; then
>&2 echo "Bad argument #1; expected -rsrc or --rsrc"
exit 1
fi
cp -a "$2" "$3"