Skip to content

Instantly share code, notes, and snippets.

@wgmyers
Created January 13, 2020 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wgmyers/570a4f977ae86e792f202e7581abde55 to your computer and use it in GitHub Desktop.
Save wgmyers/570a4f977ae86e792f202e7581abde55 to your computer and use it in GitHub Desktop.
Add Figlet To Ubuntu MOTD
#!/bin/bash
FIGLET=/usr/bin/figlet
HOSTNAME=/proc/sys/kernel/hostname
MOTDFILE=/etc/update-motd.d/05-figlet
# Sanity checks
if [[ $EUID -ne 0 ]]; then
echo "Run script as root"
exit 1
fi
if [ ! -f $FIGLET ]; then
echo "Can't find figlet at $FIGLET"
exit 1
fi
if [ ! -f $HOSTNAME ]; then
echo "Can't find hostname. Is this even Ubuntu?"
exit 1
fi
cat > $MOTDFILE <<'HEAD'
#!/bin/bash
cat <<'FIGLET'
HEAD
cat $HOSTNAME | figlet >> $MOTDFILE
cat >> $MOTDFILE <<'FOOT'
FIGLET
FOOT
chmod 0755 $MOTDFILE
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment