chore: add Cloudron PackageTemplate, helper script; add .gitattributes/.editorconfig; refine .gitignore; improve workspace scripts

This commit is contained in:
2025-09-12 14:18:41 -05:00
parent 1a2f9bae6d
commit 8bb6d00b0f
14 changed files with 314 additions and 18 deletions

View File

@@ -205,10 +205,25 @@ https://github.com/funmusicplace/mirlo.git
)
cd Docker
WORKDIR="$(cd "$(dirname "$0")" && pwd)"
TARGET_DIR="${WORKDIR}/Docker"
mkdir -p "$TARGET_DIR"
IFS=$'\n\t'
# If REPOS.txt exists, read additional repos (lines; ignore # and blanks)
EXTRA_REPOS_FILE="${WORKDIR}/REPOS.txt"
if [[ -f "$EXTRA_REPOS_FILE" ]]; then
mapfile -t EXTRA_REPOS < <(sed -e 's/#.*$//' -e '/^\s*$/d' "$EXTRA_REPOS_FILE")
else
EXTRA_REPOS=()
fi
for GIT_REPO in ${GIT_REPO_LIST[@]};do
git clone --depth 1 $GIT_REPO || true
done
ALL_REPOS=("${GIT_REPO_LIST[@]}" "${EXTRA_REPOS[@]}")
echo "Cloning to: $TARGET_DIR"
printf ' - %s\n' "${ALL_REPOS[@]}"
cd "$TARGET_DIR"
# Parallel clones (default 4 jobs). Avoid failing the whole script on single failures.
JOBS="${JOBS:-4}"
printf '%s\n' "${ALL_REPOS[@]}" | xargs -n1 -P "$JOBS" -I{} bash -lc 'repo="{}"; name=$(basename -s .git "$repo"); if [[ -d "$name/.git" ]]; then echo "exists: $name"; else git clone --depth 1 "$repo" "$name" || echo "failed: $repo"; fi'

View File

@@ -27,18 +27,21 @@ set -o nounset
set -o pipefail
set -o functrace
WORKDIR="$(cd "$(dirname "$0")" && pwd)"
TARGET_DIR="${WORKDIR}/Docker"
cd Docker
cd "$TARGET_DIR"
GIT_REPO_LIST="$(ls -d */)"
IFS=$'\n\t'
for GIT_REPO in ${GIT_REPO_LIST[@]};
do
CURRENT_DIR=$(realpath $PWD)
echo "Updating from $GIT_REPO..."
cd $GIT_REPO
git pull
cd $CURRENT_DIR
done
# Iterate only over directories that are git repos
while IFS= read -r -d '' repo_dir; do
echo "Updating: ${repo_dir}"
pushd "$repo_dir" >/dev/null
if [[ -d .git ]]; then
git -c advice.detachedHead=false fetch --all --prune || true
# Fast-forward only to avoid unintended merges
git -c advice.detachedHead=false pull --ff-only || true
else
echo "Skipping (not a git repo): ${repo_dir}"
fi
popd >/dev/null
done < <(find . -mindepth 1 -maxdepth 1 -type d -print0)