Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Install/Uninstall scripts to resolve #120 #123

Merged
merged 3 commits into from
Oct 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions config/rc.local

This file was deleted.

1 change: 1 addition & 0 deletions dist/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
.webconsole {
width:100%;
height:100%;
border:1px solid;
}

#console {
Expand Down
23 changes: 22 additions & 1 deletion installers/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
13 changes: 13 additions & 0 deletions installers/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down