make install script reusable multiple times
This commit is contained in:
parent
55da16f246
commit
c455a355eb
17
install.sh
17
install.sh
@ -1,10 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
truncate -s0 /etc/motd # empty native static motd
|
# empty native static motd to prevent usage elsewhere (motd=/etc/motd from pam_motd.so or PrintMotd from sshd)
|
||||||
mkdir -p /etc/update-motd.d/ # create dedicated directory following ubuntu
|
truncate -s0 /etc/motd
|
||||||
cp motd /etc/update-motd.d/ # copy the static motd banner into it
|
# create dedicated directory following ubuntu to contain required files
|
||||||
chmod -x /etc/update-motd.d/* # disable any existing script
|
mkdir -p /etc/update-motd.d/
|
||||||
cp scripts/* /etc/update-motd.d/ # enable claranet motd script
|
# copy the static motd banner into this directory in place of /etc/motd
|
||||||
|
cp motd /etc/update-motd.d/
|
||||||
|
# disable any existing script in this directory (e.g. for ubunutu)
|
||||||
|
chmod -x /etc/update-motd.d/*
|
||||||
|
# enable claranet motd script
|
||||||
|
cp --preserve=mode scripts/* /etc/update-motd.d/
|
||||||
|
|
||||||
|
echo "Claranet motd successfully installed!"
|
||||||
echo "For distributions which does not use update-motd (e.g. ubuntu/debian), do not forget to add the following to /etc/pam.d/sshd:"
|
echo "For distributions which does not use update-motd (e.g. ubuntu/debian), do not forget to add the following to /etc/pam.d/sshd:"
|
||||||
echo "session optional pam_exec.so stdout /etc/update-motd.d/00-basic"
|
echo "session optional pam_exec.so stdout /etc/update-motd.d/00-basic"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user