#!/usr/bin/env bash set -euo pipefail REPO_URL='https://gitea.itosm.co.kr/syskiller/triliumnext-korean-patch.git' source_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]:-.}")" 2>/dev/null && pwd || pwd)" if [[ $# -eq 0 && -f "$source_dir/release/manifest.json" ]]; then install_dir="$source_dir" else install_dir="${1:-trilium-korean}" command -v git >/dev/null || { echo 'Git을 먼저 설치하세요.' >&2; exit 1; } if [[ -d "$install_dir/.git" ]]; then [[ -z "$(git -C "$install_dir" status --porcelain)" ]] || { echo '설치 폴더에 수정한 파일이 있습니다. 먼저 보관하거나 커밋하세요.' >&2; exit 1; } git -C "$install_dir" pull --ff-only elif [[ -e "$install_dir" ]]; then echo '설치 대상 폴더가 이미 있습니다. 저장소 폴더에서 인수 없이 실행하거나 빈 경로를 지정하세요.' >&2; exit 1 else git clone "$REPO_URL" "$install_dir" fi fi cd -- "$install_dir" exec bash tools/deploy.sh