--
This commit is contained in:
45
prep.sh
Normal file
45
prep.sh
Normal file
@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
. ---
|
||||
|
||||
pbo="-k $dns_porkbun_key -s $dns_porkbun_secret"
|
||||
domain=${DOMAIN:-xolatile.top}
|
||||
|
||||
nginx() {
|
||||
user=$1
|
||||
echo -e \
|
||||
"server {\n" \
|
||||
" server_name $user.$domain;\n" \
|
||||
" root /home/$user/www;\n" \
|
||||
" location / {\n" \
|
||||
" index index.html;\n" \
|
||||
" autoindex on;\n" \
|
||||
" }\n" \
|
||||
" include $domain.base;\n" \
|
||||
"}"
|
||||
}
|
||||
|
||||
dns() {
|
||||
user=$1
|
||||
echo pkb-client $pbo create-dns-record xolatile.top ALIAS --name $user --ttl 86400 $domain
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"regen" ) x=3 ;;
|
||||
"dns" ) x=2 ;;
|
||||
"nginx" ) x=1 ;;
|
||||
* ) x=0 ;;
|
||||
esac
|
||||
|
||||
shift
|
||||
if [[ $x = 0 ]] ; then
|
||||
echo -e \
|
||||
'Need one of:\n'\
|
||||
'regen [(/home/($users))+]\n' \
|
||||
'dns [(/home/($users))+]\n' \
|
||||
'nginx [(/home/($users))+]'
|
||||
else
|
||||
for user in $@ ; do
|
||||
[ $(( $x & 2 )) = 2 ] && dns $user
|
||||
[ $(( $x & 1 )) = 1 ] && nginx $user
|
||||
done
|
||||
fi
|
Reference in New Issue
Block a user