fix envs_toot

This commit is contained in:
creme 2020-02-09 15:00:30 +00:00
parent 9da351875b
commit 0dfad1e52d
1 changed files with 13 additions and 11 deletions

View File

@ -1,8 +1,4 @@
#!/usr/bin/env sh
if [ "$(id -u)" -ne 0 ] || [ "$(id -u)" -ne 10000 ]; then
printf 'sorry only root and creme can toot as envs.\n' && exit 1
fi
#!/usr/bin/env bash
print_usage() {
printf 'usage: envs_toot "your message"\n\n'
@ -10,14 +6,20 @@ print_usage() {
exit 1
}
printf 'mastodon-toot as envs.net\n\n'
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
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
printf 'sorry only root and creme can toot as envs.\n' && exit 1
fi
exit 0