diff --git a/config/dnsmasq.conf b/config/dnsmasq.conf index c8e54c9..4a0b150 100644 --- a/config/dnsmasq.conf +++ b/config/dnsmasq.conf @@ -10,3 +10,4 @@ server=/loki/127.3.2.1 server=/snode/127.3.2.1 server=127.0.0.1 server=1.1.1.1 +addn-hosts=/etc/dnsmasq.hosts diff --git a/config/dnsmasq.hosts b/config/dnsmasq.hosts new file mode 100644 index 0000000..4a6113e --- /dev/null +++ b/config/dnsmasq.hosts @@ -0,0 +1 @@ +10.3.141.1 loki.ap.com diff --git a/installers/common.sh b/installers/common.sh index 7790ae2..734d208 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -190,6 +190,11 @@ function check_for_old_configs() { sudo ln -sf "$raspap_dir/backups/dnsmasq.conf.`date +%F-%R`" "$raspap_dir/backups/dnsmasq.conf" fi + if [ -f /etc/dnsmasq.hosts ]; then + sudo cp /etc/dnsmasq.hosts "$raspap_dir/backups/dnsmasq.hosts.`date +%F-%R`" + sudo ln -sf "$raspap_dir/backups/dnsmasq.hosts.`date +%F-%R`" "$raspap_dir/backups/dnsmasq.hosts" + fi + if [ -f /etc/dhcpcd.conf ]; then sudo cp /etc/dhcpcd.conf "$raspap_dir/backups/dhcpcd.conf.`date +%F-%R`" sudo ln -sf "$raspap_dir/backups/dhcpcd.conf.`date +%F-%R`" "$raspap_dir/backups/dhcpcd.conf" @@ -243,6 +248,7 @@ function default_configuration() { sudo mv $webroot_dir/config/default_hostapd /etc/default/hostapd || install_error "Unable to move hostapd defaults file" sudo mv $webroot_dir/config/hostapd.conf /etc/hostapd/hostapd.conf || install_error "Unable to move hostapd configuration file" sudo mv $webroot_dir/config/dnsmasq.conf /etc/dnsmasq.conf || install_error "Unable to move dnsmasq configuration file" + sudo mv $webroot_dir/config/dnsmasq.hosts /etc/dnsmasq.hosts || install_error "unable to move dnsmasq hosts file" sudo mv $webroot_dir/config/dhcpcd.conf /etc/dhcpcd.conf || install_error "Unable to move dhcpcd configuration file" sudo mv $webroot_dir/config/head /etc/resolvconf/resolv.conf.d/head || install_error "Unable to move resolvconf head file" sudo mv $webroot_dir/config/nftables.conf /etc/nftables.conf || install_error "unable to move nftables configuration file" diff --git a/installers/uninstall.sh b/installers/uninstall.sh index bcf74c1..8027354 100755 --- a/installers/uninstall.sh +++ b/installers/uninstall.sh @@ -3,19 +3,19 @@ raspap_dir="/etc/raspap" raspap_user="www-data" version=`sed 's/\..*//' /etc/debian_version` -# Determine version and set default home location for lighttpd -webroot_dir="/var/www/html" -if [ $version -eq 9 ]; then - version_msg="Raspian 9.0 (Stretch)" - php_package="php7.0-cgi" -elif [ $version -eq 8 ]; then - version_msg="Raspian 8.0 (Jessie)" - webroot_dir="/var/www" - php_package="php5-cgi" -else +# Determine version and set default home location for lighttpd +webroot_dir="/var/www/html" +if [ $version -eq 9 ]; then + version_msg="Raspian 9.0 (Stretch)" + php_package="php7.0-cgi" +elif [ $version -eq 8 ]; then + version_msg="Raspian 8.0 (Jessie)" + webroot_dir="/var/www" + php_package="php5-cgi" +else version_msg="Raspian earlier than 8.0 (Wheezy)" - webroot_dir="/var/www" - php_package="php5-cgi" + webroot_dir="/var/www" + php_package="php5-cgi" fi phpcgiconf="" @@ -40,7 +40,7 @@ function install_error() { # Checks to make sure uninstallation info is correct function config_uninstallation() { install_log "Configure installation" - echo "Detected ${version_msg}" + echo "Detected ${version_msg}" echo "Install directory: ${raspap_dir}" echo "Lighttpd directory: ${webroot_dir}" echo -n "Uninstall RaspAP with these values? [y/N]: " @@ -74,6 +74,14 @@ function check_for_backups() { if [[ $answer -eq 'y' ]]; then sudo cp "$raspap_dir/backups/dnsmasq.conf" /etc/dnsmasq.conf fi + + if [ -f "$raspap_dir/backups/dnsmasq.hosts" ]; then + echo -n "Restore the last dnsmasq hosts file? [y/N]: " + read answer + if [[ $answer -eq 'y' ]]; then + sudo cp "$raspap_dir/backups/dnsmasq.hosts" /etc/dnsmasq.hosts + fi + fi if [ -f "$raspap_dir/backups/dhcpcd.conf" ]; then echo -n "Restore the last dhcpcd.conf file? [y/N]: "