Repository navigation
Expand file tree
/
Copy pathinstall
More file actions
executable file
·89 lines (66 loc) · 3.41 KB
/
Copy pathinstall
File metadata and controls
executable file
·89 lines (66 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
# Run with sudo ./install
echo "update"
sudo apt-get update -y
sudo apt-get upgrade -y
echo "deleting unused software"
sudo apt-get purge -y wolfram-engine minecraft-pi sonic-pi scratch
sudo apt-get autoremove -y
sudo apt-get clean
sudo apt-get install -y iptables wpasupplicant
echo "Set hostname to emonpi"
if grep -Fxq "raspberrypi" /etc/hosts ; then
sudo sed -i 's/raspberrypi/emonpi/' /etc/hosts
sudo sed -i 's/raspberrypi/emonpi/' /etc/hostname
fi
if grep -Fxq "minibian" /etc/hosts ; then
sudo sed -i 's/minibian/emonpi/' /etc/hosts
sudo sed -i 's/minibian/emonpi/' /etc/hostname
fi
echo "enable serial uploads with avrdue and autoreset & install minicom & enable use of serial port"
git clone https://github.com/openenergymonitor/avrdude-rpi.git ~/avrdude-rpi && ~/avrdude-rpi/install
#echo "install ino Arduino compile tool"
#sudo apt-get install arduino -y
#sudo apt-get install python-pip -y
#pip install ino
echo "disable the raspi-config auto run"
sudo rm /etc/profile.d/raspi-config.sh
# Only used when emonPi is used without LCD, run either LCD service or shutdwn service. LCD script also handles shutdown
# echo "install shutdown service"
# sudo /home/pi/emonpi/shutdownpi/install
echo "install LCD"
sudo /home/pi/emonpi/lcd/install
echo "move /etc/resolv.conf to RW data partition to allow updating of DNS nameservers"
# create sim link of resolv.conf and resolv.conf.dhclient-new in RW /data to /etc
cp /etc/resolv.conf /home/pi/data/
sudo rm /etc/resolv.conf
sudo ln -s /home/pi/data/resolv.conf /etc/resolv.conf
# Create resolv.conf.dhclient-new file and symlink to /etc
touch /home/pi/data/resolv.conf.dhclient-new
sudo ln -s /home/pi/data/resolv.conf.dhclient-new /etc/resolv.conf.dhclient-new
# make backup of dhclient-script
sudo cp /sbin/dhclient-script /sbin/dhclient-script_original
# Best do these steps manually: https://github.com/openenergymonitor/emonpi/blob/master/imagebuild.md
#echo "Move log directory to temporary partition"
#sudo cp /etc/default/rcS /etc/default/rcS.orig
#sudo sh -c "echo 'RAMTMP=yes' >> /etc/default/rcS"
#echo "setup /etc/fstab to make file system read-only be default"
#sudo mv /etc/fstab /etc/fstab.orig
#sudo sh -c "echo 'tmpfs /tmp tmpfs nodev,nosuid,size=30M,mode=1777 0 0' >> /etc/fstab"
#sudo sh -c "echo 'tmpfs /var/log tmpfs nodev,nosuid,size=30M,mode=1777 0 0' >> /etc/fstab"
#sudo sh -c "echo 'proc /proc proc defaults 0 0' >> /etc/fstab"
#sudo sh -c "echo '/dev/mmcblk0p1 /boot vfat defaults 0 2' >> /etc/fstab"
#sudo sh -c "echo '/dev/mmcblk0p2 / ext4 defaults,noatime 0 1' >> /etc/fstab"
#sudo sh -c "echo ' ' >> /etc/fstab"
#sudo mv /etc/mtab /etc/mtab.orig
#sudo ln -s /proc/self/mounts /etc/mtab
# copy modified dhclient-script
sudo cp /home/pi/emonpi/dhclient-script /sbin/dhclient-script
# Add startup message
if ! grep -Fxq "The file system is in Read Only (RO) mode" /etc/motd ; then
sudo echo " "
sudo echo -e "\nThe file system is in Read Only (RO) mode. If you need to make changes, use the command rpi-rw to put the file system in Read Write (RW) mode. Use rpi-ro to return to RO mode. The /home/pi/data directory is always in RW mode \n" >> /etc/motd
echo 'welcome message added to /etc/motd'
else
echo 'welcome message already added to /etc/motd'
fi