git scripts update

This commit is contained in:
sHa
2019-06-07 12:16:30 +03:00
parent ddb3dc0d8e
commit c68d3c0223
4 changed files with 29 additions and 7 deletions

View File

@@ -33,7 +33,7 @@ yarn
Upload all changes in storage folder into git repository Upload all changes in storage folder into git repository
### submodule_pull ### submodule_pull
Update git submodules
## 📁 File system ## 📁 File system

View File

@@ -1,6 +1,6 @@
{ {
"name": "sscripts", "name": "sscripts",
"version": "1.0.7", "version": "1.0.8",
"description": "Useful Shell scripts for projects", "description": "Useful Shell scripts for projects",
"author": "sHa <sha@shadoll.dev>", "author": "sHa <sha@shadoll.dev>",
"license": "MIT", "license": "MIT",
@@ -15,6 +15,7 @@
"hello.sh": "./scripts/hello.sh", "hello.sh": "./scripts/hello.sh",
"hello.js": "./scripts/hello.js", "hello.js": "./scripts/hello.js",
"git.storage_push": "./scripts/git/storage_push.sh", "git.storage_push": "./scripts/git/storage_push.sh",
"git.submodule_pull": "./scripts/git/submodule_pull.sh",
"fs.fix_permissions": "./scripts/fs/fix_permissions.sh", "fs.fix_permissions": "./scripts/fs/fix_permissions.sh",
"docker.up": "./scripts/docker/up.sh", "docker.up": "./scripts/docker/up.sh",
"docker.down": "./scripts/docker/down.sh", "docker.down": "./scripts/docker/down.sh",

View File

@@ -28,4 +28,12 @@ cd $PROJECT/storage
git add . --all && git add . --all &&
git commit -m "storage" git commit -m "storage"
git push origin master --force
if [ -f $PROJECT/docker/.ssh/id_rsa ]; then
if [ `stat -c %a $PROJECT/docker/.ssh/id_rsa` -ne '600' ]; then
chmod -R a=rwX,go-rwX $PROJECT/docker/.ssh
fi
ssh-agent sh -c "ssh-add -D; ssh-add $PROJECT/docker/.ssh/id_rsa; git push origin master --force"
else
git push origin master --force
fi

View File

@@ -7,10 +7,23 @@
# @link https://shadoll.dev # @link https://shadoll.dev
# #
DIR=$(dirname "$0") DIR=$(dirname $BASH_SOURCE)
ROOT=$(cd "$DIR"/.. && pwd) PROJECT=(${DIR//node_modules/ })
chmod -R a=rwX,go-rwX "$ROOT"/docker/.ssh/ git --version 2>&1 >/dev/null
GIT_IS_AVAILABLE=$?
if [ $GIT_IS_AVAILABLE -ne 0 ]; then
echo "ERROR: The program 'git' is currently not installed."
echo "Try: 'sudo apt install git' to install it"
exit 1
fi
git submodule init git submodule init
ssh-agent sh -c "ssh-add -D; ssh-add $ROOT/docker/.ssh/id_rsa; git submodule update" if [ -f $PROJECT/docker/.ssh/id_rsa ]; then
if [ `stat -c %a $PROJECT/docker/.ssh/id_rsa` -ne '600' ]; then
chmod -R a=rwX,go-rwX $PROJECT/docker/.ssh
fi
ssh-agent sh -c "ssh-add -D; ssh-add $ROOT/docker/.ssh/id_rsa; git submodule update"
else
git submodule update
fi