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

Add nmtui & nmcli prompt to 'myip' output when no IP address found #96 #122

Merged
Changes from 1 commit
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
11 changes: 9 additions & 2 deletions root/root/bin/myip
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#!/bin/bash
# Quick hack to get ip address, change to wrapper around python script.
ip a | grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])' | grep -v '127\|255' | sed -e "s/^/https:\/\//"
# Quick hack to get ip address.
MYIP=$(ip a | grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])' | grep -v '127\|255' | sed -e "s/^/https:\/\//")
if [[ $MYIP ]]
then
echo $MYIP
else
echo "No DHCP assigned IP address found."
phillxnet marked this conversation as resolved.
Show resolved Hide resolved
echo "Use 'nmtui' or 'nmcli' to set a static IP address."
fi