diff --git a/tools/deploy.sh b/tools/deploy.sh index beeaaa7..4de390d 100755 --- a/tools/deploy.sh +++ b/tools/deploy.sh @@ -24,7 +24,7 @@ init() { } backup() { - mv _site "$_backup_dir" + mv _site/* "$_backup_dir" mv .git "$_backup_dir" # When adding custom domain from Github website, diff --git a/tools/init.sh b/tools/init.sh index 2c0c71c..51393dd 100755 --- a/tools/init.sh +++ b/tools/init.sh @@ -24,13 +24,18 @@ help() { check_init() { local _has_inited=false - if [[ -d .github ]]; then - if [[ -f .github/workflows/$ACTIONS_WORKFLOW && \ - $(find .github/workflows/ -type f -name "*.yml" | wc -l) == 1 ]]; then - _has_inited=true + if [[ ! -d docs ]]; then + if [[ ! -d .github ]]; then + _has_inited=true # --no-gh + else + if [[ -f .github/workflows/$ACTIONS_WORKFLOW ]]; then + # on BSD, the `wc` could contains blank + local _count="$(find .github/workflows/ -type f -name "*.yml" | wc -l)" + if [[ ${_count//[[:blank:]]/} == 1 ]]; then + _has_inited=true + fi + fi fi - else - _has_inited=true fi if $_has_inited; then