Support unknown manufacturers in MOTD

This commit is contained in:
Joshua Boniface 2021-10-11 14:59:55 -04:00
parent 34a016bdac
commit cb6199ef0d
1 changed files with 5 additions and 3 deletions

View File

@ -18,9 +18,11 @@ else
echo >> $TMPFILE
fi
# Get machine information
echo "> \033[1;37mPVC node\033[0m on \033[1;31m$(
/usr/sbin/dmidecode | grep -A1 'Chassis Information' | tail -1 | awk -F':' '{print $2}' | tr -s ' '
)\033[0m hardware" >> $TMPFILE
MANUFACTURER="$( /usr/sbin/dmidecode | grep -A1 'Chassis Information' | tail -1 | awk -F':' '{print $2}' | tr -s ' ' )"
if [[ -z ${MANUFACTURER} ]]; then
MANUFACTURER='Unknown'
fi
echo "> \033[1;37mPVC node\033[0m on \033[1;31m${MANUFACTURER}\033[0m hardware" >> $TMPFILE
echo "> $(/bin/uname -srvmo)" >> $TMPFILE
mv $TMPFILE $TGTFILE || rm $TMPFILE