ops/bin/envs_toot

26 lines
529 B
Bash
Executable File

#!/usr/bin/env bash
print_usage() {
printf 'usage: envs_toot "your message"\n\n'
printf 'sample output:\nusername | your message\n'
exit 1
}
if [ "$(id -u)" -eq 0 ] || [ "$(id -u)" -eq 10000 ] ; then
printf 'mastodon-toot as envs.net\n\n'
if [ "$1" = '-h' ] || [ "$1" = '--help' ] || [ "$1" = '?' ]; then
print_usage
elif [ -n "$1" ] && [ -z "$2" ]; then
sudo -u services /usr/bin/toot post "$(id -un) | $1"
else
print_usage
fi
else
printf 'sorry only root and creme can toot as envs.\n' && exit 1
fi
exit 0