Added install.sh

This commit is contained in:
2026-04-30 21:04:03 -05:00
parent 8be63964f8
commit db7ab37fc4

23
install.sh Normal file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
# install.sh / uninstall.sh — Custom MOTD installer
# Symlink or rename this file; behaviour switches on the script name.
set -euo pipefail
TARGET="/etc/profile.d/motd.sh"
MOTD_D="/etc/update-motd.d"
if [[ $EUID -ne 0 ]]; then
echo "Error: run as root (sudo $0)" >&2
exit 1
fi
if [[ ! -f "motd.sh" ]]; then
echo "Error: motd.sh not found in current directory" >&2
exit 1
fi
echo "Installing $TARGET..."
cp motd.sh "$TARGET"
chmod +x "$TARGET"
echo "Disabling default MOTD scripts..."
chmod -x "$MOTD_D"/*
echo "Done. Test with: bash $TARGET"