Skip to content
Permalink
1c94275e0c
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 71 lines (68 sloc) 1.78 KB
#!/bin/bash
if [ "$(whoami)" != "root" ]; then
echo "Sorry, you are not root."
exit 1
fi
echo "update apt..."
apt -y update
echo "upgrading system. may take some time"
apt -y full-upgrade
echo "installing packages"
apt -y install python-serial python-mysqldb python-pygame ntp
echo "Do you wish to install nullmailer?"
while true
do
read -r -p "Install nullmailer? [[y]es/[N]o] " input
case $input in
[yY][eE][sS]|[yY])
apt -y install nullmailer
break
;;
[nN][oO]|[nN]|*)
break
;;
esac
done
echo "removing rubbish..."
apt -y autoremove
echo "generating german locale"
echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen de_DE.UTF-8
echo "setting timezone to Berlin"
echo "Europe/Berlin" > /etc/timezone
ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime
echo "disabling linux console on UART (only >= jessie!)"
systemctl stop serial-getty@ttyAMA0.service
systemctl mask serial-getty@ttyAMA0.service
echo "setting date and time..."
service ntp stop
ntpd -q -g
service ntp start
echo "date / time is now: "
date
echo "creating ramdisk... (500k)"
mkdir /ram
echo "tmpfs /ram tmpfs size=500k 0 0" >> /etc/fstab
mount -a
echo "installing crontab"
crontab -l > /tmp/crontemp
echo "* * * * * /home/pi/raspytime/chkraspytime.sh >> /var/log/raspytime-check.log" >> /tmp/crontemp
crontab /tmp/crontemp
echo "installing logrotate (weekly)"
cp raspytime.logrotate /etc/logrotate.d/raspytime
echo "finished. please modify database connection info in db.ini.template and save it as db.ini!"
while true
do
read -r -p "Copy template and open in nano now? [[Y]es/[n]o] " input
case $input in
[yY][eE][sS]|[yY]|*)
cp db.ini.template db.ini
nano db.ini
break
;;
[nN][oO]|[nN])
echo "Doing nothing then"
break
;;
esac
done