-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
68 lines (57 loc) · 2.33 KB
/
setup.sh
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
#!/bin/bash
# Setup script to install our required software and
# configure services etc.
# Make sure script is run as root.
if [ "$(id -u)" != "0" ]; then
echo "Must be run as root with sudo! Try: sudo ./setup.sh"
exit 1
fi
# update and upgrade existing packages
echo "Upgrading existing packages"
echo "=========================="
apt-get update
apt-get dist-upgrade -y
# install our required packages
echo "Installing dependencies..."
echo "=========================="
apt-get install wget omxplayer util-linux usbmount python3 -y
apt-get install python3-gpiozero -y
# include exFAT support
apt-get install exfat-fuse exfat-utils -y
# Configure USBMount for Stretch
# from https://vivekanandxyz.wordpress.com/2017/12/29/detecting-and-automatically-mounting-pendrive-on-raspbian-stretch-lite/
echo "Configure USBMount..."
echo "=========================="
sed -i '/MountFlags=slave/c\MountFlags=shared' /lib/systemd/system/systemd-udevd.service
systemctl daemon-reload
# copy our bash script
echo "Install our piSimpleVideoLooper script..."
echo "=========================="
mkdir /piSimpleVideoLooper
cd /piSimpleVideoLooper
wget -N https://raw.githubusercontent.com/jonwitts/pi_simple_video_looper/master/piSimpleVideoLooper.sh
chmod +x ./piSimpleVideoLooper.sh
# copy our shutdown Python script
echo "Install our Python shutdown script..."
echo "=========================="
wget -N https://raw.githubusercontent.com/jonwitts/pi_simple_video_looper/master/pythonShutdown.py
chmod +x ./pythonShutdown.py
# copy and activate our systemd definitions
echo "Copy and activate our systemd definitions..."
echo "=========================="
# piSimpleVideoLooper service
wget -N https://raw.githubusercontent.com/jonwitts/pi_simple_video_looper/master/piSimpleVideoLooper.service
mv ./piSimpleVideoLooper.service /lib/systemd/system/piSimpleVideoLooper.service
chmod 644 /lib/systemd/system/piSimpleVideoLooper.service
# pythonShutdown service
wget -N https://raw.githubusercontent.com/jonwitts/pi_simple_video_looper/master/pythonShutdown.service
mv ./pythonShutdown.service /lib/systemd/system/pythonShutdown.service
chmod 644 /lib/systemd/system/pythonShutdown.service
# reload and enable
systemctl daemon-reload
systemctl enable piSimpleVideoLooper.service
systemctl enable pythonShutdown.service
# done
echo "Done. Rebooting now"
echo "=========================="
reboot