-
Notifications
You must be signed in to change notification settings - Fork 0
/
yamj.plg
1133 lines (1033 loc) · 41.6 KB
/
yamj.plg
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
<?xml version='1.0' standalone='yes'?>
<PLUGIN>
############################################
# YAMJ Plugin by Dan Kessler
# Release Version v0.3.3
############################################
############################################
# Changlelog
# ----------
# 0.3.3 - Added plugin forum link to WEBUI
# - Added option to open last log in new window
# - Added option to open script file in new window
# - Added --timeout=60 to all wget commands
# 0.3.2 - Fixed bottom of page is sometimes not visible due to unRAID progressframe
# 0.3.1 - Fixed YAMJ manual background scan from WEBUI
# 0.3 - Fixed possibility of multiple scheduled YAMJ Scans in crontab[/b]
# 0.2 - Initial Release
############################################
############################################
# cleanup file
############################################
<FILE Name="/tmp/yamj-cleanup" Run="/bin/bash">
<INLINE>
<![CDATA[
# Cleanup previous plugin installation
[ -f /etc/rc.d/rc.yamj ] && rm --force /etc/rc.d/rc.yamj
[ -d /usr/local/emhttp/plugins/yamj ] && rm --force --recursive /usr/local/emhttp/plugins/yamj
rm /tmp/yamj-cleanup
]]>
</INLINE>
</FILE>
############################################
# configuration file
############################################
# UPGRADE_PLG_ON_BOOT - Check and Install new plugin version if exists on hosting server during array mount (true/false)
# YAMJ_DOWN_STABLE_ON_BOOT - Download Latest YAMJ Stable version during during array mount (true/false)
# YAMJ_DOWN_SNAPSHOT_ON_BOOT - Download Latest YAMJ Snapshot version during during array mount (true/false)
# YAMJ_ADD_CRON_ON_BOOT - Add CRON job during array mount (true/false)
# YAMJ_CRON_MIN - Cron minutes settings for YAMJ automation
# YAMJ_CRON_HOUR - Cron hours settings for YAMJ automation
# YAMJ_CRON_DAY - Cron days settings for YAMJ automation
# YAMJ_CRON_MONTH - Cron months settings for YAMJ automation
# YAMJ_CRON_WEEKDAY - Cron weekdays settings for YAMJ automation
# YAMJ_LOCATION - Location (folder) of existing YAMJ installation
# YAMJ_DOWNLOAD_LOCATION - Location (folder) for YAMJ download
# YAMJ_RUN_SCRIPT - Full path for YAMJ run script
# YAMJ_RUN_SCRIPT_OUT - Where to send the output of YAMJ run
############################################
<FILE Name="/boot/config/plugins/yamj/yamj.cfg">
<INLINE>
<![CDATA[
# YAMJ plugin configuration
UPGRADE_PLG_ON_BOOT="false"
YAMJ_DOWN_STABLE_ON_BOOT="false"
YAMJ_DOWN_SNAPSHOT_ON_BOOT="false"
YAMJ_ADD_CRON_ON_BOOT="false"
YAMJ_CRON_MIN=""
YAMJ_CRON_HOUR=""
YAMJ_CRON_DAY=""
YAMJ_CRON_MONTH=""
YAMJ_CRON_WEEKDAY=""
YAMJ_LOCATION="/boot/flash/YAMJ"
YAMJ_DOWNLOAD_LOCATION="/boot/flash/YAMJ_Downloads"
YAMJ_RUN_SCRIPT="/boot/flash/YAMJ/My_YAMJ_script.sh"
YAMJ_RUN_SCRIPT_OUT="/boot/flash/YAMJ/YAMJ_log.txt"
]]>
</INLINE>
</FILE>
############################################
# Get Icon file (must be after configuration file creation - needs plugin folder)
############################################
<FILE Name="/tmp/yamj-icon" Run="/bin/bash">
<INLINE>
<![CDATA[
# Get icon
wget --quiet --spider --no-check-certificate --timeout=60 https://raw.github.com/theone11/YAMJ_plugin/master/yamj.png
if [ $? == "0" ] ; then
wget --quiet --no-check-certificate --timeout=60 -O /boot/config/plugins/yamj/yamj.png https://raw.github.com/theone11/YAMJ_plugin/master/yamj.png > /dev/null 2>&1
logger -trc.yamj -plocal7.info -is "Icon downloaded from icon hosting server"
echo "Icon downloaded from icon hosting server"
else
logger -trc.yamj -plocal7.info -is "No icon to download from icon hosting server"
echo "No icon to download from icon hosting server"
fi
if [ -f /boot/config/plugins/yamj/yamj.png ] ; then
mkdir --parents /usr/local/emhttp/plugins/yamj
cp --force /boot/config/plugins/yamj/yamj.png /usr/local/emhttp/plugins/yamj/yamj.png
logger -trc.yamj -plocal7.info -is "Icon copied to emhttp plugin folder"
echo "Icon copied to emhttp plugin folder"
else
logger -trc.yamj -plocal7.info -is "Icon does not exist locally - cannot copy to emhttp plugin folder"
echo "Icon does not exist locally - cannot copy to emhttp plugin folder"
fi
rm /tmp/yamj-icon
]]>
</INLINE>
</FILE>
############################################
# rc.yamj file
############################################
<FILE Name="/etc/rc.d/rc.yamj" Mode="0770">
<INLINE>
<![CDATA[
#!/bin/sh
#################
# L O G I T
#################
logit()
{
logger -trc.yamj -plocal7.info -is "$1"
echo "$1"
}
#################
# W R I T E C F G
#################
write_cfg()
{
echo "# YAMJ plugin configuration" > ${YAMJ_PLUGIN_PATH}/yamj.cfg
echo "UPGRADE_PLG_ON_BOOT=\"$UPGRADE_PLG_ON_BOOT\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg
echo "YAMJ_DOWN_STABLE_ON_BOOT=\"$YAMJ_DOWN_STABLE_ON_BOOT\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg
echo "YAMJ_DOWN_SNAPSHOT_ON_BOOT=\"$YAMJ_DOWN_SNAPSHOT_ON_BOOT\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg
echo "YAMJ_ADD_CRON_ON_BOOT=\"$YAMJ_ADD_CRON_ON_BOOT\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg
echo "YAMJ_CRON_MIN=\"$YAMJ_CRON_MIN\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg
echo "YAMJ_CRON_HOUR=\"$YAMJ_CRON_HOUR\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg
echo "YAMJ_CRON_DAY=\"$YAMJ_CRON_DAY\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg
echo "YAMJ_CRON_MONTH=\"$YAMJ_CRON_MONTH\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg
echo "YAMJ_CRON_WEEKDAY=\"$YAMJ_CRON_WEEKDAY\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg
echo "YAMJ_LOCATION=\"$YAMJ_LOCATION\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg
echo "YAMJ_DOWNLOAD_LOCATION=\"$YAMJ_DOWNLOAD_LOCATION\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg
echo "YAMJ_RUN_SCRIPT=\"$YAMJ_RUN_SCRIPT\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg
echo "YAMJ_RUN_SCRIPT_OUT=\"$YAMJ_RUN_SCRIPT_OUT\"" >> ${YAMJ_PLUGIN_PATH}/yamj.cfg
logit "Plugin configuration written"
}
#################
# W R I T E S T A T U S
#################
write_status()
{
echo "# YAMJ status" > $STATUS_FILE
echo "YAMJ_PLG_HOSTING_SERVER_EXISTS=\"$YAMJ_PLG_HOSTING_SERVER_EXISTS\"" >> $STATUS_FILE
echo "YAMJ_PLG_ONLINE_EXIST=\"$YAMJ_PLG_ONLINE_EXIST\"" >> $STATUS_FILE
echo "YAMJ_PLG_ONLINE_VER=\"$YAMJ_PLG_ONLINE_VER\"" >> $STATUS_FILE
echo "YAMJ_PLG_LOCAL_VER=\"$YAMJ_PLG_LOCAL_VER\"" >> $STATUS_FILE
echo "YAMJ_SNP_HOSTING_SERVER_EXISTS=\"$YAMJ_SNP_HOSTING_SERVER_EXISTS\"" >> $STATUS_FILE
echo "YAMJ_SNP_ONLINE_EXIST=\"$YAMJ_SNP_ONLINE_EXIST\"" >> $STATUS_FILE
echo "YAMJ_SNP_ONLINE_VER=\"$YAMJ_SNP_ONLINE_VER\"" >> $STATUS_FILE
echo "YAMJ_SNP_ONLINE_REV=\"$YAMJ_SNP_ONLINE_REV\"" >> $STATUS_FILE
echo "YAMJ_FNL_HOSTING_SERVER_EXISTS=\"$YAMJ_FNL_HOSTING_SERVER_EXISTS\"" >> $STATUS_FILE
echo "YAMJ_FNL_ONLINE_EXIST=\"$YAMJ_FNL_ONLINE_EXIST\"" >> $STATUS_FILE
echo "YAMJ_FNL_ONLINE_VER=\"$YAMJ_FNL_ONLINE_VER\"" >> $STATUS_FILE
echo "YAMJ_FNL_ONLINE_REV=\"$YAMJ_FNL_ONLINE_REV\"" >> $STATUS_FILE
echo "YAMJ_LOCAL_VER=\"$YAMJ_LOCAL_VER\"" >> $STATUS_FILE
echo "YAMJ_LOCAL_REV=\"$YAMJ_LOCAL_REV\"" >> $STATUS_FILE
echo "YAMJ_SNP_DOWN_VER=\"$YAMJ_SNP_DOWN_VER\"" >> $STATUS_FILE
echo "YAMJ_SNP_DOWN_REV=\"$YAMJ_SNP_DOWN_REV\"" >> $STATUS_FILE
echo "YAMJ_FNL_DOWN_VER=\"$YAMJ_FNL_DOWN_VER\"" >> $STATUS_FILE
}
#################
# C R O N A D D
#################
#yamj_cron_add()
#{
#}
####################
# G E T O N L I N E V E R S I O N S
####################
yamj_getonlineversions()
{
# YAMJ Snapshot hosting server by lainie
YAMJ_SNP_HOSTING_SERVER="mediaplayersite.com/YAMJ_Latest"
# Get online/offline status of YAMJ Snapshot hosting server
wget --quiet --spider --timeout=60 $YAMJ_SNP_HOSTING_SERVER
YAMJ_SNP_HOSTING_SERVER_EXISTS=$?
# Check if YAMJ Snapshot hosting server is online
if [ "$YAMJ_SNP_HOSTING_SERVER_EXISTS" == "0" ] ; then
# Get latest version number from server
YAMJ_SNP_ONLINE_VER=$(wget --timeout=60 ${YAMJ_SNP_HOSTING_SERVER} -q -O - | grep -m 1 "Current version: " | awk 'gsub(/.*Current version: |\/.*/,"")')
YAMJ_SNP_ONLINE_VER=$(echo "${YAMJ_SNP_ONLINE_VER%?}")
YAMJ_SNP_ONLINE_REV=$(wget --timeout=60 ${YAMJ_SNP_HOSTING_SERVER} -q -O - | grep -m 1 "Latest revision: r" | awk 'gsub(/.*Latest revision: r|\/.*/,"")')
YAMJ_SNP_ONLINE_REV=$(echo "${YAMJ_SNP_ONLINE_REV%?}")
else
# Set version to server_down - does not exist
YAMJ_SNP_ONLINE_VER="server_down"
YAMJ_SNP_ONLINE_REV="server_down"
fi
# YAMJ Snapshot filename
YAMJ_SNP_ONLINE_FILENAME="yamj-${YAMJ_SNP_ONLINE_VER}-r${YAMJ_SNP_ONLINE_REV}-bin.zip"
# YAMJ Snapshot hosting server URL
YAMJ_SNP_URL="http://mediaplayersite.com/sites/default/files/YAMJ"
# Check if YAMJ Snapshot file exists online
wget --quiet --spider --timeout=60 ${YAMJ_SNP_URL}/${YAMJ_SNP_ONLINE_FILENAME}
YAMJ_SNP_ONLINE_EXIST=$?
# YAMJ Stable hosting server
YAMJ_FNL_HOSTING_SERVER="http://code.google.com/p/moviejukebox/downloads/list"
# Get online/offline status of YAMJ Stable hosting server
wget --quiet --spider --timeout=60 $YAMJ_FNL_HOSTING_SERVER
YAMJ_FNL_HOSTING_SERVER_EXISTS=$?
# Check if YAMJ Stable hosting server is online
if [ "$YAMJ_FNL_HOSTING_SERVER_EXISTS" == "0" ] ; then
# Get latest version number from server
YAMJ_FNL_ONLINE_VER=$(wget --timeout=60 ${YAMJ_FNL_HOSTING_SERVER} -q -O - | grep -m 1 "Moviejukebox v" | awk 'gsub(/.*Moviejukebox v|\n.*/,"")' | tr -d '\n' | tr -d '\r')
YAMJ_FNL_ONLINE_REV=$(wget --timeout=60 ${YAMJ_FNL_HOSTING_SERVER} -q -O - | grep -m 1 "Featured, OpSys-All, Type-Archive, r" | awk 'gsub(/.* r|].*/,"")')
YAMJ_FNL_ONLINE_REV=$(echo "${YAMJ_FNL_ONLINE_REV%?}")
else
# Set version to server_down - does not exist
YAMJ_FNL_ONLINE_VER="server_down"
YAMJ_FNL_ONLINE_REV="server_down"
fi
# YAMJ Stable filename
YAMJ_FNL_ONLINE_FILENAME="moviejukebox-${YAMJ_FNL_ONLINE_VER}.zip"
# YAMJ Stable hosting server URL
YAMJ_FNL_URL="http://moviejukebox.googlecode.com/files"
# Check if YAMJ Stable file exists online - NOT SUPPORTED BY GOOGLE-CODE yet
# wget --quiet --spider --timeout=60 ${YAMJ_FNL_URL}/${YAMJ_FNL_ONLINE_FILENAME}
# YAMJ_FNL_ONLINE_EXIST=$?
YAMJ_FNL_ONLINE_EXIST=0
# Write status to update WEBUI
write_status
}
###################
# G E T L O C A L V E R S I O N S
###################
yamj_getlocalversions()
{
if [ -d $YAMJ_LOCATION ] ; then
if [ -f ${YAMJ_LOCATION}/version.txt ] ; then
# Get Existing local YAMJ version
YAMJ_LOCAL_VER=$(cat ${YAMJ_LOCATION}/version.txt | grep "Version: " | awk 'gsub(/.*Version: |\n.*/,"")')
YAMJ_LOCAL_REV=$(cat ${YAMJ_LOCATION}/version.txt | grep "Revision: r" | awk 'gsub(/.*Revision: r|\n.*/,"")')
else
YAMJ_LOCAL_VER="no_ver_file"
YAMJ_LOCAL_REV="no_ver_file"
fi
else
# Set non existing local YAMJ version
YAMJ_LOCAL_VER="no_local_ver"
YAMJ_LOCAL_REV="no_local_ver"
fi
if [ -d $YAMJ_DOWNLOAD_LOCATION ] ; then
YAMJ_SNP_FILES=$(ls -1Art ${YAMJ_DOWNLOAD_LOCATION}/yamj-*-r*-bin.zip 2>/dev/null)
ls -1Art /mnt/cache/unRAID_Apps/YAMJ/YAMJ_Downloads/yamj-*-r*-bin.zip 2>/dev/null
if [ "$YAMJ_SNP_FILES" != "" ] ; then
# Get existing downloaded YAMJ version
YAMJ_SNP_DOWN_VER=$(echo $YAMJ_SNP_FILES | tail -n1 | awk 'gsub(/.*yamj-|-r.*/,"")')
YAMJ_SNP_DOWN_REV=$(echo $YAMJ_SNP_FILES | tail -n1 | awk 'gsub(/.*-r|-bin.*/,"")')
else
YAMJ_SNP_DOWN_VER="no_snp_down"
YAMJ_SNP_DOWN_REV="no_snp_down"
fi
YAMJ_FNL_FILES=$(ls -1Art ${YAMJ_DOWNLOAD_LOCATION}/moviejukebox-*.zip 2>/dev/null)
if [ "$YAMJ_FNL_FILES" != "" ] ; then
YAMJ_FNL_DOWN_VER=$(echo $YAMJ_FNL_FILES | tail -n1 | awk 'gsub(/.*moviejukebox-|.zip.*/,"")')
else
YAMJ_FNL_DOWN_VER="no_fnl_down"
fi
else
# Set non existing downloaded YAMJ version
YAMJ_SNP_DOWN_VER="no_down_loc"
YAMJ_SNP_DOWN_VER="no_down_loc"
YAMJ_FNL_DOWN_VER="no_down_loc"
fi
# Write status to update WEBUI
write_status
}
###################
# D O W N L O A D F N L
###################
yamj_download_fnl()
{
# Check online status
yamj_getonlineversions
# Check if YAMJ Stable hosting servers are online
if [ "$YAMJ_FNL_HOSTING_SERVER_EXISTS" == "0" ] ; then
# Check if latest version is available on server
if [ "$YAMJ_FNL_ONLINE_EXIST" == "0" ] ; then
if [ ! -d $YAMJ_DOWNLOAD_LOCATION ] ; then
logit "No YAMJ doaload folder exists - Creating folder..."
mkdir --parents $YAMJ_DOWNLOAD_LOCATION
fi
if [ ! -f ${YAMJ_DOWNLOAD_LOCATION}/${YAMJ_FNL_ONLINE_FILENAME} ] ; then
logit "Latest YAMJ Stable (v${YAMJ_FNL_ONLINE_VER}) does not exist in download location - Removing all existing downloaded Stable versions and downloading..."
rm ${YAMJ_DOWNLOAD_LOCATION}/moviejukebox-*.zip >/dev/null 2>&1
wget -nv --timeout=60 -O ${YAMJ_DOWNLOAD_LOCATION}/${YAMJ_FNL_ONLINE_FILENAME} ${YAMJ_FNL_URL}/${YAMJ_FNL_ONLINE_FILENAME} >/dev/null 2>&1
else
logit "Latest YAMJ Stable (v${YAMJ_FNL_ONLINE_VER}) exists locally in download location - No need to download"
fi
else
logit "Latest YAMJ Stable version does not exist online - Cannot download new version"
fi
else
logit "Latest YAMJ Stable hosting server is OFFLINE - Cannot check for new version"
fi
}
###################
# D O W N L O A D S N P
###################
yamj_download_snp()
{
# Check online status
yamj_getonlineversions
# Check if YAMJ Snapshot hosting servers are online
if [ "$YAMJ_SNP_HOSTING_SERVER_EXISTS" == "0" ] ; then
# Check if latest version is available on server
if [ "$YAMJ_SNP_ONLINE_EXIST" == "0" ] ; then
if [ ! -d $YAMJ_DOWNLOAD_LOCATION ] ; then
logit "No YAMJ download folder exists - Creating folder..."
mkdir --parents $YAMJ_DOWNLOAD_LOCATION
fi
if [ ! -f ${YAMJ_DOWNLOAD_LOCATION}/${YAMJ_SNP_ONLINE_FILENAME} ] ; then
logit "Latest YAMJ Snapshot (v${YAMJ_SNP_ONLINE_VER} r${YAMJ_SNP_ONLINE_REV}) does not exist in download location - Removing all existing downloaded Snapshot versions and downloading..."
rm ${YAMJ_DOWNLOAD_LOCATION}/yamj-*-bin.zip >/dev/null 2>&1
wget -nv --timeout=60 -O ${YAMJ_DOWNLOAD_LOCATION}/${YAMJ_SNP_ONLINE_FILENAME} ${YAMJ_SNP_URL}/${YAMJ_SNP_ONLINE_FILENAME} >/dev/null 2>&1
else
logit "Latest YAMJ Snapshot (v${YAMJ_SNP_ONLINE_VER} r${YAMJ_SNP_ONLINE_REV}) exists locally in downlaod location - No need to download"
fi
else
logit "Latest YAMJ Snapshot version does not exist online - Cannot download new version"
fi
else
logit "Latest YAMJ Snapshot hosting server is OFFLINE - Cannot check for new version"
fi
}
#################
# G E T P L G V E R S I O N S
#################
yamj_getplgversions()
{
# Plugin hosting server
YAMJ_PLG_HOSTING_SERVER="https://github.com/theone11/YAMJ_plugin"
# Plugin hosting server URL + filename
YAMJ_PLG_URL="https://raw.github.com/theone11/YAMJ_plugin/master/yamj.plg"
# Get online/offline status of plugin hosting server
wget --quiet --spider --no-check-certificate --timeout=60 $YAMJ_PLG_HOSTING_SERVER
YAMJ_PLG_HOSTING_SERVER_EXISTS=$?
# Check if plugin hosting server is online
if [ "$YAMJ_PLG_HOSTING_SERVER_EXISTS" == "0" ] ; then
# Check if plugin file exists online
wget --quiet --spider --no-check-certificate --timeout=60 $YAMJ_PLG_URL
YAMJ_PLG_ONLINE_EXIST=$?
if [ "$YAMJ_PLG_ONLINE_EXIST" == "0" ] ; then
# Get latest version number from server
YAMJ_PLG_ONLINE_VER=$(wget --no-check-certificate --quiet --timeout=60 $YAMJ_PLG_URL -O - | grep -m 1 "Release Version v" | awk 'gsub(/.*Release Version v|*/,"")')
else
YAMJ_PLG_ONLINE_VER="no_online_plg"
fi
else
# Set version to server_down - does not exist
YAMJ_PLG_ONLINE_VER="server_down"
fi
# Check if local plugin file exists
if [ -f /boot/config/plugins/yamj.plg ] ; then
# Get existing version number from local file
YAMJ_PLG_LOCAL_VER=$(grep -m 1 "Release Version v" /boot/config/plugins/yamj.plg | awk 'gsub(/.*Release Version v|*/,"")')
else
# Set version to no_local_plg - does not exist
YAMJ_PLG_LOCAL_VER="no_local_plg"
fi
# Write status to update WEBUI
write_status
}
#######################
# U P D A T E P L G
#######################
yamj_updateplg()
{
# Get online and local plugin versions
yamj_getplgversions
# Check if Plugin hosting server is online
if [ "$YAMJ_PLG_HOSTING_SERVER_EXISTS" == "0" ] ; then
# Check if latest version is available on server
if [ "$YAMJ_PLG_ONLINE_EXIST" == "0" ] ; then
# Check if online and local versions are different
if [ "$YAMJ_PLG_ONLINE_VER" != "$YAMJ_PLG_LOCAL_VER" ] ; then
# Check if local plugin doesn't exist
if [ "$YAMJ_PLG_LOCAL_VER" == "no_local_plg" ] ; then
logit "Local plugin does not exist. Installing latest plugin version from hosting server (v$YAMJ_PLG_ONLINE_VER)"
else
logit "Upgrading local plugin (v$YAMJ_PLG_LOCAL_VER) to hosting server plugin (v$YAMJ_PLG_ONLINE_VER)"
fi
# Download new plugin version
wget --no-check-certificate --quiet --timeout=60 $YAMJ_PLG_URL -O /boot/config/plugins/yamj.plg
# Install new plugin
/usr/local/sbin/installplg /boot/config/plugins/yamj.plg
logit "New/Updated plugin installation complete"
# Plugin hosting server is offline
else
logit "Local plugin is the same version as on hosting server (v$YAMJ_PLG_LOCAL_VER)"
fi
# Online version and local version are the same
else
logit "Plugin does not exist on plugin hosting server - Cannot download new plugin"
fi
else
logit "YAMJ Plugin hosting servers is OFFLINE - Cannot check for new packages versions"
fi
}
###################
# R U N S C R I P T
###################
yamj_runscript()
{
# Check if YAMJ exists
if [ -d $YAMJ_LOCATION ] ; then
if [ -f $YAMJ_RUN_SCRIPT ] ; then
logit "Running YAMJ script in background ..."
nohup $YAMJ_RUN_SCRIPT > $YAMJ_RUN_SCRIPT_OUT 2>&1 &
else
logit "YAMJ script ($YAMJ_RUN_SCRIPT) does not exist - Nothing to run"
fi
else
logit "YAMJ installation ($YAMJ_LOCATION) does not exist - Cannot run script"
fi
}
###################
# B O O T
###################
yamj_boot()
{
# Check if new plugin should be updated during array mount
if [ $UPGRADE_PLG_ON_BOOT == "true" ] ; then
logit "Checking for YAMJ plugin update during array mount ..."
yamj_updateplg
# Plugin update should not be done during boot
else
logit "YAMJ plugin update during array mount is disabled"
fi
# Check if YAMJ CRON job should be added during array mount
if [ $YAMJ_ADD_CRON_ON_BOOT == "true" ] ; then
logit "Adding Scheduled YAMJ Scan during array mount ..."
yamj_removecron
yamj_addcron
else
logit "Adding Scheduled YAMJ Scan during array mount is disabled"
fi
# Check if YAMJ Stable verison should be downloaded during array mount
if [ $YAMJ_DOWN_STABLE_ON_BOOT == "true" ] ; then
logit "Downloading Latest YAMJ Stable version during array mount ..."
yamj_donload_fnl
else
logit "Downloading Latest YAMJ Stable version during array mount is disabled"
fi
# Check if YAMJ Snapshot verison should be downloaded during array mount
if [ $YAMJ_DOWN_SNAPSHOT_ON_BOOT == "true" ] ; then
logit "Downloading Latest YAMJ Snapshot version during array mount ..."
yamj_download_snp
else
logit "Downloading Latest YAMJ Snapshot version during array mount is disabled"
fi
}
###################
# R E M O V E C R O N
###################
yamj_removecron()
{
# Delete YAMJ CRON job
crontab -l | grep -v "# Scheduled YAMJ Scan" | grep -v $YAMJ_RUN_SCRIPT > /tmp/yamj_crontab
crontab /tmp/yamj_crontab
rm --force /tmp/yamj_crontab
logit "Deleted Scheduled YAMJ Scan from crontab if existed"
}
###################
# A D D C R O N
###################
yamj_addcron()
{
# Add YAMJ CRON job
crontab -l > /tmp/yamj_crontab
echo "# Scheduled YAMJ Scan" >> /tmp/yamj_crontab
echo "${YAMJ_CRON_MIN} ${YAMJ_CRON_HOUR} ${YAMJ_CRON_DAY} ${YAMJ_CRON_MONTH} ${YAMJ_CRON_WEEKDAY} ${YAMJ_RUN_SCRIPT} > ${YAMJ_RUN_SCRIPT_OUT} 2>&1" >> /tmp/yamj_crontab
crontab /tmp/yamj_crontab
rm --force /tmp/yamj_crontab
logit "Added Scheduled YAMJ Scan to crontab"
}
###################
# U P D A T E C F G
###################
yamj_updatecfg()
{
# Arguments file used for WEBUI configuration update
ARGUMENTS_FILE="/usr/local/emhttp/plugins/yamj/yamj.args"
[ -f $ARGUMENTS_FILE ] && source $ARGUMENTS_FILE
UPGRADE_PLG_ON_BOOT=$UPGRADE_PLG_ON_BOOT_NEW
YAMJ_DOWN_STABLE_ON_BOOT=$YAMJ_DOWN_STABLE_ON_BOOT_NEW
YAMJ_DOWN_SNAPSHOT_ON_BOOT=$YAMJ_DOWN_SNAPSHOT_ON_BOOT
YAMJ_ADD_CRON_ON_BOOT=$YAMJ_ADD_CRON_ON_BOOT_NEW
YAMJ_LOCATION=$YAMJ_LOCATION_NEW
# Check if new CRON settings are all empty
if [ "$YAMJ_CRON_MIN_NEW" == "" ] && [ "$YAMJ_CRON_HOUR_NEW" == "" ] && [ "$YAMJ_CRON_DAY_NEW" == "" ] && \
[ "$YAMJ_CRON_MONTH_NEW" == "" ] && [ "$YAMJ_CRON_WEEKDAY_NEW" == "" ] ; then
# Delete YAMJ CRON job
yamj_removecron
# Save new settings
YAMJ_CRON_MIN=$YAMJ_CRON_MIN_NEW
YAMJ_CRON_HOUR=$YAMJ_CRON_HOUR_NEW
YAMJ_CRON_DAY=$YAMJ_CRON_DAY_NEW
YAMJ_CRON_MONTH=$YAMJ_CRON_MONTH_NEW
YAMJ_CRON_WEEKDAY=$YAMJ_CRON_WEEKDAY_NEW
YAMJ_RUN_SCRIPT=$YAMJ_RUN_SCRIPT_NEW
YAMJ_RUN_SCRIPT_OUT=$YAMJ_RUN_SCRIPT_OUT_NEW
else
# Check if any CRON settings is empty
if [ "$YAMJ_CRON_MIN_NEW" == "" ] || [ "$YAMJ_CRON_HOUR_NEW" == "" ] || [ "$YAMJ_CRON_DAY_NEW" == "" ] || \
[ "$YAMJ_CRON_MONTH_NEW" == "" ] || [ "$YAMJ_CRON_WEEKDAY_NEW" == "" ] || [ "$YAMJ_RUN_SCRIPT_NEW" == "" ] || \
[ "$YAMJ_RUN_SCRIPT_OUT_NEW" == "" ] ; then
logit "At least one Scheduled YAMJ Scan setting is missing - New schedule related settings not saved"
else
# Check if any off the new CRON settings are different than the existing settings
if [ "$YAMJ_CRON_MIN_NEW" != "$YAMJ_CRON_MIN" ] || [ "$YAMJ_CRON_HOUR_NEW" != "$YAMJ_CRON_HOUR" ] || \
[ "$YAMJ_CRON_DAY_NEW" != "$YAMJ_CRON_DAY" ] || [ "$YAMJ_CRON_MONTH_NEW" != "$YAMJ_CRON_MONTH" ] || \
[ "$YAMJ_CRON_WEEKDAY_NEW" != "$YAMJ_CRON_WEEKDAY" ] || [ "$YAMJ_RUN_SCRIPT_NEW" != "$YAMJ_RUN_SCRIPT" ] || \
[ "$YAMJ_RUN_SCRIPT_OUT_NEW" != "$YAMJ_RUN_SCRIPT_OUT" ] ; then
# Delete YAMJ CRON job
yamj_removecron
# Save new settings
YAMJ_CRON_MIN=$YAMJ_CRON_MIN_NEW
YAMJ_CRON_HOUR=$YAMJ_CRON_HOUR_NEW
YAMJ_CRON_DAY=$YAMJ_CRON_DAY_NEW
YAMJ_CRON_MONTH=$YAMJ_CRON_MONTH_NEW
YAMJ_CRON_WEEKDAY=$YAMJ_CRON_WEEKDAY_NEW
YAMJ_RUN_SCRIPT=$YAMJ_RUN_SCRIPT_NEW
YAMJ_RUN_SCRIPT_OUT=$YAMJ_RUN_SCRIPT_OUT_NEW
# Add new YAMJ CRON job
yamj_addcron
else
# Save new settings
YAMJ_CRON_MIN=$YAMJ_CRON_MIN_NEW
YAMJ_CRON_HOUR=$YAMJ_CRON_HOUR_NEW
YAMJ_CRON_DAY=$YAMJ_CRON_DAY_NEW
YAMJ_CRON_MONTH=$YAMJ_CRON_MONTH_NEW
YAMJ_CRON_WEEKDAY=$YAMJ_CRON_WEEKDAY_NEW
YAMJ_RUN_SCRIPT=$YAMJ_RUN_SCRIPT_NEW
YAMJ_RUN_SCRIPT_OUT=$YAMJ_RUN_SCRIPT_OUT_NEW
fi
fi
fi
# Check if download location changed
if [ "$YAMJ_DOWNLOAD_LOCATION_NEW" != "$YAMJ_DOWNLOAD_LOCATION" ] ; then
# Check if new download location exists
if [ ! -d $YAMJ_DOWNLOAD_LOCATION_NEW ] ; then
# Create new download location
mkdir --parents $YAMJ_DOWNLOAD_LOCATION_NEW
logit "New download location created"
fi
# Check if download location exists
if [ -d $YAMJ_DOWNLOAD_LOCATION ] ; then
# Move any existing files to new download location
cp --force --recursive ${YAMJ_DOWNLOAD_LOCATION}/* ${YAMJ_DOWNLOAD_LOCATION_NEW}
rm --force --recursive ${YAMJ_DOWNLOAD_LOCATION}
logit "Moved existing files from ${YAMJ_DOWNLOAD_LOCATION} (removed folder) to ${YAMJ_DOWNLOAD_LOCATION_NEW}"
else
logit "No download location currently exists - Nothing to do"
fi
fi
YAMJ_DOWNLOAD_LOCATION=$YAMJ_DOWNLOAD_LOCATION_NEW
write_cfg
}
###################
# M A I N
###################
# YAMJ plugin folder on boot flash drive
YAMJ_PLUGIN_PATH="/boot/config/plugins/yamj"
# YAMJ status file used for WEBUI updates
STATUS_FILE="/usr/local/emhttp/plugins/yamj/yamj.status"
[ -f ${YAMJ_PLUGIN_PATH}/yamj.cfg ] && source ${YAMJ_PLUGIN_PATH}/yamj.cfg
[ -f $STATUS_FILE ] && source $STATUS_FILE
case "$1" in
'updatecfg')
yamj_updatecfg
;;
'writecfg')
write_cfg
;;
'getonlineversions')
yamj_getonlineversions
;;
'getlocalversions')
yamj_getlocalversions
;;
'getplgversions')
yamj_getplgversions
;;
'downloadfnl')
yamj_download_fnl
;;
'downloadsnp')
yamj_download_snp
;;
'updateplg')
yamj_updateplg
;;
'boot')
yamj_boot
;;
'writestatus')
write_status
;;
'runscript')
yamj_runscript
;;
*)
echo "usage $0 cron_add | updatecfg | writecfg | updateplg | getplgversions"
esac
]]>
</INLINE>
</FILE>
############################################
# Event handlers
############################################
<FILE Name="/usr/local/emhttp/plugins/yamj/event/disks_mounted" Mode="0770">
<INLINE>
<![CDATA[
#!/bin/bash
/etc/rc.d/rc.yamj boot
]]>
</INLINE>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/yamj/event/unmounting_disks" Mode="0770">
<INLINE>
<![CDATA[
#!/bin/bash
]]>
</INLINE>
</FILE>
############################################
# Files required to hook the plugin into the unRaid webGui menu system
############################################
############################################
# The page file defines which menu page the plugin will appear on
############################################
<FILE Name="/usr/local/emhttp/plugins/yamj/yamj.page">
<INLINE>
<![CDATA[
Menu="NetworkServices"
Icon="yamj.png"
Version=""
Author="Dan Kessler"
Type="php"
Title="YAMJ"
]]>
</INLINE>
</FILE>
############################################
# WEBUI page
############################################
<FILE Name="/usr/local/emhttp/plugins/yamj/yamj.php">
<INLINE>
<![CDATA[
<?PHP
shell_exec("/etc/rc.d/rc.yamj getplgversions");
shell_exec("/etc/rc.d/rc.yamj getonlineversions");
shell_exec("/etc/rc.d/rc.yamj getlocalversions");
$yamj_cfg = parse_ini_file("/boot/config/plugins/yamj/yamj.cfg");
$yamj_status = parse_ini_file("/usr/local/emhttp/plugins/yamj/yamj.status");
$yamj_location = $yamj_cfg['YAMJ_LOCATION'];
$plg_server = $yamj_status['YAMJ_PLG_HOSTING_SERVER_EXISTS'];
$plg_online_exist = $yamj_status['YAMJ_PLG_ONLINE_EXIST'];
$plg_online_ver = $yamj_status['YAMJ_PLG_ONLINE_VER'];
$plg_loc_ver = $yamj_status['YAMJ_PLG_LOCAL_VER'];
$snp_server = $yamj_status['YAMJ_SNP_HOSTING_SERVER_EXISTS'];
$snp_online_exist = $yamj_status['YAMJ_SNP_ONLINE_EXIST'];
$snp_online_ver = $yamj_status['YAMJ_SNP_ONLINE_VER'];
$snp_online_rev = $yamj_status['YAMJ_SNP_ONLINE_REV'];
$fnl_server = $yamj_status['YAMJ_FNL_HOSTING_SERVER_EXISTS'];
$fnl_online_exist = $yamj_status['YAMJ_FNL_ONLINE_EXIST'];
$fnl_online_ver = $yamj_status['YAMJ_FNL_ONLINE_VER'];
$fnl_online_rev = $yamj_status['YAMJ_FNL_ONLINE_REV'];
$loc_ver = $yamj_status['YAMJ_LOCAL_VER'];
$loc_rev = $yamj_status['YAMJ_LOCAL_REV'];
$snp_down_ver = $yamj_status['YAMJ_SNP_DOWN_VER'];
$snp_down_rev = $yamj_status['YAMJ_SNP_DOWN_REV'];
$fnl_down_ver = $yamj_status['YAMJ_FNL_DOWN_VER'];
$cron = shell_exec("crontab -l | grep \"".$yamj_cfg['YAMJ_RUN_SCRIPT']."\"");
$control_actions_exist = "false";
$version_actions_exist = "false";
?>
<HTML>
<HEAD></HEAD>
<BODY>
<div style="width: 49%; float:left; border: 0px solid black;">
<div id="title">
<span class="left">Status</span>
</div>
<div style="border: 0px solid black;">
<span class="left">
<p>Local YAMJ <?=$yamj_location;?>:
<?if ($loc_ver=="no_local_ver"):?>
<span class="red-text"><b> YAMJ folder does not exist</b></span>
<?else:?>
<?if ($loc_ver=="no_ver_file"):?>
<span class="red-text"><b> YAMJ version file does not exist in YAMJ folder</b></span>
<?else:?>
<span class="green-text"><b> v<?=$loc_ver;?> r<?=$loc_rev;?></b></span>
<?endif;?>
<?endif;?>
</p>
<p>Currently defined Scheduled YAMJ Scan in <i>crontab</i>:
<?if ($cron==""):?>
<span class="orange-text"><b> No Scheduled YAMJ Scan defined</b></span></p>
<?else:?>
</p><p><span class="green-text"><b><?=$cron;?></span></p>
<?endif;?>
</span>
</div>
<br></br>
<div style="border: 0px solid black;">
<table>
<tr style="font-weight:bold; color:#333333; background:#F0F0F0; text-shadow:0 1px 1px #FFFFFF;">
<td>Package</td>
<td>Online Version</td>
<td>Downloaded Version</td>
</tr>
<tr style="font-weight:bold; background:#FFFFFF;">
<td>YAMJ Stable</td>
<td>
<?if ($fnl_server=="0"):?>
<?if ($fnl_online_exist=="0"):?>
<span class="green-text">v<?=$fnl_online_ver;?> r<?=$fnl_online_rev;?></span>
<?else:?>
<span class="red-text">No online stable version</span>
<?endif;?>
<?else:?>
<span class="red-text">OFFLINE</span>
<?endif;?>
</td>
<td>
<?if ($fnl_down_ver!="no_down_loc"):?>
<?if ($fnl_down_ver!="no_fnl_down"):?>
<span class="green-text">v<?=$fnl_down_ver;?></span>
<?else:?>
<span class="red-text">No downloaded stable version</span>
<?endif;?>
<?else:?>
<span class="red-text">Download location does not exist</span>
<?endif;?>
</td>
</tr>
<tr style="font-weight:bold; background:#FFFFFF;">
<td>YAMJ Snapshot</td>
<td>
<?if ($snp_server=="0"):?>
<?if ($snp_online_exist=="0"):?>
<span class="green-text">v<?=$snp_online_ver;?> r<?=$snp_online_rev;?></span>
<?else:?>
<span class="red-text">No online snapshot version</span>
<?endif;?>
<?else:?>
<span class="red-text">OFFLINE</span>
<?endif;?>
</td>
<td>
<?if ($snp_down_ver!="no_down_loc"):?>
<?if ($snp_down_ver!="no_snp_down"):?>
<span class="green-text">v<?=$snp_down_ver;?> r<?=$snp_down_rev;?></span>
<?else:?>
<span class="red-text">No downloaded snapshot version</span>
<?endif;?>
<?else:?>
<span class="red-text">Download location does not exist</span>
<?endif;?>
</td>
</tr>
<tr style="font-weight:bold; background:#FFFFFF;">
<td>YAMJ Plugin</td>
<td>
<?if ($plg_server=="0"):?>
<?if ($plg_online_exist=="0"):?>
<span class="green-text">v<?=$plg_online_ver;?></span>
<?else:?>
<span class="red-text">No online plugin</span>
<?endif;?>
<?else:?>
<span class="red-text">OFFLINE</span>
<?endif;?>
</td>
<td>
<?if ($plg_loc_ver!="no_local_plg"):?>
<span class="green-text">v<?=$plg_loc_ver;?></span>
<?else:?>
<span class="red-text">No local plugin</span>
<?endif;?>
</td>
</tr>
</table>
<p>Stable version taken from <u><a href="http://code.google.com/p/moviejukebox/" target="_blank">MovieJukebox on Googlecode</a></u></p>
<p>Snapshot version taken from <u><a href="http://mediaplayersite.com/YAMJ_Latest" target="_blank">YAMJ on Omertron's Media Player Site</a></u></p>
<p>unRAID forum thread for <u><a href="http://lime-technology.com/forum/index.php?topic=26128.0" target="_blank">YAMJ Plugin for unRAID v5</a></u></p>
</div>
<div id="title">
<span class="left">Actions</span>
</div>
<br></br>
<div>
<table>
<tr style="font-weight:bold; color:#333333; background:#F0F0F0; text-shadow:0 1px 1px #FFFFFF;">
<td colspan="2">Control Actions</td>
</tr>
<?if ($loc_ver != "no_local_ver"):?>
<tr>
<td width="30%">
<form name="runscript" method="POST" action="/plugins/yamj/yamj_runscript_bg.php" target="progressFrame">
<input type="submit" value="Run YAMJ">
</form>
</td>
<td>Run YAMJ script in background now</td>
</tr>
<?$control_actions_exist = "true"?>
<?endif;?>
<?if ($control_actions_exist=="false"):?>
<tr>
<td colspan="2" align="center">No Control Actions available</td>
</tr>
<?endif;?>
</table>
</div>
<br></br>
<div style="border: 0px solid black;">
<table>
<tr style="font-weight:bold; color:#333333; background:#F0F0F0; text-shadow:0 1px 1px #FFFFFF;">
<td colspan="2">Version Actions</td>
</tr>
<?if (($fnl_online_exist=="0") && ($fnl_down_ver!=$fnl_online_ver)):?>
<tr>
<td width="30%">
<form name="downloadfnl" method="POST" action="/update.htm" target="progressFrame">
<input type="hidden" name="cmd" value="/etc/rc.d/rc.yamj downloadfnl">
<input type="submit" name="runCmd" value="Download Lateset Stable">
</form>
</td>
<td>Stable ONLINE version different than Stable LOCAL version</td>
</tr>
<?$version_actions_exist="true"?>
<?endif;?>
<?if (($snp_online_exist=="0") && ($snp_down_rev!=$snp_online_rev)):?>
<tr>
<td width="30%">
<form name="downloadsnp" method="POST" action="/update.htm" target="progressFrame">
<input type="hidden" name="cmd" value="/etc/rc.d/rc.yamj downloadsnp">
<input type="submit" name="runCmd" value="Download Lateset Snapshot">
</form>
</td>
<td>Snapshot ONLINE version different than Snapshot LOCAL version</td>
</tr>
<?$version_actions_exist="true"?>
<?endif;?>
<?if (($plg_online_exist=="0") && ($plg_online_ver!=$plg_loc_ver)):?>
<tr>
<td width="30%">
<form name="updateplg" method="POST" action="/update.htm" target="progressFrame">
<input type="hidden" name="cmd" value="/etc/rc.d/rc.yamj updateplg">
<input type="submit" name="runCmd" value="Update Plugin">
</form>
</td>
<td>ONLINE Plugin version different than LOCAL Plugin version</td>
</tr>
<?$version_actions_exist="true"?>
<?endif;?>
<?if ($version_actions_exist=="false"):?>
<tr>
<td colspan="2" align="center">No Version Actions available</td>
</tr>
<?endif;?>
</table>
</div>
<br></br>
<br></br>
</div>
<div style="width: 49%; float:right; border: 0px solid black;">
<div id="title">
<span class="left">Configuration</span>
</div>
<div>
<form name="yamj_settings" method="POST" action="/plugins/yamj/yamj_submit.php" target="progressFrame">
<table>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Save Below Configuration & Implement Immediately">
<button type="button" onClick="done();">Return to unRAID Settings Page</button>
</td>
</tr>
<tr style="font-weight:bold; color:#333333; background:#F0F0F0; text-shadow:0 1px 1px #FFFFFF;">
<td colspan="2">Mount and Startup options</td>
</tr>
<tr>
<td>Check & Update Plugin during array mount:</td>
<td>
<select name="upgrade_plg_on_boot" size="1">
<?=mk_option($yamj_cfg['UPGRADE_PLG_ON_BOOT'], "true", "Yes");?>
<?=mk_option($yamj_cfg['UPGRADE_PLG_ON_BOOT'], "false", "No");?>
</select>
</td>
</tr>
<tr>
<td>Download Latest YAMJ Stable version during array mount:</td>
<td>
<select name="yamj_down_stable_on_boot" size="1">
<?=mk_option($yamj_cfg['YAMJ_DOWN_STABLE_ON_BOOT'], "true", "Yes");?>
<?=mk_option($yamj_cfg['YAMJ_DOWN_STABLE_ON_BOOT'], "false", "No");?>
</select>
</td>
</tr>
<tr>
<td>Download Latest YAMJ Snapshot version during array mount:</td>
<td>
<select name="yamj_down_snapshot_on_boot" size="1">
<?=mk_option($yamj_cfg['YAMJ_DOWN_SNAPSHOT_ON_BOOT'], "true", "Yes");?>
<?=mk_option($yamj_cfg['YAMJ_DOWN_SNAPSHOT_ON_BOOT'], "false", "No");?>
</select>
</td>
</tr>
<tr>
<td>Add CRON job for YAMJ during array mount:</td>
<td>
<select name="yamj_add_cron_on_boot" size="1">
<?=mk_option($yamj_cfg['YAMJ_ADD_CRON_ON_BOOT'], "true", "Yes");?>
<?=mk_option($yamj_cfg['YAMJ_ADD_CRON_ON_BOOT'], "false", "No");?>
</select>
</td>