This commit is contained in:
Michael Grote 2023-07-21 20:28:42 +02:00
parent 4b1b7304b7
commit 8299626d75

6
x
View file

@ -44,13 +44,13 @@ git config --global user.name "$GIT_USERNAME"
if [ -d "$GIT_REPO_PATH" ] ; then
cd "$GIT_REPO_PATH"
if [ -d ".git" ] ; then
git pull "$GIT_REPO_REMOTE_NAME" "$GIT_REPO_BRANCH"
git pull "$GIT_REPO_REMOTE_NAME" "$GIT_REPO_BRANCH" --quiet
else
echo "Error: The directory exists but is not a Git repository"
exit 1
fi
else
git clone "$GIT_REPO_URL" "$GIT_REPO_PATH"
git clone "$GIT_REPO_URL" "$GIT_REPO_PATH" --quiet
fi
# Save the current value of IFS to restore later
@ -72,7 +72,7 @@ while read -r FQDN SSH_KEY_PATH; do
ssh -n -i "$SSH_KEY_PATH" "$FQDN" "/export show-sensitive" > "config_${FQDN}.rsc"
# entferne Datumszeile
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" --quiet
git add "config_${FQDN}.rsc"
git commit -m "update config_${FQDN}" --quiet
done <<< "$DEVICES"