65 lines
2.1 KiB
Bash
Executable File
65 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
. ./myserver.conf
|
|
|
|
install_pywallter_pkg(){
|
|
pkg_add py3-werkzeug py3-jinja2 py3-Pillow py3-wtforms py3-flask-wtf py3-flask \
|
|
py3-bcrypt py3-markdown py3-gevent py3-zopeinterface py3-pip
|
|
pip install flask-bcrypt
|
|
}
|
|
|
|
install_pywallter_app(){
|
|
orig_path=`pwd`
|
|
useradd -s /sbin/nologin -d /home/pywallter -m pywallter;
|
|
cd /home/pywallter;
|
|
su -m pywallter -c "git clone https://kitoy.me/git/kitoy/pywallter"
|
|
cp -v ./pywallter/scripts/set_mail_alias /usr/local/bin/
|
|
cp -v ./pywallter/scripts/set_mail_passwd /usr/local/bin/
|
|
|
|
touch /etc/mail/reserved
|
|
cd $orig_path
|
|
}
|
|
|
|
gen_pywallter_configuration_app(){
|
|
cat > my_configuration/pywallter/config.py <<EOF
|
|
BASE_URL="https://$pywallter_domain/"
|
|
SECRET_KEY="$pywallter_secret_key"
|
|
DOSSIER_APP = "./users/"
|
|
DATABASE = "./base.db"
|
|
EXT_IMG= {'.jpg', '.JPG', '.png', '.PNG', '.gif', '.GIF', '.bmp', '.BMP', '.jpeg', '.JPEG' }
|
|
SIGNIN_ENABLE = True
|
|
XMPP_SERVER = True
|
|
MAIL_SERVER = True
|
|
SETUID='doas'
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
gen_nginx_pywallter_app(){
|
|
cp -v default_configuration/pywallter/nginx.conf.sample my_configuration/pywallter/nginx.conf
|
|
sed -i "s/__pywallter_domain__/$pywallter_domain/g" my_configuration/pywallter/nginx.conf
|
|
}
|
|
|
|
install_pywallter_configuration_files(){
|
|
cp -v my_configuration/pywallter/config.py /home/pywallter/pywallter/
|
|
cp -v /home/pywallter/pywallter/scripts/etc/mailconfig /etc/
|
|
cp -v my_configuration/pywallter/nginx.conf /etc/nginx/sites-available/$pywallter_domain
|
|
ln -s /etc/nginx/sites-available/$pywallter_domain /etc/nginx/sites-enabled/$pywallter_domain
|
|
cp -v default_configuration/pywallter/pywallter.rc /etc/rc.d/pywallter
|
|
cp -v /etc/doas.conf /etc/doas.conf.old
|
|
egrep -v "pywallter" /etc/doas.conf > /tmp/doas.conf
|
|
cat >> /tmp/doas.conf <<EOF
|
|
permit nopass pywallter as root cmd set_mail_alias
|
|
permit nopass pywallter as root cmd set_mail_passwd
|
|
permit nopass pywallter as root cmd prosodyctl
|
|
EOF
|
|
mv /tmp/doas.conf /etc/doas/conf
|
|
}
|
|
|
|
mkdir my_configuration/pywallter/
|
|
gen_pywallter_configuration_app
|
|
gen_nginx_pywallter_app
|
|
install_pywallter_app
|
|
install_pywallter_configuration_files
|