mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-21 23:20:22 +00:00
Merge pull request #123 from SirLagz/master
Updated Install/Uninstall scripts to resolve #120
This commit is contained in:
commit
6d9029340f
4 changed files with 36 additions and 25 deletions
|
@ -1,24 +0,0 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# rc.local
|
||||
#
|
||||
# This script is executed at the end of each multiuser runlevel.
|
||||
# Make sure that the script will "exit 0" on success or any other
|
||||
# value on error.
|
||||
#
|
||||
# In order to enable or disable this script just change the execution
|
||||
# bits.
|
||||
#
|
||||
# By default this script does nothing.
|
||||
|
||||
# Print the IP address
|
||||
_IP=$(hostname -I) || true
|
||||
if [ "$_IP" ]; then
|
||||
printf "My IP address is %s\n" "$_IP"
|
||||
fi
|
||||
|
||||
# Set up IP forwarding and NAT routing
|
||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||
iptables -t nat -A POSTROUTING -j MASQUERADE
|
||||
|
||||
exit 0
|
1
dist/css/custom.css
vendored
1
dist/css/custom.css
vendored
|
@ -37,6 +37,7 @@
|
|||
.webconsole {
|
||||
width:100%;
|
||||
height:100%;
|
||||
border:1px solid;
|
||||
}
|
||||
|
||||
#console {
|
||||
|
|
|
@ -132,6 +132,11 @@ function check_for_old_configs() {
|
|||
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"
|
||||
fi
|
||||
|
||||
if [ -f /etc/rc.local ]; then
|
||||
sudo cp /etc/rc.local "$raspap_dir/backups/rc.local.`date +%F-%R`"
|
||||
sudo ln -sf "$raspap_dir/backups/rc.local.`date +%F-%R`" "$raspap_dir/backups/rc.local"
|
||||
fi
|
||||
}
|
||||
|
||||
# Move configuration file to the correct location
|
||||
|
@ -155,7 +160,23 @@ function default_configuration() {
|
|||
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/dhcpcd.conf /etc/dhcpcd.conf || install_error "Unable to move dhcpcd configuration file"
|
||||
sudo mv $webroot_dir/config/rc.local /etc/rc.local || install_error "Unable to move rc.local file"
|
||||
# Generate required lines for Rasp AP to place into rc.local file.
|
||||
# #RASPAP is for removal script
|
||||
|
||||
lines=(
|
||||
'echo 1 > /proc/sys/net/ipv4/ip_forward #RASPAP'
|
||||
'iptables -t nat -A POSTROUTING -j MASQUERADE #RASPAP'
|
||||
)
|
||||
|
||||
|
||||
for line in "${lines[@]}"; do
|
||||
if grep "$line" /etc/rc.local > /dev/null; then
|
||||
echo "$line: Line already added"
|
||||
else
|
||||
sed -i "s/exit 0/$line\nexit0/" /etc/rc.local
|
||||
echo "Adding line $line"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Add a single entry to the sudoers file
|
||||
|
|
|
@ -63,10 +63,23 @@ function check_for_backups() {
|
|||
fi
|
||||
if [ -f "$raspap_dir/backups/dhcpcd.conf" ]; then
|
||||
echo -n "Restore the last dhcpcd.conf file? [y/N]: "
|
||||
read answer
|
||||
if [[ $answer -eq 'y' ]]; then
|
||||
sudo cp "$raspap_dir/backups/dhcpcd.conf" /etc/dhcpcd.conf
|
||||
fi
|
||||
fi
|
||||
if [ -f "$raspap_dir/backups/rc.local" ]; then
|
||||
echo -n "Restore the last rc.local file? [y/N]: "
|
||||
read answer
|
||||
if [[ $answer -eq 'y' ]]; then
|
||||
sudo cp "$raspap_dir/backups/rc.local" /etc/rc.local
|
||||
else
|
||||
echo -n "Remove RaspAP Lines from /etc/rc.local? [Y/n]: "
|
||||
if $answer -ne 'n' ]]; then
|
||||
sed -i '/#RASPAP/d' /etc/rc.local
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue