!/bin/bash echo "### ownDynDNS configuration script" # set variables scriptversion="1.3.1" wwwuserd="www-data" wwwgroupd="www-data" defaultenvfile=".env.dist" dir=$(pwd) while [ ! -f $dir/$defaultenvfile ] do echo "current directory does not contain ${defaultenvfile} !" read -p "enter directory where ownDynDNS is located: " dir done # source .env.dist source $dir/$defaultenvfile envfile="${dir}/.env" log1="$logFile" log2="/var/log/dnsupdater/log.json" ### main script #echo "found ${defaultenvfile}. using current directory" read -p "enter a custom username for dns updates [random]: " user user=${user:-$(tr -dc A-Za-z0-9 $htaccess << EOM Order allow,deny Deny from all EOM rm .htaccess.example ;; 3) mv .htaccess{.example,} ;; *) rm .htaccess.example ;; esac ### nginx htaccess equivalent message echo "if you are using nginx please read the docs about how to disable access to certain files and folders.\nyou might add a location block to the beginning of your site config as follows:" echo -e " location ~* (env|log|json) {\n deny all;\n return 404;\n }" ### create the .env file if [ -f $envfile ] then echo "${envfile} already exists!" read -p "overwrite? [y/N]: " overwrite if [[ ! ${overwrite,,::1} == y ]] then echo "script cancelled. exiting" exit 1 fi fi #echo "creating .env file" touch $envfile echo "# file created at $(date)" >$envfile echo "# by configuration script version ${scriptversion}" >> $envfile echo "username=\"${user}\"" >> $envfile echo "password=\"${pass}\"" >> $envfile echo "apiKey=\"${apikey}\"" >> $envfile echo "apiPassword=\"${apipass}\"" >> $envfile echo "customerId=\"${custid}\"" >> $envfile echo "debug=${debug}" >> $envfile echo "log=${log}" >> $envfile echo "logFile=${logfile}" >> $envfile echo "created .env file at: ${envfile}"