mirror of
https://github.com/harivansh-afk/betterNAS.git
synced 2026-04-15 10:05:14 +00:00
39 lines
760 B
Bash
Executable file
39 lines
760 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
if [[ $# -ne 1 ]]; then
|
|
echo "usage: $0 /absolute/path/to/clone" >&2
|
|
exit 1
|
|
fi
|
|
|
|
clone_dir="$1"
|
|
|
|
if [[ "$clone_dir" != /* ]]; then
|
|
echo "clone path must be absolute: $clone_dir" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -d "$clone_dir/.git" ]]; then
|
|
git clone --local --no-hardlinks "$repo_root" "$clone_dir"
|
|
fi
|
|
|
|
find "$clone_dir" -mindepth 1 -maxdepth 1 \
|
|
! -name .git \
|
|
! -name .env.agent \
|
|
-exec rm -rf {} +
|
|
|
|
tar \
|
|
--exclude=.git \
|
|
--exclude=.state \
|
|
--exclude=.turbo \
|
|
--exclude=node_modules \
|
|
--exclude=dist \
|
|
--exclude='apps/web/.next' \
|
|
-C "$repo_root" \
|
|
-cf - \
|
|
. | tar -C "$clone_dir" -xf -
|
|
|
|
echo "Synced working tree into $clone_dir"
|