This commit is contained in:
Michael Grote 2023-07-21 21:01:35 +02:00
parent 50bdaa7098
commit 41861cb4d3

10
app.sh
View file

@ -43,9 +43,13 @@ while true ; do
if [ -d "$GIT_REPO_PATH" ] ; then if [ -d "$GIT_REPO_PATH" ] ; then
cd "$GIT_REPO_PATH" cd "$GIT_REPO_PATH"
if [ -d ".git" ] ; then if [ -d ".git" ] ; then
echo pull
pwd
git pull "$GIT_REPO_REMOTE_NAME" "$GIT_REPO_BRANCH" --quiet git pull "$GIT_REPO_REMOTE_NAME" "$GIT_REPO_BRANCH" --quiet
fi fi
else else
echo clone
pwd
git clone "$GIT_REPO_URL" "$GIT_REPO_PATH" --quiet git clone "$GIT_REPO_URL" "$GIT_REPO_PATH" --quiet
fi fi
@ -67,8 +71,14 @@ while true ; do
echo "export $FQDN config" echo "export $FQDN config"
ssh -n -o StrictHostKeyChecking=no -i "$SSH_KEY_PATH" "${USERNAME}@${FQDN}" "/export show-sensitive" > "config_${FQDN}.rsc" 2> /dev/null ssh -n -o StrictHostKeyChecking=no -i "$SSH_KEY_PATH" "${USERNAME}@${FQDN}" "/export show-sensitive" > "config_${FQDN}.rsc" 2> /dev/null
# entferne Datumszeile # entferne Datumszeile
echo sed
pwd
sed -i -r '/^# [0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}\:[0-9]{2}\:[0-9]{2}\sby\sRouterOS\s[0-9\s\.]+/d' "config_${FQDN}.rsc" sed -i -r '/^# [0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}\:[0-9]{2}\:[0-9]{2}\sby\sRouterOS\s[0-9\s\.]+/d' "config_${FQDN}.rsc"
echo add
pwd
git add "config_${FQDN}.rsc" git add "config_${FQDN}.rsc"
echo commit
pwd
git commit -m "update config_${FQDN}" --quiet git commit -m "update config_${FQDN}" --quiet
done <<< "$DEVICES" done <<< "$DEVICES"