|
|
|
@@ -1,4 +1,16 @@ |
|
|
|
#!/bin/bash |
|
|
|
#!/usr/bin/env bash |
|
|
|
|
|
|
|
NON_INTERACTIVE=false |
|
|
|
# params |
|
|
|
# non interactive |
|
|
|
while getopts y opt; do |
|
|
|
case $opt in |
|
|
|
y) NON_INTERACTIVE=true ;; |
|
|
|
*) echo 'error in command line parsing' >&2 |
|
|
|
exit 1 |
|
|
|
esac |
|
|
|
done |
|
|
|
shift $(expr $OPTIND - 1) |
|
|
|
|
|
|
|
DEFAULT_VOLUMES=/media/volumes |
|
|
|
PWD_GEN='< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;' |
|
|
|
@@ -30,119 +42,168 @@ while :; do |
|
|
|
fi |
|
|
|
done |
|
|
|
|
|
|
|
read -p "Volumes path ($DEFAULT_VOLUMES): " volumes |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "Volumes path ($DEFAULT_VOLUMES): " volumes |
|
|
|
fi |
|
|
|
if [[ ${#volumes} -eq 0 ]]; then |
|
|
|
volumes=$DEFAULT_VOLUMES |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "DB admin password (a random one will be generated if empty): " db_pwd |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "DB admin password (a random one will be generated if empty): " db_pwd |
|
|
|
fi |
|
|
|
if [[ ${#db_pwd} -eq 0 ]]; then |
|
|
|
db_pwd=`eval "$PWD_GEN"` |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "LDAP admin password (a random one will be generated if empty): " ldap_pwd |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "LDAP admin password (a random one will be generated if empty): " ldap_pwd |
|
|
|
fi |
|
|
|
if [[ ${#ldap_pwd} -eq 0 ]]; then |
|
|
|
ldap_pwd=`eval "$PWD_GEN"` |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "LDAP Mail Bind DN uid ($DEFAULT_LDAP_MAIL_UID): " ldap_mail_uid |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "LDAP Mail Bind DN uid ($DEFAULT_LDAP_MAIL_UID): " ldap_mail_uid |
|
|
|
fi |
|
|
|
if [[ ${#ldap_mail_uid} -eq 0 ]]; then |
|
|
|
ldap_mail_uid=$DEFAULT_LDAP_MAIL_UID |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "LDAP Mail Bind DN Pwd (a random one will be generated if empty): " ldap_mail_pwd |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "LDAP Mail Bind DN Pwd (a random one will be generated if empty): " ldap_mail_pwd |
|
|
|
fi |
|
|
|
if [[ ${#ldap_mail_pwd} -eq 0 ]]; then |
|
|
|
ldap_mail_pwd=`eval "$PWD_GEN"` |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "LDAP Nextcloud Bind DN uid ($DEFAULT_LDAP_NEXTCLOUD_UID): " ldap_nextcloud_uid |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "LDAP Nextcloud Bind DN uid ($DEFAULT_LDAP_NEXTCLOUD_UID): " ldap_nextcloud_uid |
|
|
|
fi |
|
|
|
if [[ ${#ldap_nextcloud_uid} -eq 0 ]]; then |
|
|
|
ldap_nextcloud_uid=$DEFAULT_LDAP_NEXTCLOUD_UID |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "LDAP Nextcloud Bind DN Pwd (a random one will be generated if empty): " ldap_nextcloud_pwd |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "LDAP Nextcloud Bind DN Pwd (a random one will be generated if empty): " ldap_nextcloud_pwd |
|
|
|
fi |
|
|
|
if [[ ${#ldap_nextcloud_pwd} -eq 0 ]]; then |
|
|
|
ldap_nextcloud_pwd=`eval "$PWD_GEN"` |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "LDAP Gitea Bind DN uid ($DEFAULT_LDAP_GITEA_UID): " ldap_gitea_uid |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "LDAP Gitea Bind DN uid ($DEFAULT_LDAP_GITEA_UID): " ldap_gitea_uid |
|
|
|
fi |
|
|
|
if [[ ${#ldap_gitea_uid} -eq 0 ]]; then |
|
|
|
ldap_gitea_uid=$DEFAULT_LDAP_GITEA_UID |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "LDAP Gitea Bind DN Pwd (a random one will be generated if empty): " ldap_gitea_pwd |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "LDAP Gitea Bind DN Pwd (a random one will be generated if empty): " ldap_gitea_pwd |
|
|
|
fi |
|
|
|
if [[ ${#ldap_gitea_pwd} -eq 0 ]]; then |
|
|
|
ldap_gitea_pwd=`eval "$PWD_GEN"` |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "LDAP Hauk Bind DN uid ($DEFAULT_LDAP_HAUK_UID): " ldap_hauk_uid |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "LDAP Hauk Bind DN uid ($DEFAULT_LDAP_HAUK_UID): " ldap_hauk_uid |
|
|
|
fi |
|
|
|
if [[ ${#ldap_hauk_uid} -eq 0 ]]; then |
|
|
|
ldap_hauk_uid=$DEFAULT_LDAP_HAUK_UID |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "LDAP Hauk Bind DN Pwd (a random one will be generated if empty): " ldap_hauk_pwd |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "LDAP Hauk Bind DN Pwd (a random one will be generated if empty): " ldap_hauk_pwd |
|
|
|
fi |
|
|
|
if [[ ${#ldap_hauk_pwd} -eq 0 ]]; then |
|
|
|
ldap_hauk_pwd=`eval "$PWD_GEN"` |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "Nextcloud Admin User Pwd (a random one will be generated if empty): " nextcloud_admin_pwd |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "Nextcloud Admin User Pwd (a random one will be generated if empty): " nextcloud_admin_pwd |
|
|
|
fi |
|
|
|
if [[ ${#nextcloud_admin_pwd} -eq 0 ]]; then |
|
|
|
nextcloud_admin_pwd=`eval "$PWD_GEN"` |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "Gitea Admin User Pwd (a random one will be generated if empty): " gitea_admin_pwd |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "Gitea Admin User Pwd (a random one will be generated if empty): " gitea_admin_pwd |
|
|
|
fi |
|
|
|
if [[ ${#gitea_admin_pwd} -eq 0 ]]; then |
|
|
|
gitea_admin_pwd=`eval "$PWD_GEN"` |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "Hauk Server Pwd (a random one will be generated if empty): " hauk_server_pwd |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "Hauk Server Pwd (a random one will be generated if empty): " hauk_server_pwd |
|
|
|
fi |
|
|
|
if [[ ${#hauk_server_pwd} -eq 0 ]]; then |
|
|
|
hauk_server_pwd=`eval "$PWD_GEN"` |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "Pi-Hole Web User Pwd (a random one will be generated if empty): " pihole_web_pwd |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "Pi-Hole Web User Pwd (a random one will be generated if empty): " pihole_web_pwd |
|
|
|
fi |
|
|
|
if [[ ${#pihole_web_pwd} -eq 0 ]]; then |
|
|
|
pihole_web_pwd=`eval "$PWD_GEN"` |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "Admin E-mail, used for Let's Encrypt account and more (admin@${domain}): " admin_email |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "Admin E-mail, used for Let's Encrypt account and more (admin@${domain}): " admin_email |
|
|
|
fi |
|
|
|
if [[ ${#admin_email} -eq 0 ]]; then |
|
|
|
admin_email=admin@${domain} |
|
|
|
fi |
|
|
|
|
|
|
|
echo "If you have a password salt and a secret from a previous installation, provide them here." |
|
|
|
echo "They are used by Passman and need to remain the same for the vaults to be accessible" |
|
|
|
read -p "Nextcloud Pwd Salt (a random one will be generated by NC if empty): " nextcloud_salt |
|
|
|
read -p "Nextcloud Secret (a random one will be generated by NC if empty): " nextcloud_secret |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "Nextcloud Pwd Salt (a random one will be generated by NC if empty): " nextcloud_salt |
|
|
|
fi |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "Nextcloud Secret (a random one will be generated by NC if empty): " nextcloud_secret |
|
|
|
fi |
|
|
|
|
|
|
|
# read -p "Paperless Web Server User (paperless): " paperless_webserver_user |
|
|
|
# if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
# read -p "Paperless Web Server User (paperless): " paperless_webserver_user |
|
|
|
# fi |
|
|
|
# if [[ ${#paperless_webserver_user} -eq 0 ]]; then |
|
|
|
# paperless_webserver_user=paperless |
|
|
|
# fi |
|
|
|
|
|
|
|
# read -p "Paperless Web Server Pwd (a random one will be generated if empty): " paperless_webserver_pwd |
|
|
|
# if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
# read -p "Paperless Web Server Pwd (a random one will be generated if empty): " paperless_webserver_pwd |
|
|
|
# fi |
|
|
|
# if [[ ${#paperless_webserver_pwd} -eq 0 ]]; then |
|
|
|
# paperless_webserver_pwd=`eval "$PWD_GEN"` |
|
|
|
# fi |
|
|
|
|
|
|
|
# read -p "Paperless Encryption Passphrase (a random one will be generated if empty): " paperless_passphrase |
|
|
|
# if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
# read -p "Paperless Encryption Passphrase (a random one will be generated if empty): " paperless_passphrase |
|
|
|
# fi |
|
|
|
# if [[ ${#paperless_passphrase} -eq 0 ]]; then |
|
|
|
# paperless_=`eval "$PWD_GEN"` |
|
|
|
# fi |
|
|
|
|
|
|
|
read -p "SFTP User - SFTP server is used by paperless (consume): " paperless_ftp_user |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "SFTP User - SFTP server is used by paperless (consume): " paperless_ftp_user |
|
|
|
fi |
|
|
|
if [[ ${#paperless_ftp_user} -eq 0 ]]; then |
|
|
|
paperless_ftp_user=consume |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "SFTP Pwd (a random one will be generated if empty): " paperless_ftp_pwd |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "SFTP Pwd (a random one will be generated if empty): " paperless_ftp_pwd |
|
|
|
fi |
|
|
|
if [[ ${#paperless_ftp_pwd} -eq 0 ]]; then |
|
|
|
paperless_ftp_pwd=`eval "$PWD_GEN"` |
|
|
|
fi |
|
|
|
|
|
|
|
read -p "Blog 1 URL (https://blog.${domain})" blog_1_url |
|
|
|
if [[ ${NON_INTERACTIVE} = false ]]; then |
|
|
|
read -p "Blog 1 URL (https://blog.${domain})" blog_1_url |
|
|
|
fi |
|
|
|
if [[ ${#blog_1_url} -eq 0 ]]; then |
|
|
|
blog_1_url=https://blog.${domain} |
|
|
|
#blog_1_url=https://blog.${domain} |
|
|
|
blog_1_url=blog.${domain} |
|
|
|
fi |
|
|
|
|
|
|
|
echo $'\E[33m' |
|
|
|
@@ -220,7 +281,7 @@ sed -i "s/\${PIHOLE_WEB_PWD}/${pihole_web_pwd}/g" pihole.env |
|
|
|
|
|
|
|
# IP for Pi-Hole |
|
|
|
IP_LOOKUP="$(ip route get 8.8.8.8 | awk '{ print $NF; exit }')" # May not work for VPN / tun0 |
|
|
|
IPv6_LOOKUP="$(ip -6 route get 2001:4860:4860::8888 | awk '{for(i=1;i<=NF;i++) if ($i=="src") print $(i+1)}')" # May not work for VPN / tun0 |
|
|
|
#IPv6_LOOKUP="$(ip -6 route get 2001:4860:4860::8888 | awk '{for(i=1;i<=NF;i++) if ($i=="src") print $(i+1)}')" # May not work for VPN / tun0 |
|
|
|
|
|
|
|
for i in `ls *.env .env`; do |
|
|
|
sed -i "s/\${DOMAIN}/${domain}/g" $i |
|
|
|
@@ -236,7 +297,7 @@ for i in `ls *.env .env`; do |
|
|
|
sed -i "s/\${PAPERLESS_WEBSERVER_USER}/${paperless_webserver_user}/g" $i |
|
|
|
sed -i "s/\${PAPERLESS_FTP_USER}/${paperless_ftp_user}/g" $i |
|
|
|
sed -i "s/\${IP_LOOKUP}/${IP_LOOKUP}/g" $i |
|
|
|
sed -i "s/\${IPv6_LOOKUP}/${IPv6_LOOKUP}/g" $i |
|
|
|
#sed -i "s/\${IPv6_LOOKUP}/${IPv6_LOOKUP}/g" $i |
|
|
|
sed -i "s/\${BLOG_1_URL}/${blog_1_url}/g" $i |
|
|
|
#sed -i "s/\${}/${}/g" $i |
|
|
|
done; |
|
|
|
@@ -249,8 +310,9 @@ for i in `ls *.env`; do |
|
|
|
echo "" >> $i |
|
|
|
echo "# Domains" >> $i |
|
|
|
echo "DOMAIN=${DOMAIN}" >> $i |
|
|
|
echo "VIRTUAL_DOMAINS=${VIRTUAL_DOMAINS}" >> $i |
|
|
|
echo "DOMAINS=${DOMAINS}" >> $i |
|
|
|
echo "VIRTUAL_DOMAINS=\"${VIRTUAL_DOMAINS}\"" >> $i |
|
|
|
echo "DOMAINS=\"${DOMAINS}\"" |
|
|
|
echo "DOMAINS=\"${DOMAINS}\"" >> $i |
|
|
|
done |
|
|
|
|
|
|
|
echo "" >> mail.env |