MOTDs32/Install.sh

93 lines
2.5 KiB
Bash
Raw Normal View History

2017-07-20 15:01:54 +02:00
#!/bin/sh
2017-07-18 23:06:11 +02:00
#
2017-07-20 15:01:54 +02:00
# MOTDs32 installation instructions
# ==================================
#
# (2017) New project MOTDs32 by Erreur32
2017-07-18 23:06:11 +02:00
# Author: Erreur32
# Version 0.0.5
#
2017-07-20 15:01:54 +02:00
# https://gitlab.echosystem.fr/Erreur32/MOTDs32
#
# ,--. ,--. ,-----. ,--------.,------. ,----. ,---.
# | `.' |' .-. ''--. .--'| .-. \ ,---. '.-. |'.-. \
# | |'.'| || | | | | | | | \ :( .-' .' < .-' .'
# | | | |' '-' ' | | | '--' /.-' `)/'-' |/ '-.
# `--' `--' `-----' `--' `-------' `----' `----' '-----'
#
# | + |
2017-07-18 23:06:11 +02:00
# 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-20 15:01:54 +02:00
#
################################################################################
#
# Installation
# ============
#
# As root execute this command (the easy way!):
#
# ./Install.sh
#
################################################################################
## clean terminal
2017-07-19 09:22:15 +02:00
clear;
2017-07-20 15:51:28 +02:00
echo -e "\n\e[34mInstallation of MOTDs32 in progress... \e[0m"
2017-07-20 15:21:36 +02:00
2017-07-20 15:01:54 +02:00
## Install command in bashrc
echo "cat /etc/motd" >> /root/.bashrc
## Insdtall modules
2017-07-20 15:21:36 +02:00
2017-07-20 15:32:43 +02:00
if [ -f "/etc/motds32/Stats32" ]
2017-07-20 15:01:54 +02:00
then
2017-07-20 15:43:36 +02:00
echo -e " -->\e[34m Stats32 already installed\e[0m"
2017-07-20 15:01:54 +02:00
else
mkdir /etc/motds32;
cp Stats32 /etc/motds32/Stats32 -Rf
fi
2017-07-20 15:32:43 +02:00
if [ -f /usr/bin/motd ]
2017-07-20 15:01:54 +02:00
then
2017-07-20 15:43:36 +02:00
echo -e " -->\e[34m motd already installed\e[0m"
2017-07-20 15:01:54 +02:00
else
ln -s /usr/bin/motds32 /usr/bin/motd
fi
2017-07-20 15:31:17 +02:00
echo -e "Do you wish to install the missing package before \n --> apt-get install ntp figlet ? (y/n)? "
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 15:51:28 +02:00
echo -e "\n 1.\e[92m installation \e[0m ntp figlet \e[92m start\e[0m \n" ; apt-get install -y ntp figlet; make install
2017-07-20 15:55:10 +02:00
echo -e "\n\e[92m apt-get installation \e[0m Succesfull \n"
2017-07-18 23:06:11 +02:00
else
2017-07-20 15:51:28 +02:00
echo -e "\n 1.\e[92m ok no apt-get required \e[0m Installation continue... \n"; make install
2017-07-18 23:06:11 +02:00
fi
2017-07-20 15:55:10 +02:00
echo -e "Make command inprogress"
2017-07-20 14:20:10 +02:00
2017-07-18 23:06:11 +02:00
## Install Crontab
2017-07-18 23:27:05 +02:00
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 15:52:26 +02:00
echo -e " 2.\e[92m ROOT crontab\e[0m ADD (generation each 5 minutes)\n"
2017-07-20 15:49:10 +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
2017-07-20 15:55:10 +02:00
echo -e "\n 3.\e[92mMOTDs32 Installation completed!\e[0m \n Use: /usr/bin/motds32 for any help\n"
2017-07-20 15:21:36 +02:00
2017-07-20 15:02:23 +02:00
#EOF