Added install.sh
This commit is contained in:
23
install.sh
Normal file
23
install.sh
Normal 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"
|
||||
Reference in New Issue
Block a user