-
-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply static IP changes without a reboot (#1723)
Related tiny-pilot/tinypilot-pro#1172 This PR introduces the `apply-static-ip` script that replaces the use of `reboot` to allow the static IP settings to take effect. This code was originally reviewed in tiny-pilot/tinypilot-pro#1175 before being backported here. <a data-ca-tag href="https://codeapprove.com/pr/tiny-pilot/tinypilot/1723"><img src="https://codeapprove.com/external/github-tag-allbg.png" alt="Review on CodeApprove" /></a>
- Loading branch information
1 parent
88cf332
commit 13d1b53
Showing
3 changed files
with
28 additions
and
8 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
debian-pkg/opt/tinypilot-privileged/scripts/apply-static-ip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
# | ||
# Immediately apply the current static IP config to the device. | ||
|
||
# Exit on first failure. | ||
set -e | ||
|
||
# Echo commands before executing them, by default to stderr. | ||
set -x | ||
|
||
# Exit on unset variable. | ||
set -u | ||
|
||
# Ignore hangup signals to avoid exiting the shell when the network interface | ||
# is flushed and a new IP is assigned. This was an issue when running the script | ||
# manually via a remote shell. | ||
trap '' HUP | ||
ip address flush dev eth0 | ||
systemctl restart \ | ||
dhcpcd.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters