This repository has been archived on 2025-12-03. You can view files and clone it, but cannot push or open issues or pull requests.
linux/mod/mod_motd
2025-02-10 12:19:14 -03:00

50 lines
1.4 KiB
Bash

#!/bin/bash
_cyan(){ /bin/echo -e "\033[0;36m$@\033[0m"; }
_yellow(){ /bin/echo -e "\033[0;33m$@\033[0m"; }
_green(){ /bin/echo -e "\033[0;32m$@\033[0m"; }
_red(){ /bin/echo -e "\033[0;31m$@\033[0m"; }
_success(){ /bin/echo -en "\x1B[97m[\033[1;32m OK \033[0m\x1B[97m]\033[0m "; /bin/echo -e "$1"; }
_failure(){ /bin/echo -en "\033[41m\e[5m\033[1;38m FAILED \033[0m "; /bin/echo -e "$1"; }
DEPENDENCIAS=(
"figlet"
"python3-apt"
"lsb-release"
"git"
)
for pkg in "${DEPENDENCIAS[@]}"; do
if ! dpkg -l | grep -q "^ii $pkg"; then
_cyan "\nInstalando dependência: $pkg..."
apt-get update -y && apt-get install -y "$pkg"
if [ $? -eq 0 ]; then
echo -e ""
_success "Dependência $pkg instalada com sucesso."
else
_red "\nFalha ao instalar a dependência $pkg.\n"
exit 1
fi
else
_yellow "\nDependência $pkg já está instalada."
fi
done
# motd-mod
_cyan "\nPersonalizando motd..."
## Font adicional pro figlet
wget -O /usr/share/figlet/Broadway.flf https://git.ipv0.com.br/0/linux/raw/branch/master/mod/Broadway.flf
# Backup arquivos originais
cp /etc/motd /etc/motd_backup
cp -r /etc/update-motd.d/ /etc/update-motd.d_backup
cd /etc/update-motd.d/ && rm -rf *
git clone https://git.ipv0.com.br/0/debian_motd.git . && rm README.md
chmod +x *-*
cd /etc && rm /etc/motd && rm -rf /var/run/motd*
ln -s /var/run/motd.dynamic.new motd