fix: refs #7735 MOTD updated and fixes

This commit is contained in:
Juan Ferrer 2024-09-08 16:40:23 +02:00
parent eb08a7f164
commit b6d7ca1590
1 changed files with 15 additions and 18 deletions

View File

@ -1,6 +1,3 @@
#!/bin/sh
uname -snrvm
root@dhcp1:/etc/dhcp/subnets# cat /etc/update-motd.d/90-vn
#!/bin/bash #!/bin/bash
LABEL="\033[0;32m" LABEL="\033[0;32m"
@ -25,10 +22,10 @@ case "$FQDN" in
ENVIRONMENT="${LAB}Laboratory${RESET}" ENVIRONMENT="${LAB}Laboratory${RESET}"
;; ;;
*.verdnatura.es) *.verdnatura.es)
ENVIRONMENT="-" ENVIRONMENT="${UNKNOWN}Unknown${RESET}"
;; ;;
*) *)
ENVIRONMENT="${UNKNOWN}Unknown${RESET}" ENVIRONMENT="-"
;; ;;
esac esac
@ -50,10 +47,10 @@ USER_UID=$(id -u $USER)
USER_GROUPS=$(id -Gn $USER) USER_GROUPS=$(id -Gn $USER)
if [ ${USER_UID} -eq 0 ] ; then if [ ${USER_UID} -eq 0 ] ; then
SHOW_UPGRADEABLE=1 SHOW_UPGRADEABLE=1
fi fi
if [[ "${USER_GROUPS}" == *"sysadmin"* ]] ; then if [[ "${USER_GROUPS}" == *"sysadmin"* ]] ; then
SHOW_UPGRADEABLE=1 SHOW_UPGRADEABLE=1
fi fi
if [ $SHOW_UPGRADEABLE -eq 1 ] ; then if [ $SHOW_UPGRADEABLE -eq 1 ] ; then
UPGRADEABLE="$(apt list --upgradable 2>/dev/null | tail -n +2 | wc -l)" UPGRADEABLE="$(apt list --upgradable 2>/dev/null | tail -n +2 | wc -l)"
@ -77,15 +74,15 @@ GL="\e[48;5;70m"
RS="\e[0m" RS="\e[0m"
echo -e echo -e
echo -e " $GL $GB $RS" echo -e " $GL $GB $RS"
echo -e " $GL $GB $GL $RS $GL $GB $RS" " ${FW}__ __ _ ${FG} _ _ _ ${RS}" echo -e " $GL $GB $GL $RS $GL $GB $RS" " ${FW}__ __ _ ${FG} _ _ _ ${RS}"
echo -e " $GB $GL $RS $GL $GB $GL $RS" " ${FW}\ \ / /__ _ __ __| |${FG}| \ | | __ _| |_ _ _ _ __ __ _ ${RS}" echo -e " $GB $GL $RS $GL $GB $GL $RS" " ${FW}\ \ / /__ _ __ __| |${FG}| \ | | __ _| |_ _ _ _ __ __ _ ${RS}"
echo -e " $GL $GB $RS $GB $GL $RS " " ${FW} \ \ / / _ \ '__/ _' |${FG}| \| |/ _' | __| | | | '__/ _' |${RS}" echo -e " $GL $GB $RS $GB $GL $RS " " ${FW} \ \ / / _ \ '__/ _' |${FG}| \| |/ _' | __| | | | '__/ _' |${RS}"
echo -e " $GL $GB $RS $GB $GL $RS " " ${FW} \ V / __/ | | (_| |${FG}| |\ | (_| | |_| |_| | | | (_| |${RS}" echo -e " $GL $GB $RS $GB $GL $RS " " ${FW} \ V / __/ | | (_| |${FG}| |\ | (_| | |_| |_| | | | (_| |${RS}"
echo -e " " " ${FW} \_/ \___|_| \__,_|${FG}|_| \_|\__,_|\__|\__,_|_| \__,_|${RS}" echo -e " " " ${FW} \_/ \___|_| \__,_|${FG}|_| \_|\__,_|\__|\__,_|_| \__,_|${RS}"
echo -e " $GL $GB $RS $GB $GL $RS" echo -e " $GL $GB $RS $GB $GL $RS"
echo -e " $GL $GB $GL $RS $GL $GB $RS" echo -e " $GL $GB $GL $RS $GL $GB $RS"
echo -e " $GB $GL $RS" echo -e " $GB $GL $RS"
echo -e echo -e
# Information # Information