sub new users to the mailing list

This commit is contained in:
Ben Harris 2018-12-14 20:29:03 -05:00
parent 1750d636bd
commit 8b3957cfbd
1 changed files with 8 additions and 0 deletions

View File

@ -16,6 +16,13 @@ usage() {
echo -e "usage: $PROGNAME [-h|--help] <username> <email> \"<pubkey>\""
}
sub_to_list() {
echo "
From: $1
Subject: subscribe
" | sudo -u $1 sendmail tildeteam-join@lists.tildeverse.org
}
[[ $(id -u) != 0 ]] && error_exit "you must be the superuser to run this script."
case $1 in
@ -31,6 +38,7 @@ case $1 in
useradd -m -g 100 -p $pwcrypt -s /bin/bash $1 || exit 1
sed -e "s/newusername/$1/g" -e "s/newpassword/$newpw/" email.tmpl | sendmail $1 $2 sudoers@tilde.team
sub_to_list $1
echo "$3" | tee /home/$1/.ssh/authorized_keys
toot "welcome new user ~$1!" ;;