MOTDs32/Install.sh

52 lines
1.1 KiB
Bash
Raw Normal View History

2017-07-18 23:06:11 +02:00
#!/bin/bash
#
# Installation of MOTDs32
# Author: Erreur32
# Version 0.0.5
#
# MOTDstat is dynamicaly refreshing the /etc/motd file with current informations
# about system status and usage.
#
# Copyright 2017 Erreur32
# original project: Pavol Krigler <pavol.krigler@gelogic.net>
#
2017-07-19 09:22:15 +02:00
clear;
2017-07-18 23:27:05 +02:00
2017-07-20 14:20:10 +02:00
echo -n "Do you wish to install the missing package before (y/n)? --> apt-get install ntp figlet ?"
2017-07-18 23:06:11 +02:00
old_stty_cfg=$(stty -g)
stty raw -echo
answer=$( while ! head -c 1 | grep -i '[ny]' ;do true ;done )
stty $old_stty_cfg
if echo "$answer" | grep -iq "^y" ;then
2017-07-20 14:46:30 +02:00
echo -e "/n Yes install ntp figlet" ; apt-get install -y ntp figlet; make install
2017-07-18 23:06:11 +02:00
else
2017-07-20 14:46:30 +02:00
echo -e "/n No continue without"; make install
2017-07-18 23:06:11 +02:00
fi
2017-07-20 14:20:10 +02:00
2017-07-20 11:00:56 +02:00
## Install command in bashrc
2017-07-19 09:18:33 +02:00
echo "cat /etc/motd" >> /root/.bashrc
2017-07-18 23:06:11 +02:00
2017-07-20 11:00:56 +02:00
## Insdtall modules
2017-07-18 23:40:20 +02:00
#mkdir /etc/motds32
2017-07-18 23:06:11 +02:00
cp Stats32 /etc/motds32/Stats32
2017-07-20 11:00:56 +02:00
ln -s /usr/bin/motds32 /usr/bin/motd
2017-07-18 23:06:11 +02:00
## Install Crontab
2017-07-18 23:27:05 +02:00
echo "add ENTRY in crontab (generation each 5 minutes)"
crontab << FIN
$(crontab -l)
2017-07-18 23:06:11 +02:00
2017-07-18 23:27:05 +02:00
### MOTDs32 generation (5 min)
*/5 * * * * /usr/bin/motds32 -g 2>1
2017-07-18 23:06:11 +02:00
###
2017-07-18 23:27:05 +02:00
FIN
2017-07-18 23:06:11 +02:00
2017-07-20 11:00:56 +02:00
## Generate first stats
2017-07-18 23:06:11 +02:00
/usr/bin/motds32 -g