forked from needo37/plexWatch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
firstrun.sh
38 lines (34 loc) · 1.54 KB
/
firstrun.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
#!/bin/bash
# download plexWatch.pl if it doesn't already exist
if [ ! -f /plexWatch/plexWatch.pl ]; then
echo "Downloading plexWatch.pl..."
wget -P /plexWatch/ https://raw.github.com/ljunkie/plexWatch/master/plexWatch.pl
chmod +x /plexWatch/plexWatch.pl
fi
# download the default plexWatch config.pl file if it doesn't already exist
if [ ! -f /plexWatch/config.pl ]; then
echo "Downloading plexWatch config.pl"
wget -P /plexWatch/ https://raw.github.com/ljunkie/plexWatch/master/config.pl-dist
mv /plexWatch/config.pl-dist /plexWatch/config.pl
chmod a+w /plexWatch/config.pl
# set the data_dir location
sed -i -e "s#\(data_dir = '\).*'#\1/plexWatch/'#" /plexWatch/config.pl
fi
# set server_log in the plexWatch config.pl file
if [ -f /logs/Plex\ Media\ Server.log ]; then
echo "Plex Media Server.log located in /logs directory"
sed -i -e "s#\(server_log = '\).*'#\1/logs/Plex Media Server.log'#" /plexWatch/config.pl
elif [ -f /log/Plex\ Media\ Server.log ]; then
# some users may pass in /log instead of /logs
echo "Plex Media Server.log located in /log directory"
sed -i -e "s#\(server_log = '\).*'#\1/log/Plex Media Server.log'#" /plexWatch/config.pl
else
echo "Error: Unable to locate the 'Plex Media Server.log' file. Did you pass in the correct path?"
exit 1 # terminate and indicate error
fi
# use the default plexWatchWeb config.php file if it doesn't already exist
if [ ! -f /plexWatch/config.php ]; then
echo "Using default plexWatchWeb config.php"
cp /tmp/config.php /plexWatch/config.php
chmod a+w /plexWatch/config.php
fi