-
Notifications
You must be signed in to change notification settings - Fork 56
/
install.sh
79 lines (59 loc) · 1.91 KB
/
install.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
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
if [ `whoami` != root ]; then
echo "Please run with sudo!"
exit 1
fi
WORKDIR="$(dirname "$0")"
cd $WORKDIR
DESTPATH_APPDATA="/usr/local/share/camplayer/"
DESTPATH_BIN="/usr/local/bin/camplayer"
SYSTEMD_PATH="/lib/systemd/system/"
# ------ Install files to the correct location -------
# ----------------------------------------------------
# Copy application
echo "Copy appdate"
mkdir -p $DESTPATH_APPDATA
cp -v -R * $DESTPATH_APPDATA
chmod 755 -R $DESTPATH_APPDATA
# Copy executable
echo "Copy executable"
cp -v ./bin/camplayer $DESTPATH_BIN
chmod 755 $DESTPATH_BIN
# Be sure normal users can't read our config file!
#chmod 600 $DESTPATH_APPDATA"settings.ini"
# --- Install the required distribution packages -----
# ----------------------------------------------------
echo "Installing required distribution packages"
apt-get update
if [ ! -e /usr/bin/pip3 ]; then
apt-get -y install python3-pip
fi
if [ ! -e /usr/bin/ffprobe ]; then
apt-get -y install ffmpeg
fi
if [ ! -e /usr/bin/omxplayer ]; then
apt-get -y install omxplayer
fi
# --------- Install required python packages ---------
# ----------------------------------------------------
echo "Installing required python packages"
pip3 show evdev 1>/dev/null
if [ $? != 0 ]; then
pip3 install evdev==1.2.0
fi
# ---------------- Systemd service -------------------
# ----------------------------------------------------
echo "Installing 'camplayer' as a systemd service"
cp -v camplayer.service $SYSTEMD_PATH
systemctl daemon-reload
systemctl disable camplayer.service
# ---------------------- pipng -----------------------
# ----------------------------------------------------
echo "Installing and building pipng"
git clone https://github.com/raspicamplayer/pipng.git
cd ./pipng/ && make && make install
cd ../
rm -rf pipng
# --------------------- Done! ------------------------
# ----------------------------------------------------
echo "Done!"