From bf9ec17c84792bf5efd870462abae90c86b9a8ee Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Fri, 5 Apr 2019 06:02:13 +0100 Subject: [PATCH] etc/profile.d/net.sh --- etc/profile.d/net.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/etc/profile.d/net.sh b/etc/profile.d/net.sh index ccd7565e..c0ab149c 100644 --- a/etc/profile.d/net.sh +++ b/etc/profile.d/net.sh @@ -1,3 +1,13 @@ +net_str2mac() { + ( + [ -n "$1" ] && echo "$1" || dd if=/dev/urandom bs=1024 count=1 2>/dev/null + ) | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/' + #locale str=${1:-"$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null)"} + #local str="$1" + #[ -n "$str" ] || str="$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null)" + #echo "$str" | wc -c +} + net_gateway_ip() { case "$OSTYPE" in darwin*) netstat -nr -f inet | awk '$1=="default"{print $2; exit}' ;; -- 2.47.3