Fixed up PHP notices. Added text when IP Address, MAC Address, and Subnet mask aren't found.

Also added function to backup configuration files /etc/network/interfaces and /etc/hostapd/hostapd.conf files if found.
This commit is contained in:
Lawrence
2017-10-01 20:54:16 +08:00
parent 97fd8dc13e
commit a36e525f98
2 changed files with 21 additions and 7 deletions

View File

@@ -83,6 +83,8 @@ function create_raspap_directories() {
sudo mv $raspap_dir $raspap_dir.original || install_error "Unable to move old '$raspap_dir' out of the way"
fi
sudo mkdir -p "$raspap_dir" || install_error "Unable to create directory '$raspap_dir'"
# Create a directory for existing file backups.
sudo mkdir -p "$raspap_dir/backups"
sudo chown -R $raspap_user:$raspap_user "$raspap_dir" || install_error "Unable to change file ownership for '$raspap_dir'"
}
@@ -108,6 +110,17 @@ function change_file_ownership() {
sudo chown -R $raspap_user:$raspap_user "$webroot_dir" || install_error "Unable to change file ownership for '$webroot_dir'"
}
# Check for existing /etc/network/interfaces and /etc/hostapd/hostapd.conf files
function check_for_old_configs() {
if [ -f /etc/network/interfaces ]; then
sudo mv /etc/network/interfaces "$raspap_dir/backups"
fi
if [ -f /etc/hostapd/hostapd.conf ]; then
sudo mv /etc/hostapd/hostapd.conf "$raspap_dir/backups"
fi
}
# Move configuration file to the correct location
function move_config_file() {
if [ ! -d "$raspap_dir" ]; then
@@ -178,6 +191,7 @@ function install_raspap() {
install_dependencies
enable_php_lighttpd
create_raspap_directories
check_for_old_configs
download_latest_files
change_file_ownership
move_config_file