|
|
@@ -7,27 +7,4 @@ how to extract webpage from a git repo and then throw it into root of www server
|
|
|
```bash
|
|
|
git --git-dir=/path/to/repo.git archive HEAD | tar -x -C /destination/path
|
|
|
|
|
|
-```
|
|
|
-
|
|
|
-script that can be runned with crontab every 5min
|
|
|
-
|
|
|
-It checks if the repo hash has changed from last time if yes it extracts it into a folder
|
|
|
-
|
|
|
-```bash
|
|
|
-GIT_DIR=/path/to/repo.git
|
|
|
-DEST=/destination/path
|
|
|
-STATE_FILE=/var/tmp/repo_last_commit.txt
|
|
|
-
|
|
|
-# get current commit hash
|
|
|
-curr=$(git --git-dir="$GIT_DIR" rev-parse HEAD) || exit 1
|
|
|
-
|
|
|
-# read last seen commit (empty if missing)
|
|
|
-last=''
|
|
|
-[ -f "$STATE_FILE" ] && last=$(cat "$STATE_FILE")
|
|
|
-
|
|
|
-# if changed, extract and update state
|
|
|
-if [ "$curr" != "$last" ]; then
|
|
|
- git --git-dir="$GIT_DIR" archive "$curr" | tar -x -C "$DEST" || exit 1
|
|
|
- echo "$curr" > "$STATE_FILE"
|
|
|
-fi
|
|
|
```
|