32 lines
731 B
Bash
32 lines
731 B
Bash
#!/bin/bash
|
|
|
|
## Script Location
|
|
SCRIPTDIR=$(dirname $0)
|
|
source "$SCRIPTDIR/common/colors.sh"
|
|
source "$SCRIPTDIR/common/functions.sh"
|
|
source "$SCRIPTDIR/common/load-defaults.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
|