123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #!/usr/bin/env bash
- #
- # Upload changes from inside repository using GIN CLI
- # Works with submodules.
- # Assumes gin init was performed or the repository was downloaded via gin get
- if (( $# > 0 )); then
- echo "This script takes no arguments"
- exit 1
- fi
- checkerror() {
- err=$1
- msg=$2
- if [[ ${err} != 0 ]]; then
- echo "${msg}" >> ./log/gin.log
- echo "${msg}"
- echo "Press [Enter] to close this window"
- read -r
- exit 1
- fi
- }
- mkdir -p ./log
- echo "$(date -Iseconds): Sync script executed" >> ./log/gin.log
- echo "Synchronising submodules"
- git submodule foreach gin sync
- checkerror $? "Error occurred during 'gin sync'"
- git submodule foreach gin commit .
- checkerror $? "Error occurred during 'gin commit'"
- git submodule foreach gin upload
- checkerror $? "Error occurred during 'gin upload'"
- echo "Synchronising main repository"
- gin sync
- gin commit .
- gin upload
- # Uncomment the two lines below to download all large files
- # gin get-content .
- # checkerror $? "Error occurred during 'gin get-content'"
|