forked from Mar2zz/LaSi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LaSi_syn.sh
executable file
·921 lines (775 loc) · 28.6 KB
/
LaSi_syn.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
#!/bin/sh
# Author: Mar2zz
# blogs: mar2zz.tweakblogs.net
# License: GNU GPL v3
#
# This is the main script of "Lazy Admins Scripted Installers (LaSi) for Synology"
#
# please report bugs/issues @
# https://github.com/Mar2zz/LaSi/issues
# ___________________________________________________________________________________
# |
# | execute this script with the command: chmod +x LaSi_syn.sh
# | then run with ./LaSi.sh
# |
# | LaSi will install the programs you choose
# | from the menu:
# | # Beets
# | # CouchPotato
# | # Headphones
# | # Sickbeard
# | # Spotweb
# | # Subliminal
# |___________________________________________________________________________________
#
#
#######################################################################################
#######################################################################################
#### v0.1 ####
#######################################################################################
#################### LIST OF VARIABLES USED ###########################################
#SET SOME VARIABLES (SOME VARIABLES WILL BE SET THROUGH LIVE USERINPUT IN TERMINAL)
dropbox=http://dl.dropbox.com/u/18712538/Synology; # dropbox-adres
hostname=$(uname -n)
#######################################################################################
#######################################################################################
#### ERROR MESSAGE ####
error_Msg () {
echo "
Failed! Installing $set_app didn't finish, try again or:
Copy the text above and report an issue at the following address:
https://github.com/Mar2zz/LaSi/issues
"
exit 1
}
#### BEST PRACTICE ####
check_Ipkg () {
if ! which ipkg; then
echo "
Bootstrap is not installed, please install it before using this script
Information on how to install bootstrap can be found at:
http://forum.synology.com/wiki/index.php/Overview_on_modifying_the_Synology_Server,_bootstrap,_ipkg_etc#How_to_install_ipkg
"
exit
fi
}
check_Git () {
if ! which git > /dev/null; then
ipkg install git || error_Msg
fi
}
check_Editor () {
if which nano > /dev/null; then
writer=nano
elif which vi > /dev/null; then
writer=vi
else
echo "No editor found"
fi
}
check_DSM () {
## do some stuff in the webinterface
echo "
# Go to your DSM:
# Control Panel -> Users -> Create user
# and create a user called \"$app_low\"
# Press the Ok button
#
# Press a button to continue this installer
(if you have done all of the above settings)"
read -sn 1 -p '--- [continue]---'
}
check_DSM_web () {
echo "
# Go to your DSM:
# Control Panel -> Web Services -> Web Applications -> Check 'Enable Web Station' and 'Enable MySQL'
# Control Panel -> Web Services -> PHP Settings:
# Under 'Select PHP extension': Make sure that the following items are checked: gd, mysql, openssl, zip, zlib
# Press the Ok button"
read -sn 1 -p '--- [continue]---'
}
check_DSM_users () {
echo "
# Go to your DSM:
# Control Panel -> User -> User Home and enable it for the users that will run $set_app
# Press the Ok button"
read -sn 1 -p '--- [continue]---'
}
# check if fast install is enabled
option=$1
check_Variables () {
unattended=0
case $option in
--fast)
unattended=1 ;;
esac
}
LaSi_Menu () {
clear
echo " Lazy admin Scripted installers -----------------------"
echo " ___ ___ "
echo " /\ \ /\__\ "
echo " /::\ \ /:/ _/_ ___ "
echo " /:/\:\ \ /:/ /\ \ /\__\ "
echo " ___ ___ /:/ /::\ \ /:/ /::\ \ /:/__/ "
echo " /\ \ /\__\ /:/_/:/\:\__\ /:/_/:/\:\__\ /::\ \ "
echo " \:\ \ /:/ / \:\/:/ \/__/ \:\/:/ /:/ / \/\:\ \__ "
echo " \:\ /:/ / \::/__/ \::/ /:/ / \:\/\__\ "
echo " \:\/:/ / \:\ \ \/_/:/ / \::/ / "
echo " \::/ / \:\__\ /:/ / /:/ / "
echo " \/__/ \/__/ \/__/ \/__/ "
echo
echo "----------------------------------------------- Mar2zz "
echo
echo
show_Menu () {
echo "Make a choice to see info or install these apps..."
echo "1. Beets 4. SickBeard"
echo "2. CouchPotato 5. Spotweb"
echo "3. Headphones 6. Subliminal"
echo " "
[ $unattended = 0 ] && echo "Tip: Type ./LaSi_syn.sh --fast for fast install!"
echo "Q. Quit"
echo " "
read -p "Choose an option: " SELECT
case "$SELECT" in
1)
set_app=Beets
app_low=beets
if [ $unattended = 1 ]; then Install_$set_app; else Info_$set_app; fi
;;
2)
set_app=CouchPotato
app_low=couchpotato
if [ $unattended = 1 ]; then Install_$set_app; else Info_$set_app; fi
;;
3)
set_app=Headphones
app_low=headphones
if [ $unattended = 1 ]; then Install_$set_app; else Info_$set_app; fi
;;
4)
set_app=SickBeard
app_low=sickbeard
if [ $unattended = 1 ]; then Install_$set_app; else Info_$set_app; fi
;;
5)
set_app=Spotweb
app_low=spotweb
if [ $unattended = 1 ]; then Install_$set_app; else Info_$set_app; fi
;;
6)
set_app=Subliminal
app_low=subliminal
if [ $unattended = 1 ]; then Install_$set_app; else Info_$set_app; fi
;;
Qq*)
exit
;;
*)
echo "Please make a selection..."
echo
show_Menu
;;
esac
}
show_Menu
}
###############
#### BEETS ####
###############
Info_Beets () {
clear
echo "
*###############################################################*
*################### BEETS #####################################*
# #
# Beets is the media library management system for #
# obsessive-compulsive music geeks. #
# #
# The purpose of beets is to get your music collection right #
# once and for all. It catalogs your collection, automatically #
# improving its metadata as it goes using the MusicBrainz #
# database. It then provides a bouquet of tools for #
# manipulating and accessing your music. #
# #
*###############################################################*
# #
# Beets is written by Adrian Sampson.. #
# #
# Visit http://beets.radbox.org/ #
*###############################################################*"
cf_Choice
}
Install_Beets () {
cfg_path=/volume1/@appstore/.$app_low
# dependencys
ipkg install textutils || error_Msg
if ! [ -e /opt/bin/python2.6 ]; then
ipkg install python26 || error_Msg
fi
if ! which easy_install > /dev/null; then
ipkg install py26-setuptools || error_Msg
fi
if ! easy_install pip; then
if ! which curl > /dev/null; then
ipkg install curl || error_Msg
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
fi
fi
/opt/local/bin/pip install beets || error_Msg
# Set configfile!
if ! [ -e $HOME ]; then
echo "Beets needs a .beetsconfig in the home directory of the user running beets"
echo "Please enable home-directory for the user that will use Beets in DSM"
check_DSM_users
fi
[ -d $cfg_path ] || mkdir -p $cfg_path
if ! [ -e $cfg_path/.beetsconfig-sample ]; then
echo "Saving a basic .beetsconfig-sample in $cfg_path, edit it and copy it to the home-folders ..."
echo "Command: cp -f $cfg_path/.beetsconfig-sample /home/''user-running-beets''/.beetsconfig"
wget -O $cfg_path/.beetsconfig-sample $dropbox/$app_low/beetsconfig-sample || error_Msg
fi
Summ_Beets
}
Summ_Beets () {
echo "
Done! Installed $set_app.
Type /opt/local/bin/beet --help for options or
start importing music with /opt/local/bin/beet import /path/to/music.
"
}
#####################
#### COUCHPOTATO ####
#####################
Info_CouchPotato () {
clear
echo "
*###############################################################*
*###################### COUCHPOTATO ############################*
# #
# CouchPotato is an automatic NZB and torrent downloader. #
# You can keep a 'movies I want'-list and it will search #
# for NZBs/torrents of these movies every X hours. #
# #
# Once a movie is found, it will send it to SABnzbd #
# or download the .nzb or .torrent to a specified directory. #
# #
*###############################################################*
# #
# CouchPotato is written by Ruud Burger in his spare time... #
# ..so buy him a coke to support him. #
# #
# Visit http://www.couchpotatoapp.com #
*###############################################################*"
cf_Choice
}
Install_CouchPotato () {
check_Git
# installpath
app_path=/volume1/@appstore/$app_low
cfg_path=/volume1/@appstore/.$app_low
# dependencys
ipkg install textutils || error_Msg
if ! [ -e /opt/bin/python2.6 ]; then
ipkg install python26 || error_Msg
fi
# create the new configdir
mkdir -p /volume1/@appstore/.$app_low
# before downloading source from git, save personal stuff if not in cfg_path allready
# config.ini
if ! [ -e $cfg_path/config.ini ]; then
[ -e $app_path/config.ini ] && mv -f $app_path/config.ini $cfg_path/config.ini
fi
# database
if ! [ -e $cfg_path/data.db ]; then
[ -e $app_path/data.db ] && mv -f $app_path/data.db $cfg_path/data.db
fi
# cache (images and stuff)
if ! [ -d $cfg_path/cache ]; then
[ -d $app_path/cache ] && mv -f $app_path/cache $cfg_path/cache
fi
# download source from git
if [ -d $app_path ]; then
echo "Start fresh, removing $app_path ..."
rm -Rf $app_path
else
git clone git://github.com/RuudBurger/CouchPotato.git $app_path || error_Msg
fi
# provide startupscript, thx to brickman
echo "
Downloading Brickman's modified startupscript for $set_app ...
"
wget -O /opt/etc/init.d/S99$app_low.sh $dropbox/$app_low/S99$app_low.sh || error_Msg
chmod a+x /opt/etc/init.d/S99$app_low.sh || error_Msg
# set config.ini, as couchpotato tries to run on 5000, set it to 5050 if none set allready
if ! [ -e $cfg_path/config.ini ]; then
wget -O $cfg_path/config.ini $dropbox/$app_low/config.ini || error_Msg
fi
/opt/etc/init.d/S99$app_low.sh start || error_Msg
Summ_$set_app
}
Summ_CouchPotato () {
echo "
Done! Installed $set_app.
$set_app is by default located @ http://$hostname:5050
"
}
####################
#### HEADPHONES ####
####################
Info_Headphones () {
clear
echo "
*###############################################################*
*###################### HEADPHONES #############################*
# #
# Headphones is an automatic NZB downloader. #
# You can keep a 'musicalbums I want'-list and it will search #
# for NZBs of these albums every X hours. #
# #
# It is also possible to 'follow' artists for upcoming albums. #
# #
# Once an album is found, it will send it to SABnzbd. #
# #
*###############################################################*
# #
# Headphones is written by Rembo10 in his spare time... #
# #
# Visit https://github.com/rembo10/headphones #
*###############################################################*"
cf_Choice
}
Install_Headphones () {
check_Git
# installpath
app_path=/volume1/@appstore/$app_low
cfg_path=/volume1/@appstore/.$app_low
# dependencys
ipkg install textutils || error_Msg
if ! [ -e /opt/bin/python2.6 ]; then
ipkg install python26 || error_Msg
fi
# create the new configdir
mkdir -p /volume1/@appstore/.$app_low
# before downloading source from git, save personal stuff if not in cfg_path allready
# config.ini
if ! [ -e $cfg_path/config.ini ]; then
[ -e $app_path/config.ini ] && mv -f $app_path/config.ini $cfg_path/config.ini
fi
# database
if ! [ -e $cfg_path/headphones.db ]; then
[ -e $app_path/headphones.db ] && mv -f $app_path/headphones.db $cfg_path/headphones.db
fi
# cache (images and stuff)
if ! [ -d $cfg_path/cache ]; then
[ -d $app_path/cache ] && mv -f $app_path/cache $cfg_path/cache
fi
# download source from git
if [ -d $app_path ]; then
echo "Start fresh, removing $app_path ..."
rm -Rf $app_path
else
git clone https://github.com/rembo10/headphones.git || error_Msg
fi
# provide startupscript, thx to brickman
echo "
Downloading Brickman's modified startupscript for $set_app ...
"
wget -O /opt/etc/init.d/S99$app_low.sh $dropbox/$app_low/S99$app_low.sh || error_Msg
chmod a+x /opt/etc/init.d/S99$app_low.sh || error_Msg
/opt/etc/init.d/S99$app_low.sh start || error_Msg
Summ_$set_app
}
Summ_Headphones () {
echo "
Done! Installed $set_app.
$set_app is by default located @ http://$hostname:8181
"
}
###################
#### SICKBEARD ####
###################
Info_SickBeard () {
clear
echo "
*###############################################################*
*####################### SICKBEARD #############################*
# #
# Sick Beard is a PVR for newsgroup and torrent users. It #
# watches for new episodes of your favorite shows and when they #
# are posted it downloads them, sorts and renames them, and #
# optionally generates metadata for them. #
# #
# Features include: #
# - automatically retrieves new episode torrent or nzb files #
# - can scan your existing library and then download any #
# old seasons or episodes you're missing #
# - can watch for better versions and upgrade your existing #
# episodes (from TV to DVD/BluRay for example) #
# #
*###############################################################*
# #
# SickBeard is written by midgetspy #
# #
# Visit http://www.sickbeard.com #
*###############################################################*"
cf_Choice
}
Install_SickBeard () {
check_Git
# installpath
app_path=/volume1/@appstore/$app_low
cfg_path=/volume1/@appstore/.$app_low
# dependencys
ipkg install textutils || error_Msg
ipkg install py26-cheetah || error_Msg
if ! [ -e /opt/bin/python2.6 ]; then
ipkg install python26 || error_Msg
fi
# create the new configdir
mkdir -p /volume1/@appstore/.$app_low
# before downloading source from git, save personal stuff if not in cfg_path allready
# config.ini
if ! [ -e $cfg_path/config.ini ]; then
[ -e $app_path/config.ini ] && mv -f $app_path/config.ini $cfg_path/config.ini
fi
# database
if ! [ -e $cfg_path/sickbeard.db ]; then
[ -e $app_path/sickbeard.db ] && mv -f $app_path/sickbeard.db $cfg_path/sickbeard.db
[ -e $app_path/sickbeard.db.v0 ] && mv -f $app_path/sickbeard.db.v0 $cfg_path/sickbeard.db.v0
fi
# cache (images and stuff)
if ! [ -d $cfg_path/cache ]; then
[ -d $app_path/cache ] && mv -f $app_path/cache $cfg_path/cache
[ -e $app_path/cache.db ] && mv -f $app_path/cache.db $cfg_path/cache.db
fi
# autoprocesstv.cfg
if ! [ -e $cfg_path/autoProcessTV/autoProcessTV.cfg ]; then
[ -e $app_path/autoProcessTV/autoProcessTV.cfg ] && mv -f $app_path/autoProcessTV/autoProcessTV.cfg $cfg_path/autoProcessTV/autoProcessTV.cfg
fi
# download source from git
if [ -d $app_path ]; then
echo "Start fresh, removing $app_path ..."
rm -Rf $app_path
else
git clone git://github.com/midgetspy/Sick-Beard.git $app_path || error_Msg
fi
# set autoProcesstv.cfg
[ -e $cfg_path/autoProcessTV/autoProcessTV.cfg ] && ln -s $cfg_path/autoProcessTV/autoProcessTV.cfg $app_path/autoProcessTV/autoProcessTV.cfg
# provide startupscript, thx to brickman
echo "
Downloading Brickman's modified startupscript for $set_app ...
"
wget -O /opt/etc/init.d/S99$app_low.sh $dropbox/$app_low/S99$app_low.sh || error_Msg
chmod a+x /opt/etc/init.d/S99$app_low.sh || error_Msg
/opt/etc/init.d/S99$app_low.sh start || error_Msg
Summ_$set_app
}
Summ_SickBeard () {
echo "
Done! Installed $set_app.
$set_app is by default located @ http://$hostname:8081
"
}
#################
#### SPOTWEB ####
#################
Info_Spotweb () {
clear
echo "
*###############################################################*
*####################### SPOTWEB ###############################*
# #
# SpotWeb is een versie van SpotNed voor een webserver #
# Het gebruikt PHP5 om de meeste functies te implementeren #
# en is getest op Linux en FreeBSD. #
# #
# Deze installer installeert alle benodigdheden voor Spotweb. #
# en installeert en configureert een apache/mysql-server indien #
# dat nodig is. #
# #
*###############################################################*
# #
# Spotweb is geschreven door Spotweb e.a. #
# #
# Visit https://github.com/spotweb/spotweb #
*###############################################################*"
cf_Choice
}
Install_Spotweb () {
# installpath
app_path=/volume1/web/$app_low
cfg_path=/volume1/@appstore/.$app_low
# enable webserver in DSM
check_DSM_web
check_Git
# dependencys
ipkg install textutils || error_Msg
# create configpath if it doesn't exist
[ -d $cfg_path ] || mkdir -p $cfg_path
# before downloading source from git, save personal stuff if not in cfg_path allready
# ownsettings.php
if ! [ -e $cfg_path/ownsettings.php ]; then
[ -e $app_path/ownsettings.php ] && mv -f $app_path/ownsettings.php $cfg_path/ownsettings.php
fi
# starting fresh
if [ -d $app_path ]; then
echo "Start fresh, removing $app_path ..."
rm -Rf $app_path
fi
# download source from git
git clone git://github.com/spotweb/spotweb.git $app_path || error_Msg
# symlink settingsfile if any, or create a new one
if [ -e $cfg_path/ownsettings.php ]; then
cp -f $cfg_path/ownsettings.php $app_path/ownsettings.php || error_Msg
else
wget -O $cfg_path/ownsettings.php $dropbox/$app_low/ownsettings.php || error_Msg
cp -f $cfg_path/ownsettings.php $app_path/ownsettings.php || error_Msg
fi
config_SQL () {
cf_SQL () {
echo
echo "Do you want to create a new database?"
echo "Warning: All existing info in an existing spotwebdatabase will be lost!"
read -p "[yes/no]: " DBREPLY
case $DBREPLY in
[YyJj]*)
cf_PW
new_database=1
;;
[Nn]*)
new_database=0
;;
*)
echo "Answer yes or no"
cf_SQL
;;
esac
}
# ask for mysql password
input_PW () {
stty_orig=`stty -g`
echo
echo "What is your mySQL password?"
# hide password when typed
stty -echo
echo "[mysql] password:"
read SQLPASSWORD
stty $stty_orig
create_DB
}
cf_PW () {
## Change mysql password?
echo "Do you know your mySQL password?"
read -p "[ yes/no ]: " REPLY
case $REPLY in
[YyJj]*)
input_PW
;;
[Nn]*)
set_Pass () {
# hide password when typed
stty_orig=`stty -g`
echo
stty -echo
read -p "Set a new password: " PASSWORD
read -p "Confirm new password: " PASSWORD2
stty $stty_orig
if [ "$PASSWORD" != "$PASSWORD2" ]; then
echo "Passwords do not match, try again"
set_Pass
else
SQLPASSWORD=$PASSWORD
create_DB
fi
}
set_Pass
;;
*)
echo "Answer yes or no"
cf_PW
;;
esac
}
create_DB () {
MYSQL=/usr/syno/mysql/bin/mysql
# check password
if ! $($MYSQL --password="$SQLPASSWORD" -e "SHOW DATABASES;" > /dev/null); then
echo "Password is wrong, try again"
input_PW
fi
# drop DB if it exists
if $($MYSQL --password="$SQLPASSWORD" -e "SHOW DATABASES;" | grep 'spotweb' > /dev/null); then
$MYSQL --password="$SQLPASSWORD" -e "DROP DATABASE spotweb;" > /dev/null
fi
# drop USER if it exists
if $($MYSQL --password="$SQLPASSWORD" -e "select user.user from mysql.user;" | grep 'spotweb' > /dev/null); then
$MYSQL --password="$SQLPASSWORD" -e "DROP USER 'spotweb'@'localhost';" > /dev/null
fi
# create DB
$MYSQL --password="$SQLPASSWORD" -e "
CREATE DATABASE spotweb;
CREATE USER 'spotweb'@'localhost' IDENTIFIED BY 'spotweb';
GRANT ALL PRIVILEGES ON spotweb.* TO spotweb @'localhost' IDENTIFIED BY 'spotweb';"
# check if database and user is created
if ! $($MYSQL --password="$SQLPASSWORD" -e "SHOW DATABASES;" | grep 'spotweb' > /dev/null); then
echo
echo "Creation of database failed, try again"
error_Msg
fi
if ! $($MYSQL --password="$SQLPASSWORD" -e "select user.user from mysql.user;" | grep 'spotweb' > /dev/null); then
echo
echo "Creation of user failed, try again"
error_Msg
fi
echo
echo "Created a database named spotweb for user spotweb with password spotweb"
echo
}
cf_SQL
}
config_SQL
# update database
cd $app_path && /usr/bin/php upgrade-db.php
cd - > /dev/null
cf_Retrieve () {
echo
echo "Do you want to retrieve spots now?"
read -p "[yes/no]: " RETRIEVE
case $RETRIEVE in
[YyJj]*)
if [ $new_database = 1 ]; then
echo
echo "You need to set your newsserver and other options first in spotweb."
echo "Go to http://ip_diskstation/spotweb/?page=editsettings"
echo "Login with admin / admin"
echo "and set it at the Nieuwsserver-tab, after that, continue ..."
read -sn 1 -p "Press a key to continue"
fi
echo "This will take a while!"
cd $app_path && /usr/bin/php retrieve.php
cd - > /dev/null
;;
[Nn]*)
;;
*)
echo "Answer yes or no"
cf_Retrieve
;;
esac
}
cf_Retrieve
Summ_Spotweb
}
Summ_Spotweb () {
echo "
Done! Installed $set_app.
$set_app is by default located @ http://$hostname/spotweb
"
}
####################
#### SUBLIMINAL ####
####################
Info_Subliminal () {
clear
echo "
*###############################################################*
*###################### SUBLIMINAL #############################*
# #
# Subliminal is a subtitles searching module written in python #
# that tries to find a correct match for a given video file. #
# The goal behind subliminal is that it will only return only #
# correct subtitles so that you can simply relax and #
# enjoy your video without having to double-check that #
# the subtitles match your video before watching it. #
# #
# It works great in a sabnzbd-postprocessingscript or when set #
# as a cronjob. Also checkout Sickbeards Subliminal branch! #
# #
*###############################################################*
# #
# Subliminal is written by Diaoul and based on Patrick's #
# Periscope. (http://code.google.com/p/periscope/) #
# #
# https://github.com/Diaoul/subliminal #
*###############################################################*"
cf_Choice
}
Install_Subliminal () {
# dependencys
ipkg install textutils || error_Msg
if ! [ -e /opt/bin/python2.6 ]; then
ipkg install python26 || error_Msg
fi
if ! which easy_install > /dev/null; then
ipkg install py26-setuptools || error_Msg
fi
if ! easy_install pip; then
if ! which curl > /dev/null; then
ipkg install curl || error_Msg
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
fi
fi
/opt/local/bin/pip install subliminal || error_Msg
/opt/local/bin/pip install argparse || error_Msg
Summ_$set_app
}
Summ_Subliminal () {
echo "
Done! Installed $set_app.
Type /opt/local/bin/subliminal --help for options
"
}
#### BACKTOMENU OR INSTALL ####
cf_Choice () {
echo
echo "Options:"
echo "1. Install $set_app"
echo "2. Back to menu"
echo "Q. Quit"
read -p "Choose an option: " SELECT
case "$SELECT" in
1)
cf_Install
;;
2)
LaSi_Menu
;;
[Qq]*)
exit
;;
*)
echo "Please choose..."
echo
cf_Choice
;;
esac
}
### CONFIRM INSTALL ###
cf_Install () {
echo
echo "Are you sure you want to continue and install $set_app?"
read -p "[yes/no]: " REPLY
case $REPLY in
[YyJj]*)
Install_$set_app
;;
[Nn]*)
LaSi_Menu
;;
[Qq]*)
exit
;;
*)
echo "Answer yes to install"
echo "no for menu"
echo "or Q to quit"
Question
;;
esac
}
### RUN ALL FUNCTIONS ###
check_Ipkg
check_Variables
LaSi_Menu