Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save qgp9/8db64ca37af97bc6b1fbc084cea97482 to your computer and use it in GitHub Desktop.
Save qgp9/8db64ca37af97bc6b1fbc084cea97482 to your computer and use it in GitHub Desktop.
sample
#!/bin/bash
function ensure_privileged_or_exit() {
local cap_mask="0x00000007ffffffff"
local cap_bnd=0x$(grep ^CapBnd /proc/self/status | awk '{print $2}')
if [[ $(($cap_mask & $cap_bnd )) != $(($cap_mask)) ]]; then
echo -e "[ERROR] Run with --privileged option."
exit 1
fi
}
### Main
ensure_privileged_or_exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment