forked from letscontrolit/ESPEasy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GIT hooks: post-merge, post-commit, post-checkout
scripts intended as local git hooks. post-merge: - create symlink ESPEasy - if necessary - add "#define BUILD_GIT <git revision>" to Custom.h - add "#define USE_CUSTOM_H" to src/ESPEasy-Globals.h post-commit: - add "#define BUILD_GIT <git revision>" to Custom.h post-checkout: - on branch checkout also add "#define BUILD_GIT <git revision>"
- Loading branch information
Susis Strolch
committed
Apr 14, 2018
1 parent
a151e60
commit 21011c5
Showing
4 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ | |
## Project ##################### | ||
lib/readme.txt | ||
src/Custom.h | ||
/ESPEasy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
# purpose: GIT post-commit | ||
# change value of BUILD_GIT macro | ||
# | ||
WORKDIR=src | ||
CUSTOM_H=${WORKDIR}/Custom.h | ||
GLOBAL_H=${WORKDIR}/ESPEasy-Globals.h | ||
|
||
# update BUILD_GIT on branch checkout | ||
[[ $3 == 1 && -f ${CUSTOM_H} ]] && \ | ||
sed -i.bak -e "s/\(#define BUILD_GIT\).*/\1 $(git log -1 --pretty=format:%h HEAD)/" ${CUSTOM_H} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
# purpose: GIT post-commit | ||
# change value of BUILD_GIT macro | ||
# | ||
WORKDIR=src | ||
CUSTOM_H=${WORKDIR}/Custom.h | ||
GLOBAL_H=${WORKDIR}/ESPEasy-Globals.h | ||
|
||
[[ -f ${CUSTOM_H} ]] && \ | ||
sed -i.bak -e "s/\(#define BUILD_GIT\).*/\1 $(git log -1 --pretty=format:%h HEAD)/" ${CUSTOM_H} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
# build an include file to select plugins | ||
# | ||
WORKDIR=ESPEasy | ||
CUSTOM_H=${WORKDIR}/Custom.h | ||
GLOBAL_H=${WORKDIR}/ESPEasy-Globals.h | ||
|
||
[[ -L ${WORKDIR} ]] || ( | ||
ln -s src ${WORKDIR} | ||
) | ||
|
||
# we expect that ${CUSTOM_H} always contains a "#define BUILD_GIT" macro | ||
[[ -f ${CUSTOM_H} ]] && ( | ||
echo "post_merge: change BUILD_GIT" | ||
sed -i.bak -e "s/\(#define BUILD_GIT\).*/\1 $(git log -1 --pretty=format:%h HEAD)/" ${CUSTOM_H} | ||
) | ||
|
||
# uncomment if you don't want to use the Custom.h include | ||
grep -q "^#define USE_CUSTOM_H" ${GLOBAL_H} || ( | ||
sed -i -e "/[ \t]*#define ESPEASY_GLOBALS_H_/a #define USE_CUSTOM_H" ${GLOBAL_H} | ||
) |