Skip to content

Commit

Permalink
semi-automated PD on raspbian scripts: fix the issue where 'mv' comma…
Browse files Browse the repository at this point in the history
…nd permanently removes the hook files
  • Loading branch information
yangsong-cnyn committed Sep 26, 2024
1 parent 702d768 commit db5599a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions script/_dhcpv6_pd_ref
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,24 @@ EOF
# EOF
# }

dhcp6_pd_ref_stop()
dhcpv6_pd_ref_stop()
{
if [[ -f "/etc/dhcpcd.conf.orig" ]]; then
sudo mv /etc/dhcpcd.conf.orig /etc/dhcpcd.conf
fi
# sudo systemctl restart dhcpcd
sudo rm /etc/dhcpcd.enter-hook /etc/dhcpcd.exit-hook
sudo rm -f /etc/dhcpcd.enter-hook /etc/dhcpcd.exit-hook

}

dhcp6_pd_ref_start()
dhcpv6_pd_ref_start()
{
if [[ -f "/etc/dhcpcd.conf" ]]; then
sudo mv /etc/dhcpcd.conf /etc/dhcpcd.conf.orig
fi
customise_dhcpcd_conf
# Add dhcpcd.hooks
sudo mv ~/repo/script/reference-device/dhcpcd.enter-hook /etc/dhcpcd.enter-hook
sudo mv ~/repo/script/reference-device/dhcpcd.exit-hook /etc/dhcpcd.exit-hook
sudo chmod +x /etc/dhcpcd.enter-hook /etc/dhcpcd.exit-hook
sudo install -m 755 "$(dirname "$0")"/reference-device/dhcpcd.enter-hook /etc/dhcpcd.enter-hook
sudo install -m 755 "$(dirname "$0")"/reference-device/dhcpcd.exit-hook /etc/dhcpcd.exit-hook

}

dhcp6_pd_ref "$@"

0 comments on commit db5599a

Please sign in to comment.