forked from blindpet/MediaServerInstaller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.sh
1495 lines (1381 loc) · 65.1 KB
/
functions.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
#
# (c) Igor Pecovnik
#
#get ip
showip=$(ifconfig eth0 | awk -F"[: ]+" '/inet addr:/ {print $4}')
#get architecture
if uname -m | grep -i arm > /dev/null; then
ARCH=ARM
else
ARCH=x86
fi
#functions
function unrartest {
if hash unrar 2>/dev/null; then
return
else
cpunum=$(nproc)
apt-get install build-essential -y
cd /tmp
RARVERSION=$(wget -q http://www.rarlab.com/rar_add.htm -O - | grep unrarsrc | awk -F "[\"]" ' NR==1 {print $2}')
wget $RARVERSION
tar -xvf unrarsrc*.tar.gz
cd unrar
make -j$cpunum -f makefile
install -v -m755 unrar /usr/bin
cd ..
rm -R unrar*
rm unrarsrc-*.tar.gz
fi }
function monotest {
if hash mono 2>/dev/null; then
return
else
echo "Installing mono"
if !(uname -m | grep -i armv6 > /dev/null); then
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
cat >> /etc/apt/sources.list.d/mono-xamarin.list <<EOF
# Mono
deb http://download.mono-project.com/repo/debian wheezy main
EOF
else
debconf-apt-progress -- install libmono-cil-dev -y
cd /tmp
wget https://www.dropbox.com/s/k6ff6s9bfe4mfid/mono_3.10-armhf.deb
dpkg -i mono_3.10-armhf.deb
rm mono_3.10-armhf.deb
fi
fi
}
function javatest {
if hash java 2>/dev/null; then
return
else
if !(cat /etc/apt/sources.list.d/webupd8team-java.list | grep -q Java > /dev/null);then
cat >> /etc/apt/sources.list.d/webupd8team-java.list <<EOF
# Java
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
EOF
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
fi
debconf-apt-progress -- apt-get update
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
apt-get install oracle-java8-installer -y
fi }
install_webmin () {
#--------------------------------------------------------------------------------------------------------------------------------
# Install webmin
#--------------------------------------------------------------------------------------------------------------------------------
debconf-apt-progress -- apt-get install libauthen-pam-perl libio-pty-perl libnet-ssleay-perl libapt-pkg-perl apt-show-versions libwww-perl libauthen-sasl-perl -y
#wget http://www.webmin.com/download/deb/webmin-current.deb
#dpkg -i webmin*
#rm webmin*
echo "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list
wget http://www.webmin.com/jcameron-key.asc -O - | apt-key add -
apt-get update
apt-get install webmin -y
echo "Webmin is running at https://$showip:10000"
}
install_lemp () {
#--------------------------------------------------------------------------------------------------------------------------------
# Install lemp
#--------------------------------------------------------------------------------------------------------------------------------
debconf-apt-progress -- apt-get install mysql-server mysql-client nginx php5-fpm php5-dev php5-mysql php5-dev -y
echo "LEMP installed"
}
install_basic (){
#--------------------------------------------------------------------------------------------------------------------------------
# Set hostname, FQDN, add to sources list
#--------------------------------------------------------------------------------------------------------------------------------
serverIP=$(ip route get 8.8.8.8 | awk '{ print $NF; exit }')
set ${serverIP//./ }
SUBNET="$1.$2.$3."
HOSTNAMEFQDN=$(hostname -f)
HOSTNAMEFQDN=$(whiptail --inputbox "\nWhat is your full qualified hostname for $serverIP ?" 10 78 $HOSTNAMEFQDN --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
set ${HOSTNAMEFQDN//./ }
HOSTNAMESHORT="$1"
cp /etc/hosts /etc/hosts.backup
cp /etc/hostname /etc/hostname.backup
sed -e 's/127.0.0.1 localhost/127.0.0.1 localhost.localdomain localhost/g' -i /etc/hosts
cat >> /etc/hosts <<EOF
${serverIP} ${HOSTNAMEFQDN} ${HOSTNAMESHORT}
EOF
echo "$HOSTNAMESHORT" > /etc/hostname
/etc/init.d/hostname.sh start >/dev/null 2>&1
}
create_ispconfig_configuration (){
#--------------------------------------------------------------------------------------------------------------------------------
# ISPConfig autoconfiguration
#--------------------------------------------------------------------------------------------------------------------------------
cat > /tmp/isp.conf.php <<EOF
<?php
\$autoinstall['language'] = 'en'; // de, en (default)
\$autoinstall['install_mode'] = 'standard'; // standard (default), expert
\$autoinstall['hostname'] = '$HOSTNAMEFQDN'; // default
\$autoinstall['mysql_hostname'] = 'localhost'; // default: localhost
\$autoinstall['mysql_root_user'] = 'root'; // default: root
\$autoinstall['mysql_root_password'] = '$mysql_pass';
\$autoinstall['mysql_database'] = 'dbispconfig'; // default: dbispcongig
\$autoinstall['mysql_charset'] = 'utf8'; // default: utf8
\$autoinstall['http_server'] = '$server'; // apache (default), nginx
\$autoinstall['ispconfig_port'] = '8080'; // default: 8080
\$autoinstall['ispconfig_use_ssl'] = 'y'; // y (default), n
/* SSL Settings */
\$autoinstall['ssl_cert_country'] = 'AU';
\$autoinstall['ssl_cert_state'] = 'Some-State';
\$autoinstall['ssl_cert_locality'] = 'Chicago';
\$autoinstall['ssl_cert_organisation'] = 'Internet Widgits Pty Ltd';
\$autoinstall['ssl_cert_organisation_unit'] = 'IT department';
\$autoinstall['ssl_cert_common_name'] = \$autoinstall['hostname'];
?>
EOF
}
install_sugarcrm (){
#--------------------------------------------------------------------------------------------------------------------------------
# Community edition CRM
#--------------------------------------------------------------------------------------------------------------------------------
cd /tmp
wget http://downloads.sourceforge.net/project/sugarcrm/1%20-%20SugarCRM%206.5.X/WebPI/SugarCE-6.5.18-WebPI.zip
unzip SugarCE-6.5.18-WebPI.zip
cd SugarCE-Full-6.5.18
mv * /usr/share/nginx/www
}
install_varnish (){
#--------------------------------------------------------------------------------------------------------------------------------
# Install high-performance HTTP accelerator
#--------------------------------------------------------------------------------------------------------------------------------
apt-get install apt-transport-https -y
wget -O - https://repo.varnish-cache.org/GPG-key.txt | apt-key add -
cat > /etc/apt/sources.list.d/varnish-cache.list<<EOF
deb-src https://repo.varnish-cache.org/debian/ jessie varnish-4.1
EOF
apt-get update
apt-get build-dep varnish -y
cd /tmp
apt-get source varnish -y
rm varnish_*.dsc
rm varnish_*.orig.tar.gz
rm varnish_*.diff.gz
cd varnish-4*
./configure --prefix=/usr
make -j$(ncpu)
make install
cp debian/varnish.init /etc/init.d/varnish
chmod +x /etc/init.d/varnish
cp debian/varnish.default /etc/default/varnish
update-rc.d varnish defaults
mkdir -p /etc/varnish
cp etc/example.vcl /etc/varnish/default.vcl
dd if=/dev/random of=/etc/varnish/secret count=1
service varnish start
echo "Configure Varnish with WordPress using this guide http://goo.gl/zlvBdB"
}
install_rpimonitor (){
#--------------------------------------------------------------------------------------------------------------------------------
# Install rpimonitor with custom config
#--------------------------------------------------------------------------------------------------------------------------------
if !(grep -qs XavierBerger "/etc/apt/sources.list");then
cat >> /etc/apt/sources.list <<EOF
# RPi-Monitor official repository
deb https://github.com XavierBerger/RPi-Monitor-deb/raw/master/repo/
EOF
fi
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 2C0D3C0F
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get -y install rpimonitor
service rpimonitor stop
# add my own configuration which is not default
cd /etc/rpimonitor
wget https://github.com/igorpecovnik/Debian-micro-home-server/blob/next/src/rpimonitor-myconfig.tgz?raw=true -O - | tar -xhz
cd /usr/local/bin
wget https://github.com/igorpecovnik/Debian-micro-home-server/blob/next/src/temp-pir-daemon.sh?raw=true -O temp-pir-daemon.sh
chmod +x /usr/local/bin/temp-pir-daemon.sh
sed -e 's/exit 0//g' -i /etc/rc.local
cat >> /etc/rc.local <<"EOF"
nohup /usr/local/bin/temp-pir-daemon.sh &
exit 0
EOF
rm -rf /var/lib/rpimonitor/stat
mkdir -p /var/log/rpimonitor
nohup /usr/local/bin/temp-pir-daemon.sh &
service rpimonitor start
/usr/share/rpimonitor/scripts/updatePackagesStatus.pl
}
install_bmc180 (){
#--------------------------------------------------------------------------------------------------------------------------------
# Install temp and pressure sensor read utility
#--------------------------------------------------------------------------------------------------------------------------------
cd /tmp
git clone https://github.com/maasdoel/bmp180
cd bmp180
# let's change bus number to suits our need
sed -i "s/dev\/i2c-1/dev\/i2c-2/" bmp180dev3.c
gcc -Wall -o bmp180 ./bmp180dev3.c -lm
cp bmp180 /usr/local/bin
rm -r /tmp/bmp180
}
install_tsl2561 (){
#--------------------------------------------------------------------------------------------------------------------------------
# Install light sensor read utility
#--------------------------------------------------------------------------------------------------------------------------------
cd /tmp
wget https://github.com/igorpecovnik/Debian-micro-home-server/blob/next/src/tsl2561-src.tgz?raw=true -O - | tar -xz
gcc -Wall -O2 -o TSL2561.o -c TSL2561.c
gcc -Wall -O2 -o TSL2561_test.o -c TSL2561_test.c
gcc -Wall -O2 -o TSL2561_test TSL2561.o TSL2561_test.o
cp TSL2561_test /usr/local/bin/tsl2561
}
install_tvheadend (){
#--------------------------------------------------------------------------------------------------------------------------------
# TVheadend
#--------------------------------------------------------------------------------------------------------------------------------
if !(cat /etc/apt/sources.list.d/tvheadend | grep -q headend > /dev/null);then
cat > /etc/apt/sources.list.d/tvheadend <<EOF
# TV headend
deb https://dl.bintray.com/tvheadend/deb jessie stable"
EOF
fi
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61
debconf-apt-progress -- apt-get update
apt-get -y install tvheadend
echo "TVheadend is running on $showip:9981"
}
install_transmission (){
#--------------------------------------------------------------------------------------------------------------------------------
# transmission
#--------------------------------------------------------------------------------------------------------------------------------
debconf-apt-progress -- apt-get -y install transmission-cli transmission-common transmission-daemon
service transmission-daemon stop
TRANSUSER=$(whiptail --inputbox "Choose the owner of the downloads folder (usually pi)" 8 78 "pi" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
if ! getent passwd $TRANSUSER > /dev/null; then
echo "User $TRANSUSER doesn't exist, exiting, restart the installer"
exit
fi
#if ! getent passwd debian-transmission > /dev/null; then
usermod -a -G $TRANSUSER debian-transmission
usermod -a -G debian-transmission $TRANSUSER
#else
#usermod -a -G $TRANSUSER transmission-daemon
#usermod -a -G transmission-daemon $TRANSUSER
#fi
#chown $TRANSUSER:$TRANSUSER /etc/transmission-daemon/settings.json
chmod 775 /etc/transmission-daemon/settings.json
#chown -R $TRANSUSER:$TRANSUSER /var/lib/transmission-daemon
#sed -i "/USER=/c\USER=$TRANSUSER" /etc/init.d/transmission-daemon
#TRANSDL=$(whiptail --inputbox "Choose your download directory" 8 78 $TRANSDL --title "$SECTION" 3>&1 1>&2 2>&3)
#exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
#sed 's/.*"bind-address-ipv4":.*/ "bind-address-ipv4": '$ifconfig_remote',/' /etc/transmission-daemon/settings.json
if (whiptail --yesno "Enable remote access of the WebUI?" 8 78 --title "$SECTION") then
sed -i 's/.*"rpc-whitelist.enabled":.*/ "rpc-whitelist-enabled": 'false',/' /etc/transmission-daemon/settings.json
sed -i 's/.*"rpc-enabled":.*/ "rpc-enabled": 'true',/' /etc/transmission-daemon/settings.json
else
exit 1
fi
TRANSWEBUSER=$(whiptail --inputbox "Choose your Transmission web interface username" 8 78 "username" --title "$SECTION" 3>&1 1>&2 2>&3)
sed -i 's/.*"rpc-username":.*/ "rpc-username": '\"$TRANSWEBUSER\"',/' /etc/transmission-daemon/settings.json
TRANSWEBPASS=$(whiptail --inputbox "Choose your Transmission web interface password" 8 78 "password" --title "$SECTION" 3>&1 1>&2 2>&3)
sed -i 's/.*"rpc-password":.*/ "rpc-password": '\"$TRANSWEBPASS\"',/' /etc/transmission-daemon/settings.json
if [ -e "/lib/systemd/system/transmission-daemon.service" ]; then
#sed -i "/ExecStart=/c\ExecStart=/usr/bin/transmission-daemon -f --log-error -g /etc/transmission-daemon" /lib/systemd/system/transmission-daemon.service #sed -i "/User=/c\User=$TRANSUSER" /lib/systemd/system/transmission-daemon.service
mkdir -p /etc/systemd/system/transmission-daemon.service.d
cat > /etc/systemd/system/transmission-daemon.service.d/local.conf<<EOF
[Service]
ExecStart=
ExecStart=/usr/bin/transmission-daemon -f --log-error -g /etc/transmission-daemon
EOF
systemctl daemon-reload
service transmission-daemon restart
fi
service transmission-daemon start
echo "Transmission is running on $showip:9091"
echo "Make sure your download folder is set to chmod 775 see http://http://goo.gl/TWALmL"
}
#install_nzbget15 (){
#--------------------------------------------------------------------------------------------------------------------------------
# nzbget15
#--------------------------------------------------------------------------------------------------------------------------------
#NZBGETUSER=$(whiptail --inputbox "Enter the user to run NZBGet as (usually pi)" 8 78 $NZBGETUSER --title "$SECTION" 3>&1 1>&2 2>&3)
#exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
#if ! getent passwd $NZBGETUSER > /dev/null; then
#echo "User $NZBGETUSER doesn't exist, exiting, restart the installer"
#exit
#fi
#build unrar
# test unrar is installed, build it
#unrartest
#install nzbget
#debconf-apt-progress -- apt-get update
#debconf-apt-progress -- apt-get install -y build-essential libsigc++-dev sigc++ libncurses5-dev libssl-dev libxml2-dev unzip p7zip-full ncurses-dev openssl
#wget http://sourceforge.net/projects/nzbget/files/nzbget-stable/15.0/nzbget-15.0.tar.gz
#tar -zxvf nzbget-15.0.tar.gz
#rm nzbget-15.0.tar.gz
#cd nzbget-15.0
#cpunum=$(nproc)
#./configure --with-tlslib=OpenSSL && make -j$cpunum && sudo make install && sudo make install-conf
#cp /usr/local/share/nzbget/nzbget.conf /etc/nzbget.conf
#chown $NZBGETUSER:root /etc/nzbget.conf
##replace username line
#sed -i "/DaemonUsername=/c\DaemonUsername=$NZBGETUSER" /etc/nzbget.conf
#cd /etc/init.d
#wget https://raw.github.com/blindpet/MediaServerInstaller/usenet/scripts/nzbget
#chmod +x /etc/init.d/nzbget
#cd /tmp
#rm -R ~/HTPCGuides/nzbget-15.0
#rm -R /root/HTPCGuides/nzbget-15.0
#update-rc.d nzbget defaults
#if !(crontab -l -u $NZBGETUSER | grep -q nzbget > /dev/null);then
#crontab -u $NZBGETUSER -l | { cat; echo "@reboot /usr/local/bin/nzbget"; } | crontab -u $NZBGETUSER -
#fi
#service nzbget start
#sudo rm
#echo "NZBGet 15 is running on $showip:6789"
#echo "Configure NZBGet at HTPCGuides.com http://goo.gl/PDjIAP"
#}
install_nzbget (){
#--------------------------------------------------------------------------------------------------------------------------------
# nzbget
#--------------------------------------------------------------------------------------------------------------------------------
NZBGETUSER=$(whiptail --inputbox "Enter the user to run NZBGet as (usually pi)" 8 78 "pi" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
if ! getent passwd $NZBGETUSER > /dev/null; then
echo "User $NZBGETUSER doesn't exist, exiting, restart the installer"
exit
fi
#build unrar
# test unrar is installed, build it
unrartest
#install nzbget
NZBGETLATEST=$(wget http://nzbget.net/download/ -O - | grep run | awk -F "[\"]" '{print $4}' | head -n1)
wget $NZBGETLATEST -O nzbget-latest-bin-linux.run
sh nzbget-latest-bin-linux.run --destdir /opt/nzbget
rm nzbget-latest-bin-linux.run
chown -R $NZBGETUSER:$NZBGETUSER /opt/nzbget
sed -i "/DaemonUsername=/c\DaemonUsername=$NZBGETUSER" /opt/nzbget/nzbget.conf
if stat /proc/1/exe | grep -i file | awk '{print $4}' | grep 'systemd' > /dev/null ; then
cat > /etc/systemd/system/nzbget.service <<EOF
[Unit]
Description=NZBGet Daemon
Documentation=http://nzbget.net/Documentation
After=network.target
[Service]
User=$NZBGETUSER
Group=$NZBGETUSER
Type=forking
ExecStart=/opt/nzbget/nzbget -c /opt/nzbget/nzbget.conf -D
ExecStop=/opt/nzbget/nzbget -Q
ExecReload=/opt/nzbget/nzbget -O
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl enable nzbget.service
else
cd /etc/init.d
wget https://raw.github.com/blindpet/MediaServerInstaller/usenet/scripts/nzbget
sed -i "/DAEMON_USER=/c\DAEMON_USER=$NZBGETUSER" /etc/init.d/nzbget
chmod +x /etc/init.d/nzbget
cd /tmp
update-rc.d nzbget defaults 98
#if !(crontab -l -u $NZBGETUSER | grep -q /opt/nzbget/nzbget > /dev/null);then
#crontab -u $NZBGETUSER -l | { cat; echo "@reboot /opt/nzbget/nzbget -D"; } | crontab -u $NZBGETUSER -
#fi
fi
service nzbget start
echo "NZBGet is running on $showip:6789"
echo "Configure NZBGet at HTPCGuides.com http://goo.gl/PDjIAP"
}
install_sonarr (){
#--------------------------------------------------------------------------------------------------------------------------------
# sonarr
#--------------------------------------------------------------------------------------------------------------------------------
NZBDRONEUSER=$(whiptail --inputbox "Enter the user to run Sonarr as (usually pi)" 8 78 "pi" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
if ! getent passwd $NZBDRONEUSER > /dev/null; then
echo "User $NZBDRONEUSER doesn't exist, exiting, restart the installer"
exit
fi
#if !(cat /etc/apt/sources.list | grep -q Sonarr > /dev/null);then
#cat > /etc/apt/sources.list.d/sonarr.list <<EOF
#deb http://archive.raspbian.org/raspbian wheezy main contrib non-free
#EOF
#debconf-apt-progress -- apt-get update
#debconf-apt-progress -- apt-get install libmono-cil-dev -y --force-yes
#rm /etc/apt/sources.list.d/sonarr.list
#debconf-apt-progress -- apt-get update
monotest
cat > /etc/apt/sources.list.d/sonarr.list <<EOF
# Sonarr
deb http://apt.sonarr.tv/ master main
EOF
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FDA5DFFC
#debconf-apt-progress -- apt-get update
apt-get update
apt-get install nzbdrone -y --force-yes
#fi
#if uname -a | grep -i arm > /dev/null; then
#cd /tmp
#wget http://sourceforge.net/projects/bananapi/files/mono_3.10-armhf.deb
#FILENAME="mono_3.10-armhf.deb"
#SIZE=$(du -sb $FILENAME | awk '{ print $1 }')
#if ((SIZE<100000000)) ; then
# echo "Sourceforge is down :( trying mirror";
# wget https://www.dropbox.com/s/k6ff6s9bfe4mfid/mono_3.10-armhf.deb
#else
# dpkg -i mono_3.10-armhf.deb
#fi
#rm mono_3.10-armhf.deb
#rm /etc/apt/sources.list.d/sonarr.list
#fi
#if [ ! -d "/opt/NzbDrone" ]; then
#debconf-apt-progress -- apt-get install mediainfo sqlite3 libmono-cil-dev -y
#wget https://download.sonarr.tv/v2/master/latest/NzbDrone.master.tar.gz
#tar -xvf NzbDrone.master.tar.gz
#mv NzbDrone /opt/NzbDrone
#rm NzbDrone.master.tar.gz
#fi
chown -R $NZBDRONEUSER:$NZBDRONEUSER /opt/NzbDrone
#Create nzbdrone script
cd /etc/init.d/
wget https://raw.github.com/blindpet/MediaServerInstaller/usenet/scripts/nzbdrone
sed -i "/RUN_AS=/c\RUN_AS=$NZBDRONEUSER" /etc/init.d/nzbdrone
if uname -a | grep armv6 > /dev/null; then
sed -i "/DAEMON=/c\DAEMON=/usr/local/bin/mono" /etc/init.d/nzbdrone
fi
chmod +x /etc/init.d/nzbdrone
cd /tmp
update-rc.d nzbdrone defaults
service nzbdrone start
echo "Sonarr is running on $showip:8989"
echo "Configure Sonarr at HTPCGuides.com http://goo.gl/06iXEw"
rm /etc/apt/sources.list.d/sonarr.list
}
install_jackett (){
#--------------------------------------------------------------------------------------------------------------------------------
# jackett
#--------------------------------------------------------------------------------------------------------------------------------
#hash mono 2>/dev/null || { echo >&2 "Mono isn't installed, install Sonarr first. Aborting."; exit 1; }
JACKETTUSER=$(whiptail --inputbox "Choose the owner of the downloads folder (usually pi)" 8 78 "pi" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
if ! getent passwd $JACKETTUSER > /dev/null; then
echo "User $JACKETTUSER doesn't exist, exiting, restart the installer"
exit
fi
#hash mono 2>/dev/null || {
#if [ $ARCH == ARM ]; then
# wget https://www.dropbox.com/s/k6ff6s9bfe4mfid/mono_3.10-armhf.deb
# dpkg -i mono_3.10-armhf.deb
#fi
#if [ $ARCH == x86 ]; then
# debconf-apt-progress -- apt-get install mono-complete -y
#fi
#}
monotest
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get install mono-complete -y
jackettver=$(wget -q https://github.com/Jackett/Jackett/releases/latest -O - | grep -E \/tag\/ | awk -F "[><]" '{print $3}')
wget -q https://github.com/Jackett/Jackett/releases/download/$jackettver/Jackett.Binaries.Mono.tar.gz
tar -xvf Jackett*
mkdir /opt/jackett
sudo mv Jackett/* /opt/jackett
chown -R $JACKETTUSER:$JACKETTUSER /opt/jackett
#init
cd /etc/init.d
wget https://raw.github.com/blindpet/MediaServerInstaller/usenet/scripts/jackett
sed -i s"/RUN_AS=htpcguides/RUN_AS=$JACKETTUSER/" /etc/init.d/jackett
chmod +x /etc/init.d/jackett
cd /tmp
update-rc.d jackett defaults
service jackett start
echo "Jackett is running on $showip:9117"
echo "Configure Jackett at HTPCGuides.com http://goo.gl/A9i7ah"
}
install_sickrage (){
#--------------------------------------------------------------------------------------------------------------------------------
# sickrage
#--------------------------------------------------------------------------------------------------------------------------------
SICKRAGEUSER=$(whiptail --inputbox "Enter the user to run SickRage as (usually pi)" 8 78 "pi" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
if ! getent passwd $SICKRAGEUSER > /dev/null; then
echo "User $SICKRAGEUSER doesn't exist, exiting, restart the installer"
exit
fi
unrartest
debconf-apt-progress -- apt-get install git-core libssl-dev libxslt1-dev libxslt1.1 libxml2-dev libxml2 libssl-dev libffi-dev python-pip python-dev -y
pip install pyopenssl
sudo git clone https://github.com/SickRage/SickRage.git /opt/sickrage
sudo chown -R $SICKRAGEUSER:$SICKRAGEUSER /opt/sickrage
cat > /etc/default/sickrage <<EOF
SR_USER=$SICKRAGEUSER
SR_HOME=/opt/sickrage
SR_DATA=/opt/sickrage
SR_PIDFILE=/home/$SICKRAGEUSER/.sickrage.pid
EOF
FINDSICKRAGE=$(find /opt/sickrage -name init.ubuntu)
cp $FINDSICKRAGE /etc/init.d/sickrage
chmod +x /etc/init.d/sickrage
update-rc.d sickrage defaults
service sickrage start
echo "SickRage is running on $showip:8081"
echo "Configure SickRage at HTPCGuides.com http://goo.gl/I2jtbg"
}
install_couchpotato (){
#--------------------------------------------------------------------------------------------------------------------------------
# couchpotato
#--------------------------------------------------------------------------------------------------------------------------------
COUCHPOTATOUSER=$(whiptail --inputbox "Enter the user to run CouchPotato as (usually pi)" 8 78 "pi" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
if ! getent passwd $COUCHPOTATOUSER > /dev/null; then
echo "User $COUCHPOTATOUSER doesn't exist, exiting, restart the installer"
exit
fi
unrartest
debconf-apt-progress -- apt-get install -y zlib1g-dev libffi-dev libssl-dev libxslt1-dev libxml2-dev python python-pip python-dev build-essential
pip install cryptography
pip install pyopenssl
pip install pyopenssl --upgrade
git clone http://github.com/RuudBurger/CouchPotatoServer /opt/CouchPotato
chown -R $COUCHPOTATOUSER:$COUCHPOTATOUSER /opt/CouchPotato
cat > /etc/default/couchpotato <<EOF
CP_HOME=/opt/CouchPotato
CP_USER=$COUCHPOTATOUSER
CP_PIDFILE=/home/$COUCHPOTATOUSER/.couchpotato.pid
CP_DATA=/home/$COUCHPOTATOUSER/.couchpotato
EOF
cp /opt/CouchPotato/init/ubuntu /etc/init.d/couchpotato
chmod +x /etc/init.d/couchpotato
update-rc.d couchpotato defaults
service couchpotato start
echo "CouchPotato is running on $showip:5050"
echo "Configure CouchPotato at HTPCGuides.com http://goo.gl/uwaTUI"
}
install_mylar (){
#--------------------------------------------------------------------------------------------------------------------------------
# mylar
#--------------------------------------------------------------------------------------------------------------------------------
MYLARUSER=$(whiptail --inputbox "Enter the user to run Mylar as (usually pi)" 8 78 "pi" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
if ! getent passwd $MYLARUSER > /dev/null; then
echo "User $MYLARUSER doesn't exist, exiting, restart the installer"
exit
fi
debconf-apt-progress -- apt-get install -y python
git clone https://github.com/evilhero/mylar -b development /opt/Mylar
chown -R $MYLARUSER:$MYLARUSER /opt/Mylar
cat > /etc/default/mylar<<EOF
MYLAR_USER=$MYLARUSER
MYLAR_HOME=/opt/Mylar
MYLAR_DATA=/opt/Mylar
MYLAR_PORT=8090
EOF
cp /opt/Mylar/init-scripts/ubuntu.init.d /etc/init.d/mylar
chmod +x /etc/init.d/mylar
update-rc.d mylar defaults
service mylar start
echo "Mylar is running on $showip:8090"
echo "Configure Mylar at HTPCGuides.com http://goo.gl/KVFfMS"
}
install_lazylibrarian (){
#--------------------------------------------------------------------------------------------------------------------------------
# lazylibrarian
#--------------------------------------------------------------------------------------------------------------------------------
LAZYLIBRARIANUSER=$(whiptail --inputbox "Enter the user to run LazyLibrarian as (usually pi)" 8 78 "pi" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
if ! getent passwd $LAZYLIBRARIANUSER > /dev/null; then
echo "User $LAZYLIBRARIANUSER doesn't exist, exiting, restart the installer"
exit
fi
unrartest
debconf-apt-progress -- apt-get install python python-cherrypy git -y
git clone https://github.com/philborman/LazyLibrarian /opt/lazylibrarian
chown -R $LAZYLIBRARIANUSER:$LAZYLIBRARIANUSER /opt/lazylibrarian
cat > /etc/default/lazylibrarian <<EOF
# [required] set path where lazylibrarian is installed:
APP_PATH=/opt/lazylibrarian
# [optional] change to 1 to enable daemon
ENABLE_DAEMON=1
# [required] user or uid of account to run the program as:
RUN_AS=$LAZYLIBRARIANUSER
# [optional] change to 1 to enable updating from webinterface
# this changes ownership of /opt/lazylibrarian to user set @ RUN_AS
WEB_UPDATE=1
PORT=5299
PID_FILE=/opt/lazylibrarian/lazylibrarian.pid
EOF
cp /opt/lazylibrarian/init/ubuntu.initd /etc/init.d/lazylibrarian
chmod +x /etc/init.d/lazylibrarian
update-rc.d lazylibrarian defaults
echo "LazyLibrarian will run on $showip:5299 after reboot"
}
install_headphones (){
#--------------------------------------------------------------------------------------------------------------------------------
# headphones
#--------------------------------------------------------------------------------------------------------------------------------
HPUSER=$(whiptail --inputbox "Enter the user to run Headphones as (usually pi)" 8 78 "pi" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
if ! getent passwd $HPUSER > /dev/null; then
echo "User $HPUSER doesn't exist, exiting, restart the installer"
exit
fi
debconf-apt-progress -- apt-get install -y python
git clone https://github.com/rembo10/headphones.git /opt/headphones
chown -R $HPUSER:$HPUSER /opt/headphones
cat > /etc/default/headphones<<EOF
HP_USER=$HPUSER
HP_HOME=/opt/headphones
HP_PORT=8181
EOF
cp /opt/headphones/init-scripts/init.ubuntu /etc/init.d/headphones
chmod +x /etc/init.d/headphones
update-rc.d headphones defaults
service headphones start
sleep 15
service headphones stop
sed -i "/http_host = /c\http_host = 0.0.0.0" /opt/headphones/config.ini
service headphones start
echo "Headphones is running on $showip:8181"
#echo "Configure Headphones at HTPCGuides.com "
}
install_sabnzbd (){
#--------------------------------------------------------------------------------------------------------------------------------
# sabnzbd
#--------------------------------------------------------------------------------------------------------------------------------
SABUSER=$(whiptail --inputbox "Enter the user to run Sabnzbd as (usually pi)" 8 78 "pi" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
if ! getent passwd $SABUSER > /dev/null; then
echo "User $SABUSER doesn't exist, exiting, restart the installer"
exit
fi
SABHOST=$(whiptail --inputbox "Enter the host to run Sabnzbd as (enter 0.0.0.0 if you don't know)" 8 78 "0.0.0.0" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
SABPORT=$(whiptail --inputbox "Enter the port to run Sabnzbd as (enter 8080 if you want the default)" 8 78 "8080" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
unrartest
debconf-apt-progress -- apt-get install -y python-gdbm
debconf-apt-progress -- apt-get install -y python2.6
debconf-apt-progress -- apt-get install -y python-cheetah python-openssl python-pip par2 unzip
if !(cat /etc/apt/sources.list | grep -q Sabnzbd > /dev/null);then
cat >> /etc/apt/sources.list.d/sabnzbdplus.list <<EOF
# Sabnzbd
deb http://ppa.launchpad.net/jcfp/ppa/ubuntu precise main
EOF
sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net:11371 --recv-keys 0x98703123E0F52B2BE16D586EF13930B14BB9F05F
fi
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get install sabnzbdplus -y
pip install sabyenc
cat > /etc/default/sabnzbdplus <<EOF
USER=$SABUSER
HOST=$SABHOST
PORT=$SABPORT
EOF
sudo service sabnzbdplus restart
echo "Sabnzbd is running on $showip:$SABPORT"
echo "Configure Sabnzbd at HTPCGuides.com http://goo.gl/MPCVXu"
}
install_htpcmanager (){
#--------------------------------------------------------------------------------------------------------------------------------
# htpcmanager
#--------------------------------------------------------------------------------------------------------------------------------
HTPCUSER=$(whiptail --inputbox "Enter the user to run HTPC Manager as (usually pi)" 8 78 "pi" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
if ! getent passwd $HTPCUSER > /dev/null; then
echo "User $HTPCUSER doesn't exist, exiting, restart the installer"
exit
fi
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get install build-essential git python-imaging python-dev python-setuptools python-pip vnstat smartmontools -y
pip install psutil
git clone https://github.com/Hellowlol/HTPC-Manager /opt/HTPCManager
chown -R $HTPCUSER:$HTPCUSER /opt/HTPCManager
cp /opt/HTPCManager/initscripts/initd /etc/init.d/htpcmanager
sed -i "/APP_PATH=/c\APP_PATH=/opt/HTPCManager" /etc/init.d/htpcmanager
chmod +x /etc/init.d/htpcmanager
update-rc.d htpcmanager defaults
service htpcmanager start
echo "HTPC Manager is running on $showip:8085"
}
install_cherrymusic (){
#--------------------------------------------------------------------------------------------------------------------------------
# cherrymusic
#--------------------------------------------------------------------------------------------------------------------------------
CHERRYUSER=$(whiptail --inputbox "Enter the user to run CherryMusic as (usually pi)" 8 78 "pi" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
CHERRYPORT=$(whiptail --inputbox "Enter the port to run CherryMusic on (default 7600)" 8 78 "7600" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
if ! getent passwd $CHERRYUSER > /dev/null; then
echo "User $CHERRYUSER doesn't exist, exiting, restart the installer"
exit
fi
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get install python python-pip git python-unidecode sqlite -y
pip install CherryPy==3.6
debconf-apt-progress -- apt-get install imagemagick lame vorbis-tools flac -y
git clone --branch devel https://github.com/devsnd/cherrymusic.git /opt/cherrymusic
chown -R $CHERRYUSER:$CHERRYUSER /opt/cherrymusic
#if !(crontab -l -u $CHERRYUSER | grep -q cherrymusic > /dev/null);then
#crontab -u $CHERRYUSER -l | { cat; echo "@reboot cd /opt/cherrymusic ; /usr/bin/python cherrymusic"; } | crontab -u $CHERRYUSER -
#fi
cd /etc/init.d/
wget https://raw.github.com/blindpet/MediaServerInstaller/usenet/scripts/cherrymusic
sed -i "/DAEMON_USER=/c\DAEMON_USER=$CHERRYUSER" /etc/init.d/cherrymusic
chmod +x /etc/init.d/cherrymusic
update-rc.d cherrymusic defaults
#whiptail --title "HTPC Guides Media Installer" --msgbox "When you see 'Open your browser and put the server IP:$CHERRYPORT' in the address bar, create the admin account and then Ctrl+C in Terminal to continue" 8 78
echo "sudo -u $CHERRYUSER python /opt/cherrymusic/cherrymusic --setup --port $CHERRYPORT"
echo "Run the above sudo command to setup cherrymusic in admin mode on $showip:$CHERRYPORT to create the admin user"
echo "Reboot and CherryMusic will autostart"
}
install_ubooquity (){
#--------------------------------------------------------------------------------------------------------------------------------
# install Ubooquity
#--------------------------------------------------------------------------------------------------------------------------------
UBOOQUITYUSER=$(whiptail --inputbox "Enter the user to run Ubooquity as (usually pi)" 8 78 "pi" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
if ! getent passwd $UBOOQUITYUSER > /dev/null; then
echo "User $UBOOQUITYUSER doesn't exist, exiting, restart the installer"
exit
fi
debconf-apt-progress -- apt-get install unzip -y
javatest
mkdir -p /opt/ubooquity
cd /opt/ubooquity
wget "http://vaemendis.net/ubooquity/service/download.php" -O ubooquity.zip
unzip ubooquity*.zip
rm ubooquity.zip
chown -R $UBOOQUITYUSER:$UBOOQUITYUSER /opt/ubooquity
#if !(crontab -l -u $UBOOQUITYUSER | grep -q Ubooquity.jar > /dev/null);then
#crontab -u $UBOOQUITYUSER -l | { cat; echo "PATH_UBOOQUITY=/opt/ubooquity
#@reboot sleep 180 && cd \$PATH_UBOOQUITY && nohup java -jar \$PATH_UBOOQUITY/Ubooquity.jar -webadmin -headless -port 2202"; } | crontab -u $UBOOQUITYUSER -
#fi
cd /etc/init.d/
wget https://raw.github.com/blindpet/MediaServerInstaller/usenet/scripts/ubooquity
sed -i "/DAEMON_USER=/c\DAEMON_USER=$UBOOQUITYUSER" /etc/init.d/ubooquity
chmod +x /etc/init.d/ubooquity
update-rc.d ubooquity defaults
echo "Ubooquity will run on $showip:2022 will autostart on boot"
echo "Copy this to execute Ubooquity: cd /opt/ubooquity && java -jar /opt/ubooquity/Ubooquity.jar -webadmin -headless -port 2022"
echo "You must exit root mode before executing Ubooquity!"
echo "Use $showip:2022/admin for initial setup"
echo "Ubooquity configuration guide at HTPCGuides.com http://goo.gl/hEaUh5"
}
install_madsonic (){
#--------------------------------------------------------------------------------------------------------------------------------
# install Madsonic
#--------------------------------------------------------------------------------------------------------------------------------
MADSONICUSER=$(whiptail --inputbox "Enter the user to run Madsonic as (usually pi)" 8 78 "pi" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
if ! getent passwd $MADSONICUSER > /dev/null; then
echo "User $MADSONICUSER doesn't exist, exiting, restart the installer"
exit
fi
javatest
MADSONIC=$(wget -q http://beta.madsonic.org/pages/download.jsp -O - | grep .deb | awk -F "[\"]" ' NR==1 {print $2}')
MADSONICVER=$(echo $MADSONIC | awk 'match($0, /[0-9]\.[0-9]/) {print substr($0, RSTART, RLENGTH)}')
MADSONICFILE=$(echo $MADSONIC | awk 'match($0, /[0-9][0-9].+/) {print substr($0, RSTART, RLENGTH)}')
wget http://www.madsonic.org/download/$MADSONICVER/$MADSONICFILE -O madsonic.deb
dpkg -i madsonic.deb
rm madsonic.deb
debconf-apt-progress -- apt-get install libav-tools xmp lame flac -y
rm /var/madsonic/transcode/ffmpeg
rm /var/madsonic/transcode/lame
rm /var/madsonic/transcode/xmp
rm /var/madsonic/transcode/flac
ln -s /usr/bin/avconv /var/madsonic/transcode/ffmpeg
ln -s /usr/bin/flac /var/madsonic/transcode/flac
ln -s /usr/bin/xmp /var/madsonic/transcode/xmp
ln -s /usr/bin/lame /var/madsonic/transcode/lame
sed -i "/MADSONIC_USER=/c\MADSONIC_USER=$MADSONICUSER" /etc/default/madsonic
service madsonic start
echo "Madsonic will run on $showip:4040 and autostart on boot"
echo "Use $showip:4040 for initial Madsonic setup"
}
install_subsonic (){
#--------------------------------------------------------------------------------------------------------------------------------
# install Subsonic
#--------------------------------------------------------------------------------------------------------------------------------
SUBSONICUSER=$(whiptail --inputbox "Enter the user to run Subsonic as (usually pi)" 8 78 "pi" --title "$SECTION" 3>&1 1>&2 2>&3)
exitstatus=$?; if [ $exitstatus = 1 ]; then exit 1; fi
if ! getent passwd $SUBSONICUSER > /dev/null; then
echo "User $SUBSONICUSER doesn't exist, exiting, restart the installer"
exit
fi
javatest
SUBSONIC=$(wget -q http://www.subsonic.org/pages/download.jsp -O - | grep .deb | awk -F "[\"]" ' NR==1 {print $2}')
SUBSONICFILE=$(echo $SUBSONIC | awk 'match($0, /subsonic.+\.deb$/) {print substr($0, RSTART, RLENGTH)}')
cd /tmp
wget http://subsonic.org/download/$SUBSONICFILE -O subsonic.deb
dpkg -i subsonic.deb
rm subsonic.deb
sed -i "/SUBSONIC_USER=/c\SUBSONIC_USER=$SUBSONICUSER" /etc/default/subsonic
debconf-apt-progress -- apt-get install libav-tools xmp lame flac -y
rm /var/subsonic/transcode/ffmpeg
rm /var/subsonic/transcode/lame
rm /var/subsonic/transcode/xmp
rm /var/subsonic/transcode/flac
ln -s /usr/bin/avconv /var/subsonic/transcode/ffmpeg
ln -s /usr/bin/flac /var/subsonic/transcode/flac
ln -s /usr/bin/xmp /var/subsonic/transcode/xmp
ln -s /usr/bin/lame /var/subsonic/transcode/lame
service subsonic start
echo "Subsonic will run on $showip:4040 and autostart on boot"
echo "Use $showip:4040 for initial Subsonic setup"
}
install_nfs (){
#--------------------------------------------------------------------------------------------------------------------------------
# install NFS
#--------------------------------------------------------------------------------------------------------------------------------
debconf-apt-progress -- apt-get -y install nfs-server nfs-common
echo "NFS is installed, configure on HTPCGuides.com http://goo.gl/njEc6C"
}
install_plex (){
#--------------------------------------------------------------------------------------------------------------------------------
# install PlexWheezy
#--------------------------------------------------------------------------------------------------------------------------------
if ! uname -a | grep -E "armv7|686|x86_64" > /dev/null; then
echo You are not using an armv7, x86 or x64 device...
exit 1
fi
debconf-apt-progress -- apt-get update
apt-get install libc6 libexpat1 -y
lddtest=$(ldd --version | awk 'NR==1{print $5}')
if [[ "$lddtest" == 2.13 ]]; then
plexrepo=wheezy
else
plexrepo=jessie
fi
if ! locale -a | grep -i en_US > /dev/null; then
sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/Ig' /etc/locale.gen
/usr/sbin/locale-gen en_US.UTF-8
echo "Attempted to generate locales"
fi
#if uname -a | grep -i arm > /dev/null; then
#PLEXARCH=ARM
#else
#PLEXARCH=x86
#fi
if [ $ARCH == ARM ]; then
if !(cat /etc/apt/sources.list.d/pms.list | grep -q Plex > /dev/null);then
cat > /etc/apt/sources.list.d/pms.list <<EOF
# Plex
deb http://dev2day.de/pms/ $plexrepo main
EOF
wget -O - http://dev2day.de/pms/dev2day-pms.gpg.key | apt-key add -
fi
fi
if [ $ARCH == x86 ]; then
if !(cat /etc/apt/sources.list.d/plex.list | grep -q Plex > /dev/null);then
wget -O - http://shell.ninthgate.se/packages/shell.ninthgate.se.gpg.key | sudo apt-key add -
cat >> /etc/apt/sources.list.d/plex.list <<EOF
# Plex
deb http://www.deb-multimedia.org wheezy main non-free
deb http://shell.ninthgate.se/packages/debian wheezy main
EOF
apt-get update
apt-get install deb-multimedia-keyring -y --force-yes
fi
fi
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get install plexmediaserver -y
echo "Plex is running on $showip:32400/web and will autostart on boot"
echo "Configuration guides on HTPCGuides.com and force transcoding http://goo.gl/avCu85"
echo "If Plex isn't running try running manually with bash /usr/lib/plexmediaserver/start.sh"
echo "You may need to go here for troubleshooting locales: http://goo.gl/M063Oi"
}
install_kodi (){
#--------------------------------------------------------------------------------------------------------------------------------
# install kodi raspberry pi
#--------------------------------------------------------------------------------------------------------------------------------
if ! uname -a | grep -E "minibian|raspberrypi" > /dev/null; then
echo not Raspberry Pi...
exit 1
else
rm /etc/apt/sources.list.d/mene.list
cat > /etc/apt/sources.list.d/mene.list <<EOF
deb http://archive.mene.za.net/raspbian jessie contrib
EOF
apt-key adv --keyserver keyserver.ubuntu.com --recv-key 5243CDED
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get install kodi -y
addgroup --system input
usermod -a -G audio,video,input,dialout,plugdev,tty kodi
usermod -a -G input kodi
cat > /etc/udev/rules.d/99-input.rules <<EOF
SUBSYSTEM=="input", GROUP="input", MODE="0660"
KERNEL=="tty[0-9]*", GROUP="tty", MODE="0660"
EOF
#echo "ENABLED=1" > /etc/default/kodi
sed -i s'/ENABLED=0/ENABLED=1/' /etc/default/kodi
sed -i "/gpu_mem=/c\gpu_mem=128" /boot/config.txt
echo "Kodi has been installed, reboot"
fi
}
install_pyload (){
#--------------------------------------------------------------------------------------------------------------------------------
# install pyload
#--------------------------------------------------------------------------------------------------------------------------------
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get install python-support python-crypto python-pycurl tesseract-ocr tesseract-ocr-eng python-imaging -y
debconf-apt-progress -- apt-get install python-pip python-dev -y
debconf-apt-progress -- apt-get install rhino -y
pip install pyopenssl
unrartest
PYLOADVER=$(wget -q https://github.com/pyload/pyload/releases -O - | grep -E \/tag\/ | awk -F "[\/\"]" 'NR==1 {print $7}')
PYLOADVERDEB=$(wget -q https://github.com/pyload/pyload/releases -O - | grep -E pyload-cli.+all.deb | awk -F "[\/\"]" 'NR==1 {print $8}')
wget --no-check-certificate https://github.com/pyload/pyload/releases/download/$PYLOADVER/$PYLOADVERDEB
dpkg -i pyload*
rm pyload*
update-rc.d pyload defaults
echo "Type pyLoadCore -s for initial setup"
}
install_minidlna (){
#--------------------------------------------------------------------------------------------------------------------------------
# install minidlna
#--------------------------------------------------------------------------------------------------------------------------------
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get install autopoint debhelper dh-autoreconf gcc libavutil-dev libavcodec-dev libavformat-dev libjpeg-dev libsqlite3-dev libexif-dev libid3tag0-dev libogg-dev libvorbis-dev libflac-dev -y
cd /tmp
wget http://sourceforge.net/projects/minidlna/files/latest/download?source=files -O minidlna.tar.gz
tar -xvf minidlna*.tar.gz
cd minidlna*
cpunum=$(nproc)
./configure && make -j$cpunum && make install
cp minidlna.conf /etc/
cp linux/minidlna.init.d.script /etc/init.d/minidlna
chmod +x /etc/init.d/minidlna