Last active
August 29, 2015 13:56
-
-
Save anderiv/9253519 to your computer and use it in GitHub Desktop.
Add eth0 IP address to the system login prompt.
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
#!/bin/sh | |
# Save this file as /etc/network/if-up.d/mod-etc-issue and chmod +x | |
if [ "$METHOD" = loopback ]; then | |
exit 0 | |
fi | |
# Only run from ifup. | |
if [ "$MODE" != start ]; then | |
exit 0 | |
fi | |
IPADDR=`ip a s eth0 | grep inet | awk '{ print $2 }' | head -1` | |
# First time, back up /etc/issue | |
if [ ! -f /etc/issue.orig ] | |
then | |
cp /etc/issue /etc/issue.orig | |
fi | |
# "Reset" /etc/issue to original state | |
cp /etc/issue.orig /etc/issue | |
# Append IP address to /etc/issue | |
echo "eth0 address: $IPADDR" >> /etc/issue | |
echo "" >> /etc/issue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment