Support unknown manufacturers in MOTD

This commit is contained in:
Joshua Boniface 2023-09-01 15:42:27 -04:00
parent 55ec177919
commit 894ce9b517
1 changed files with 5 additions and 3 deletions

View File

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