Initial commit
This commit is contained in:
commit
a363bde348
15 changed files with 1189 additions and 0 deletions
35
files/root/bin/autoupdate_fastd_keys.sh
Normal file
35
files/root/bin/autoupdate_fastd_keys.sh
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
# Simple script to update fastd peers from git upstream
|
||||
# and only send HUP to fastd when changes happend.
|
||||
|
||||
# CONFIGURE THIS TO YOUR PEER DIRECTORY
|
||||
FASTD_PEERS=/etc/fastd/ffhh-mesh-vpn/peers
|
||||
|
||||
function getCurrentVersion() {
|
||||
# Get hash from latest revision
|
||||
git log --format=format:%H -1
|
||||
}
|
||||
|
||||
cd $FASTD_PEERS
|
||||
|
||||
# Get current version hash
|
||||
GIT_REVISION=$(getCurrentVersion)
|
||||
|
||||
# Automagically commit local changes
|
||||
# This preserves local changes
|
||||
git commit -m "CRON: auto commit"
|
||||
|
||||
# Pull latest changes from upstream
|
||||
git fetch
|
||||
git merge origin/master -m "Auto Merge"
|
||||
|
||||
# Get new version hash
|
||||
GIT_NEW_REVISION=$(getCurrentVersion)
|
||||
|
||||
if [ $GIT_REVISION != $GIT_NEW_REVISION ]
|
||||
then
|
||||
# Version has changed we need to update
|
||||
echo "Reload fastd peers"
|
||||
kill -HUP $(pidof fastd)
|
||||
fi
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue