template_setup/20-Updating_Custom_MOTD.sh
2022-04-03 13:44:17 -04:00

31 lines
687 B
Bash

#!/bin/bash
## Script Location
SCRIPTDIR=$(dirname $0)
source "$SCRIPTDIR/common/colors.sh"
source "$SCRIPTDIR/common/functions.sh"
## Start File Loop
## For .dependency files In The dependencies Directory
MOTDDIR="/etc/update-motd.d/"
MOTDALL="$SCRIPTDIR/motd/*"
for f in $MOTDALL
do
## Name Of MOTD file
MOTDNAME=$(echo "`basename $f | cut -f 1 -d '.'`")
printf "$COL_LIGHT_BLUE" "* Checking For $MOTDNAME motd file"
FILEBASENAME=$(echo "`basename $f`")
if [ ! -f "$FILEBASENAME" ]; then
printf "$COL_YELLOW" "** $FILEBASENAME motd file Missing, copying"
cp "$f" $MOTDDIR
else
printf "$COL_YELLOW" "** $FILEBASENAME motd exists"
fi
## End Of loop
done