forked from Mar2zz/LaSi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LaSi_BSD.sh
executable file
·1857 lines (1705 loc) · 48.8 KB
/
LaSi_BSD.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
#!/usr/local/bin/bash
# Author: Mar2zz
# Email: [email protected]
# Blogs: mar2zz.tweakblogs.net
# License: GNU GPL v3
#
# Forked: Kriss1981
# Email : [email protected]
#
# This is the main script of "Lazy Admins Scripted Installers (LaSi)"
# FreeBSD Edition
#
# please report bugs/issues @
# https://github.com/Mar2zz/LaSi/issues
# ___________________________________________________________________________________
# |
# | execute this script with the command: sudo chmod +x LaSi.sh
# | then run with ./LaSi.sh
# |
# |
# | LaSi will install the programs you choose
# | from the menu:
# |
# | - AutoSub
# | - Beets
# | - CouchPotato
# | - Headphones
# | - LazyLibrarian (alpha stage)
# | - Maraschino
# | - SABnzbd
# | - Sickbeard
# | - SpotWeb
# | - Transmission
# |___________________________________________________________________________________
#
#######################################################################################
#######################################################################################
#### v0.2 ####
#######################################################################################
#######################################################################################
#####################
##### LaSi Menu #####
#####################
LaSi_Logo () {
clear
echo "Lazy admin Scripted installers ----------------- Mar2zz"
echo " ___ ___ "
echo " /\ \ /\__\ "
echo " /::\ \ /:/ _/_ ___ "
echo " /:/\:\ \ /:/ /\ \ /\__\ "
echo " ___ ___ /:/ /::\ \ /:/ /::\ \ /:/__/ "
echo " /\ \ /\__\ /:/_/:/\:\__\ /:/_/:/\:\__\ /::\ \ "
echo " \:\ \ /:/ / \:\/:/ \/__/ \:\/:/ /:/ / \/\:\ \__ "
echo " \:\ /:/ / \::/__/ \::/ /:/ / \:\/\__\ "
echo " \:\/:/ / \:\ \ \/_/:/ / \::/ / "
echo " \::/ / \:\__\ /:/ / /:/ / "
echo " \/__/ \/__/ \/__/ \/__/ "
echo
echo "FreeBSD Edition------------------------------ Kriss1981"
}
LaSi_Menu (){
LaSi_Logo
echo
echo "Make a choice to see info and/or install these apps..."
echo
echo "1. SABnzbd+ 6. LazyLibrarian (alpha stage)"
echo "2. AutoSub 7. Maraschino"
echo "3. Beets 8. SickBeard"
echo "4. CouchPotato 9. SpotWeb"
echo "5. Headphones 10. Transmission (incl. webinterface)"
echo
echo "Q. Quit"
read SELECT
# create array
items=( $SELECT )
# go through array one by one
for item in ${items[@]}; do
case $item in
# Sabnzbd
1)
SETAPP=Sabnzbd
APPLOW=sabnzbd
set_port=8080
Info_$SETAPP
;;
# Auto-Sub
2)
SETAPP=AutoSub
APPLOW=autosub
Info_$SETAPP
;;
# beets
3)
SETAPP=Beets
APPLOW=beets
Info_$SETAPP
;;
# Couchpotato
4)
SETAPP=CouchPotato
APPLOW=couchpotato
set_port=5000
Info_$SETAPP
;;
# Headphones
5)
SETAPP=Headphones
APPLOW=headphones
set_port=8181
Info_$SETAPP
;;
# LazyLibrarian
6)
SETAPP=LazyLibrarian
APPLOW=lazylibrarian
set_port=5299
Info_$SETAPP
;;
# maraschino
7)
SETAPP=Maraschino
APPLOW=maraschino
set_port=7000
Info_$SETAPP
;;
# Sickbeard
8)
SETAPP=SickBeard
APPLOW=sickbeard
set_port=8081
Info_$SETAPP
;;
# Spotweb
9)
SETAPP=Spotweb
APPLOW=spotweb
Info_$SETAPP
;;
# Transmission
10)
SETAPP=Transmission
APPLOW=transmission
set_port=9091
Info_$SETAPP
;;
[Qq]) exit ;;
*)
echo "Please make a selection (e.g. 1)"
LaSi_Menu
;;
esac
done
# see if install summary is needed, so count items in array
if [ ${#items[@]} -gt 1 ]; then
echo "*###############################################################*"
echo "*################### INSTALL SUMMARY ###########################*"
cat /tmp/LaSi/lasi_install.log
echo "*###############################################################*"
fi
# give time to read output from above installprocess before returning to menu
echo
read -sn 1 -p "Press a key to continue"
LaSi_Menu
}
####################
##### Auto-Sub #####
####################
Info_AutoSub () {
clear
echo "
*###############################################################*
*####################### Auto-Sub ##############################*
# #
# Auto-Sub is a subtitles searching module written in python #
# that tries to find a correct match for a given video file. #
# #
# It uses Bierdopje.com to find the correct subtitles and it #
# runs as a daemon, checking for new subtitles every X hours. #
# #
# Soon there will be a webinterface available #
# #
*###############################################################*
# #
# Auto-Sub project homepage #
# https://code.google.com/p/auto-sub/ #
# #
*###############################################################*"
cf_Choice
}
Install_AutoSub () {
check_App
check_mercurial
sudo hg clone -r eba1b3b0d4ff https://code.google.com/p/auto-sub/ $USRDIR/$APPLOW
chown -R $APPUSER $USRDIR/$APPLOW
if ! grep 'AutoSub.py' /etc/crontab > /dev/null; then
sudo echo "@reboot $APPUSER cd /usr/local/autosub/ && /usr/local/bin/python AutoSub.py > /dev/null" >> /etc/crontab
fi
Summ_$SETAPP
Summ_$SETAPP >> /tmp/lasi_install.log
}
Summ_AutoSub () {
clear
echo
echo "
Done! Installed $SETAPP.
Auto-Sub will automatically start at reboot.
"
}
###################
##### SABnzbd #####
###################
Info_Sabnzbd () {
clear
echo "
*###############################################################*
*###################### SABnzbdplus ############################*
# #
# SABnzbd is an Open Source Binary Newsreader written in Python.#
# #
# It's totally free, incredibly easy to use, and works #
# practically everywhere. #
# #
# SABnzbd makes Usenet as simple and streamlined as possible by #
# automating everything we can. All you have to do is add an #
# nzb.file and SABnzbd takes over from there, where it will be #
# automatically downloaded, verified, repaired, extracted and #
# filed away with zero human interaction. #
# #
*###############################################################*
# #
# Sabnzbdplus is written by the Sabnzbd-team #
# #
# Visit http://sabnzbd.org #
*###############################################################*"
cf_Choice
}
Install_Sabnzbd () {
if which SABnzbd.py > /dev/null; then
clear
echo
echo "SABnzbd is already installed"
echo
sleep 3
Info_Sabnzbd
else
pkg_Choice
if [ "$SETPKG" = "ports" ]; then
cd /usr/ports/news/sabnzbdplus &&
sudo make -DBATCH install clean || error_Msg
else
sudo pkg_add -r sabnzbdplus || error_Msg
fi
sudo chown -R $APPUSER $USRDIR/$APPLOW
set_RCD
fi
Summ_$SETAPP
Summ_$SETAPP >> /tmp/LaSi/lasi_install.log
}
Summ_Sabnzbd () {
clear
echo
echo "
Done! Installed $SETAPP.
Type sabnzbdplus --help for options
Sabnzbdplus is by default located @ http://$HOSTNAME:$set_port
"
}
#####################
##### 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_App
check_git
check_wget
check_python
sudo git clone https://github.com/midgetspy/Sick-Beard.git $USRDIR/$APPLOW &&
sudo cp $USRDIR/$APPLOW/autoProcessTV/autoProcessTV.cfg.sample $USRDIR/$APPLOW/autoProcessTV/autoProcessTV.cfg &&
sudo chown -R $APPUSER $USRDIR/$APPLOW &&
sudo chmod -R 555 $USRDIR/$APPLOW/autoProcessTV &&
sudo sed -i ".backup" 's/script_dir = ""/script_dir = \/usr\/local\/sickbeard\/autoProcessTV/' $USRDIR/sabnzbd/sabnzbd.ini
set_RCD
Summ_$SETAPP
Summ_$SETAPP >> /tmp/LaSi/lasi_install.log
}
Summ_SickBeard () {
clear
echo
echo "
Done! Installed $SETAPP
Type sickbeard --help for options
SickBeard is by default located @ http://$HOSTNAME:$set_port
Also configured SABnzbd+ to look in the Sick Beard script folder and
created an autoProcessTV.cfg file.
The remaining configuration is up to you and can be done using the webinterface.
"
}
#######################
##### CouchPotato #####
#######################
Info_CouchPotato () {
clear
echo "
*###############################################################*
*#################### CouchPotato V2 ###########################*
# #
# 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_App
check_git
check_wget
check_python
sudo git clone https://github.com/RuudBurger/CouchPotatoServer.git $USRDIR/$APPLOW &&
chown -R $APPUSER $USRDIR/$APPLOW
set_RCD
Summ_$SETAPP
Summ_$SETAPP >> /tmp/LaSi/lasi_install.log
}
Summ_CouchPotato () {
clear
echo
echo "
Done! Installed $SETAPP.
Type couchpotato --help for options.
CouchPotato is by default located @ http://$HOSTNAME:$set_port
"
}
######################
##### 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_App
check_git
check_python
sudo git clone https://github.com/rembo10/headphones.git $USRDIR/$APPLOW &&
chown -R $APPUSER $USRDIR/$APPLOW
set_RCD
Summ_$SETAPP
Summ_$SETAPP >> /tmp/LaSi/lasi_install.log
}
Summ_Headphones () {
clear
echo
echo "
Done! Installed $SETAPP.
Type headphones --help for options
Headphones is by default located @ http://$HOSTNAME:$set_port
"
}
#########################
##### LazyLibrarian #####
#########################
Info_LazyLibrarian () {
clear
echo "
*###############################################################*
*#################### LazyLibrarian ############################*
# #
# LazyLibrarian is an automatic NZB downloader. #
# You can keep a 'Books I like to read'-list and it will #
# search for NZBs of these books every X hours. #
# #
# Once an book is found, it will send it to SABnzbd. #
# #
*###############################################################*
# #
# Headphones is written by Mar2zz in his spare time... #
# #
# Visit https://github.com/Mar2zz/LazyLibrarian #
*###############################################################*"
cf_Choice
}
Install_LazyLibrarian () {
check_App
check_git
check_python
sudo git clone https://github.com/Mar2zz/LazyLibrarian.git $USRDIR/$APPLOW
chown -R $APPUSER $USRDIR/$APPLOW
set_RCD
Summ_$SETAPP
Summ_$SETAPP >> /tmp/LaSi/lasi_install.log
}
Summ_LazyLibrarian () {
clear
echo
echo "
Done! Installed $SETAPP.
LazyLibrarian is by default located @ http://$HOSTNAME:$set_port
"
}
######################
##### MARASCHINO #####
######################
Info_Maraschino () {
clear
echo "
*###############################################################*
*###################### MARASCHINO #############################*
# #
# Maraschino is a webpage that overviews a XBMC-mediacenter #
# and serverapplications like Sabnzbd, Sickbeard and others. #
# #
# Some of it's features are: #
# - Customizable applications module with: #
# - recently added media #
# - Currently playing bar #
# - Sabnzbd module #
# - SickBeard coming episodes #
# - Trakt.tv recommendations #
# - Diskspace info #
# #
*###############################################################*
# #
# Maraschino is written by Mr. Kipling and others #
# #
# Visit http://www.maraschinoproject.com/ #
*###############################################################*"
cf_Choice
}
Install_Maraschino () {
check_App
check_git
check_python
git clone https://github.com/mrkipling/maraschino.git $USRDIR/$APPLOW
cp $USRDIR/$APPLOW/settings_example.py $USRDIR/$APPLOW/settings.py
sed -i "" 's|/path/to/maraschino.db|/usr/local/maraschino/maraschino.db|' $USRDIR/$APPLOW/settings.py
chown -R $APPUSER $USRDIR/$APPLOW
set_RCD
Summ_$SETAPP
Summ_$SETAPP >> /tmp/lasi_install.log
}
Summ_Maraschino () {
clear
echo "
Done! Installed $SETAPP.
$SETAPP is by default located @ http://$HOSTNAME:$set_port
"
}
###############
#### 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 () {
check_App
check_python
sudo git clone https://github.com/sampsyo/beets.git $USRDIR/$APPLOW
cd $USRDIR/$APPLOW && /usr/local/bin/python setup.py install
# create a configfile and databasefile
if ! ls $USRDIR/$APPLOW/.beetsconfig > /dev/null; then
cd $USRDIR/$APPLOW
fetch $DROPBOX/$SETAPP/.beetsconfig
#sed -i "" "s|USRDIR|$USRDIR|" $USRDIR/$APPLOW/.beetsconfig
echo
echo "Now set the path to your music (directory:) in Beets config"
read -sn 1 -p "Press a key to continue"
ee $USRDIR/$APPLOW/.beetsconfig
fi
Summ_$SETAPP
Summ_$SETAPP > /tmp/LaSi/lasi_install.log
}
Summ_Beets () {
clear
echo
echo "
Done! Installed $SETAPP.
Type beet --help for options
or start importing music with the following command:
# beet import /path/to/new_music
"
}
#################
#### SPOTWEB ####
#################
Info_Spotweb () {
clear
echo "
*###############################################################*
*####################### SPOTWEB ###############################*
# #
# SpotWeb is a webbased version of SpotNet. #
# It uses PHP5 to deploy most functions and has been tested on #
# Linux and FreeBSD. #
# This installer will install everything needed for Spotweb #
# and install and configure lighttpd (webserver) and #
# mysql-server if necessary. #
# #
# Recently the application itself has been translated to the #
# Englisch language, but the main userbase is still using Dutch.#
# #
*###############################################################*
# #
# Spotweb is created by: Spotweb e.a. #
# Visit https://github.com/spotweb/spotweb #
*###############################################################*"
cf_Choice
}
Install_Spotweb () {
install_Spotweb () {
if [ "$WEBSRV" = "lighttpd" ]; then
DOCUROOT=`sed -ne '/^server.document-root =/p' /usr/local/etc/lighttpd/lighttpd.conf | awk -F '"' '{ print $2 }'`
SPOTDIR=$DOCUROOT/spotweb
elif [ "$WEBSRV" = "apache22" ]; then
DOCUROOT=`sed -ne '/^var.server_root =/p' /usr/local/etc/apache22/httpd.conf | awk -F '"' '{ print $2 }'`
SPOTDIR=$DOCUROOT/spotweb
fi
if [ "$(ls -A $SPOTDIR)" ]; then
clear
echo
echo "Installation folder for SpotWeb is not empty"
echo "Assuming SpotWeb is already installed"
echo
sleep 3
Info_Spotweb
fi
sudo git clone https://github.com/spotweb/spotweb.git $SPOTDIR &&
sudo chown -R www:www $SPOTDIR &&
sudo sed -i ".backup" 's/;date.timezone =/date.timezone = "Europe\/Amsterdam"/g' /usr/local/etc/php.ini &&
sudo $RCPATH/$WEBSRV restart
}
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]*)
input_PW
new_database=1
;;
[Nn]*)
new_database=0
;;
*)
echo "Answer yes or no"
cf_SQL
;;
esac
}
input_PW () {
if [ "$SQLPASSWORD" != "" ]; then
stty_orig=`stty -g`
echo
echo "What is your mySQL password?"
stty -echo
echo "[mysql] password:"
read SQLPASSWORD
stty $stty_orig
create_DB
else
create_DB
fi
}
create_DB () {
MYSQL=$(which mysql)
# check password
if ! $($MYSQL mysql -u root --password="$SQLPASSWORD" -e "SHOW DATABASES;" > /dev/null); then
echo "Password is wrong, try again"
input_PW
fi
# drop DB if it exists
if $($MYSQL mysql -u root --password="$SQLPASSWORD" -e "SHOW DATABASES;" | grep 'spotweb' > /dev/null); then
$MYSQL mysql -u root --password="$SQLPASSWORD" -e "DROP DATABASE spotweb;" > /dev/null
fi
# drop USER if it exists
if $($MYSQL mysql -u root --password="$SQLPASSWORD" -e "select user.user from mysql.user;" | grep 'spotweb' > /dev/null); then
$MYSQL mysql -u root --password="$SQLPASSWORD" -e "DROP USER 'spotweb'@'localhost';" > /dev/null
fi
# create DB
$MYSQL mysql -u root --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 mysql -u root --password="$SQLPASSWORD" -e "SHOW DATABASES;" | grep 'spotweb' > /dev/null); then
echo
echo "Creation of database failed, try again"
error_Msg
fi
if ! $($MYSQL mysql -u root --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
# Upgrade spotweb database
cd $SPOTDIR && /usr/local/bin/php $SPOTDIR/upgrade-db.php
Summ_Spotweb
Summ_Spotweb >> /tmp/LaSi/lasi_install.log
}
cf_CronRetrieve () {
echo
echo "Do you want to set a hourly cronjob for retrieving spots?"
read -p "[yes/no]: " CRONRETRIEVE
case $CRONRETRIEVE in
[YyJj]*)
# check if another cronjob for this exists and remove it
[ -e /etc/cron.hourly/spotweb_spots ] && sudo rm -f /etc/cron.hourly/spotweb_spots
# create lasi file in correct location
# would like to use sed for this, but can't figure out how...
echo "#!/bin/sh
# Author: Mar2zz
# Email: [email protected]
# Blogs: mar2zz.tweakblogs.net
# License: GNU GPL v3
# This job is set by the Lazy admin Scripted installer
set -e
[ -x /usr/local/bin/php ] || exit 0
[ -e $SPOTDIR/retrieve.php ] || exit 0
/usr/local/bin/php $SPOTDIR/retrieve.php || exit 1
" > /tmp/LaSi/spotweb_spots
sudo mv -f /tmp/LaSi/spotweb_spots /etc/cron.hourly/spotweb_spots
sudo chmod +x /etc/cron.hourly/spotweb_spots
echo
echo "Cronjob set."
echo "See /etc/cron.hourly/spotweb_spots."
echo
;;
[Nn]*)
echo "You can set cronjobs yourself if you want to."
echo "Type crontab -e for personal jobs or sudo crontab -e for root jobs."
echo
;;
*)
echo "Answer yes or no."
cf_CronRetrieve
;;
esac
}
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://$HOSTNAME/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!"
sleep 2
/usr/local/bin/php $SPOTDIR/retrieve.php
;;
[Nn]*)
;;
*)
echo "Answer yes or no"
cf_Retrieve
;;
esac
}
check_git
check_WEBSRV
check_php
check_phpext
check_mysql
install_Spotweb
config_SQL
cf_CronRetrieve
}
Summ_Spotweb () {
clear
echo
echo "
Done! Installed SpotWeb.
SpotWeb is now located @ http://$HOSTNAME/spotweb
Go there to configure SpotWeb. Login admin:admin
After configuring run $SPOTDIR/retrieve.php to fill the database with spots
"
}
######################
#### TRANSMISSION ####
######################
Info_Transmission () {
clear
echo "
*###############################################################*
*##################### TRANSMISSION ############################*
# #
# Transmission is a powerfull torrentclient which can run as #
# a daemon with a webinterface. It has a very small footprint, #
# so it can run on devices with low cpu power and low memory. #
# #
# Transmission has the features you want from a Torrent client: #
# encryption, a webinterface, peer exchange, magnet links, DHT, #
# µTP, UPnP and NAT-PMP port forwarding, webseed support, watch #
# directories, tracker editing, global and per-torrent #
# speedlimits, and more. #
# #
*###############################################################*
# #
# Transmission is written by volunteers. #
# #
# Visit http://www.transmissionbt.com/ #
*###############################################################*"
cf_Choice
}
Install_Transmission () {
set_DOWNDIR () {
clear
echo
echo "Where do you like Transmission to store your downloads?"
echo "Enter the full path e.g. /tank/download/torrents"
echo
read -p 'PATH : ' DOWNDIR
if ! ls $DOWNDIR > /dev/null; then
sudo mkdir $DOWNDIR
sudo chown -R $APPUSER $DOWNDIR
fi
echo
echo
echo
echo "Last question; What is the IP-range of your network?"
echo "Something like: 192.168.10.128"
echo "Replace the last number with an asterix, e.g. 192.168.10.*"
echo
read -p 'IP-range : ' IPRANGE
}
if which transmission-daemon > /dev/null; then
clear
echo
echo "Transmission is already installed on this system"
echo
sleep 3
Info_$SETAPP
else
pkg_Choice
if [ "$SETPKG" = "ports" ]; then
cd /usr/ports/net-p2p/transmission-daemon &&
sudo make -DBATCH install clean || error_Msg
else
sudo pkg_add -r transmission-daemon || error_Msg
fi
if ! ls $USRDIR/$APPLOW > /dev/null; then
sudo mkdir $USRDIR/$APPLOW
fi
sudo chown -R $APPUSER $USRDIR/$APPLOW
set_DOWNDIR
set_RCD
fi
Summ_$SETAPP
Summ_$SETAPP >> /tmp/lasi_install.log
}
Summ_Transmission () {
echo "
Done! Installed $SETAPP.
Transmission is by default located @ http://$HOSTNAME:9091
"
}
###############################################
######## Check System and Requirements ########
###############################################
check_Portstree () {
install_Portstree() {
clear
LaSi_Logo
echo
echo
echo "There's no Ports Tree present. It needs to be downloaded"
echo "This operation will take a minute or five!"
echo
sleep 2
echo
echo "Are you sure you want to continue and install the Ports Tree?"
echo "If NO, you are going back to the LaSi Menu"
echo
read -p "(yes/no) :" REPLY
case $REPLY in
[Yy]*)
SETPKG=ports
echo
echo "Let's GO!"
echo
sleep 2
clear
sudo portsnap fetch extract
;;
[Nn]*)
LaSi_Menu
;;
[Qq]*)
exit
;;
*)
echo "Answer y to install"
echo "n for menu"
echo "or Q to quit"
sleep 2
install_Portstree
;;
esac
}
if ! ls /usr/ports > /dev/null; then
install_Portstree
# elif find /var/db/portsnap -iname "INDEX" -mtime -1
# then
# SETPKG=ports
# echo
# echo "Ports Tree is up to date"
# sleep 2
else
SETPKG=ports
clear
echo
echo "Going to update the Ports Tree"
echo
sleep 2
sudo portsnap fetch update
fi
}