From 5ba79b4831c230842b9004a32c81a14a80c0b459 Mon Sep 17 00:00:00 2001 From: mathiascode Date: Sat, 9 May 2020 03:09:49 +0300 Subject: [PATCH] Make schematic script safer --- script/schematics.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/script/schematics.sh b/script/schematics.sh index 4b3455b..dd6a593 100755 --- a/script/schematics.sh +++ b/script/schematics.sh @@ -6,11 +6,14 @@ set -x ssh-keyscan github.com >> .ssh/known_hosts +folder=~/server/plugins/FastAsyncWorldEdit/schematics/ while true; do - git clone git@github.com:kaboomserver/schematics.git ~/server/plugins/FastAsyncWorldEdit/schematics/ - cd ~/server/plugins/FastAsyncWorldEdit/schematics/ - if [ "$(git add $(git ls-files -o) -v)" ]; then + if [ ! -d "$folder" ]; then + git clone --depth 1 git@github.com:kaboomserver/schematics.git $folder + fi + + if [ "$(cd $folder && git add $(git ls-files -o) -v)" ]; then git -c user.name='kaboom' -c user.email='kaboom.pw' commit -m "Add new schematics" git push fi