Skip to content

Instantly share code, notes, and snippets.

@davidbalbert
Created October 15, 2023 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidbalbert/dcd0cb87ab4ffdab4e2bead72c1cf936 to your computer and use it in GitHub Desktop.
Save davidbalbert/dcd0cb87ab4ffdab4e2bead72c1cf936 to your computer and use it in GitHub Desktop.
#!/bin/sh
# For Ubiquiti EdgeOS
#
# This script creates a directory /config/scripts/post-commit.d. Any script you put
# in that directory will get run every time you commit a new configuration.
#
# Installation:
# - Put this script in /config/scripts/post-config.d. Note that this is a different
# directory from the directory this creates.
# - Either restart you router or run the script manually. This is the only time
# you'll have to do do this.
set -e
if [ ! -d /config/scripts/post-commit.d ]; then
mkdir -p /config/scripts/post-commit.d
fi
if [ ! -L /etc/commit/post-hooks.d/post-commit-hooks.sh ]; then
sudo ln -fs /config/scripts/post-config.d/post-commit-hooks.sh /etc/commit/post-hooks.d
fi
run-parts --report --regex '^[a-zA-Z0-9._-]+$' /config/scripts/post-commit.d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment