This commit is contained in:
Michael Grote 2023-07-21 21:44:08 +02:00
parent b9282d8590
commit d4f775c2e9

6
app.sh
View file

@ -6,7 +6,7 @@
git config --global user.name "$GIT_USERNAME" git config --global user.name "$GIT_USERNAME"
echo "clone repository..." echo "clone repository..."
GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -i $GIT_REPO_DEPLOY_KEY" git clone "$GIT_REPO_URL" "$GIT_REPO_PATH" --quiet &> /dev/null GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -i $GIT_REPO_DEPLOY_KEY" git clone "$GIT_REPO_URL" "$GIT_REPO_PATH" --quiet > /dev/null
cd "$GIT_REPO_PATH" cd "$GIT_REPO_PATH"
while true ; do while true ; do
@ -68,11 +68,11 @@ while true ; do
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"
git add "config_${FQDN}.rsc" git add "config_${FQDN}.rsc"
echo "commit config for ${FQDN} ..." echo "commit config for ${FQDN} ..."
git commit -m "update config_${FQDN}" --quiet &> /dev/null git commit -m "update config_${FQDN}" --quiet > /dev/null
done <<< "$DEVICES" done <<< "$DEVICES"
echo "push config(s)..." echo "push config(s)..."
GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -i $GIT_REPO_DEPLOY_KEY" git push &> /dev/null GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -i $GIT_REPO_DEPLOY_KEY" git push > /dev/null
# Restore the original IFS value # Restore the original IFS value
IFS=$OLD_IFS IFS=$OLD_IFS