diff --git a/.gitlab-ci/install.sh.jinja b/.gitlab-ci/install.sh.jinja index a6cb5aac1328d09d6b6b0fe6e1d3d30424a0a80d..b3911397f556fb4e12b99e093c3f5be55149b799 100755 --- a/.gitlab-ci/install.sh.jinja +++ b/.gitlab-ci/install.sh.jinja @@ -1,12 +1,32 @@ #!/usr/bin/env bash # +# Usage: install.sh [-v|--verbose] [--dry-run] [--udevdir /etc/] [--prefix $PREFIX] +# +# Description: +# Installs the BPF programs known to this script into the prefix and +# creates and installs a udev rule that will load these program when the device +# is plugged in. +# +# After running this script, unplug and re-plug the device. +# +# To undo this script, run uninstall.sh with the same arguments. +# +# Options: +# --verbose ... print debug output +# --dry-run ... only print commands, do not install +# --prefix ... prefix for all files (default: /usr/local) +# --udevdir ... path to the udev directory to install rules and hwdb files in + # Generated by {{pipeline_url}} SCRIPT_DIR=$(dirname "$(realpath "${BASH_SOURCE[0]}")") PREFIX=/usr/local +BPFS=({% for bpf in bpfs %}"{{bpf.filename}}" {% endfor %}) + usage () { - echo "Usage: $(basename "$0") [-v|--verbose] [--dry-run] [--udevdir /etc/] [--prefix $PREFIX]" + # Prints anyhing from the first line that is '#\n' to the first empty line + sed -n -e '/^#$/,/^$/s/^#[ ]\?//p' "${BASH_SOURCE[0]}" } while [[ $# -gt 0 ]]; do diff --git a/.gitlab-ci/uninstall.sh.jinja b/.gitlab-ci/uninstall.sh.jinja index ec5c68faeb737646565d08cfe7e02b539280cce7..9a98e31d62d08ad82d11e1a5c22a8299534071b9 100755 --- a/.gitlab-ci/uninstall.sh.jinja +++ b/.gitlab-ci/uninstall.sh.jinja @@ -1,12 +1,28 @@ #!/usr/bin/env bash # +# Usage: uninstall.sh [-v|--verbose] [--dry-run] [--udevdir /etc/] [--prefix $PREFIX] +# +# Description: +# Uninstalls the BPF programs and udev rules previously installed by install.sh. +# For this script to work correctly, path arguments must match the paths +# provided to install.sh. +# +# After running this script, unplug and re-plug the device. +# +# Options: +# --verbose ... print debug output +# --dry-run ... only print commands, do not uninstall +# --prefix ... prefix for all files (default: /usr/local) +# --udevdir ... path to the udev directory to uninstall rules and hwdb files in + # Generated by {{pipeline_url}} SCRIPT_DIR=$(dirname "$(realpath "${BASH_SOURCE[0]}")") PREFIX=/usr/local usage () { - echo "Usage: $(basename "$0") [-v|--verbose] [--dry-run] [--udevdir /etc/] [--prefix $PREFIX]" + # Prints anyhing from the first line that is '#\n' to the first empty line + sed -n -e '/^#$/,/^$/s/^#[ ]\?//p' "${BASH_SOURCE[0]}" } while [[ $# -gt 0 ]]; do