Created
October 3, 2023 11:48
-
-
Save Sanne/7abc84cee6c7391efcbe6ba4f42c6aed to your computer and use it in GitHub Desktop.
Networkmanager listeners to reconfigure my local Maven proxies
This file contains hidden or 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
#!/bin/sh | |
# Store as /etc/NetworkManager/dispatcher.d/10-script.sh | |
# make the script executable & owned by root. (protect it too!) | |
# Will trigger on up/down events of the selected network | |
HOME_CONNECTION_ID="TanaUB6" | |
LOG=/home/sanne/.m2/track-wifi-status-change | |
# echo "################" >> $LOG | |
# env >> $LOG | |
# echo "env HOME_CONNECTION_ID:" >> $LOG | |
# echo CONNECTION_ID >> $LOG | |
if [ "$CONNECTION_ID" = "$HOME_CONNECTION_ID" ]; then | |
case $NM_DISPATCHER_ACTION in | |
up) | |
# echo "## identified up event" >> $LOG | |
cp /home/sanne/.m2/home-settings.xml /home/sanne/.m2/settings.xml | |
;; | |
down) | |
# echo "## identified down event" >> $LOG | |
rm /home/sanne/.m2/settings.xml | |
;; | |
esac | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment