forked from team/makeuser
functions moved to include/functions
This commit is contained in:
parent
f3a9e42163
commit
9026f181f8
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
#Common functions used for several makeuser scripts
|
||||
|
||||
error_exit() {
|
||||
echo -e "${PROGNAME}: ${1:-"Unknown Error"}" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo -e "usage: $PROGNAME [-h|--help] <username> <email> \"<pubkey>\""
|
||||
}
|
||||
|
||||
sub_to_list() {
|
||||
echo "From: $1 Subject: subscribe" | sudo -u $1 mail $LIST_NAME
|
||||
}
|
16
makeuser
16
makeuser
|
@ -12,21 +12,7 @@ CONFIG=./setenv
|
|||
|
||||
. $CONFIG
|
||||
|
||||
error_exit() {
|
||||
echo -e "${PROGNAME}: ${1:-"Unknown Error"}" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo -e "usage: $PROGNAME [-h|--help] <username> <email> \"<pubkey>\""
|
||||
}
|
||||
|
||||
sub_to_list() {
|
||||
echo "
|
||||
From: $1
|
||||
Subject: subscribe
|
||||
" | sudo -u $1 mail $LIST_NAME
|
||||
}
|
||||
source include/functions
|
||||
|
||||
[[ $(id -u) == 0 ]] && error_exit "Do not run this script as root."
|
||||
|
||||
|
|
|
@ -11,21 +11,7 @@ CONFIG=./setenv
|
|||
|
||||
. $CONFIG
|
||||
|
||||
error_exit() {
|
||||
echo -e "${PROGNAME}: ${1:-"Unknown Error"}" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo -e "usage: $PROGNAME [-h|--help] <username> <email> \"<pubkey>\""
|
||||
}
|
||||
|
||||
sub_to_list() {
|
||||
echo "
|
||||
From: $1
|
||||
Subject: subscribe
|
||||
" | sudo -u $1 mail $LIST_NAME
|
||||
}
|
||||
source include/functions
|
||||
|
||||
[[ $(id -u) == 0 ]] && error_exit "Do not run this script as root."
|
||||
|
||||
|
|
Loading…
Reference in New Issue