This repository has been archived by the owner on Jun 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathnzbmegasearch_unplugged.plg
624 lines (565 loc) · 19 KB
/
nzbmegasearch_unplugged.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
<?xml version='1.0' standalone='yes'?>
<PLUGIN>
<!--
This is the dev branch!!!
This Plugin installs and controls NZBMegasearch for UnRaid.
All dependencies are installed as needed and everything is controllable from the webgui
Credits:
Benni-Chan: Originally creating the plug-in. Much of his code is still in
place and changes have been made for new features and fixes.
WW: Install & Data Directory size, some config page formatting, multi-branch selection
I have...
* probably missed some credits here, not intentional but I do not have a perfect memory!
* made changes and added features myself. I have removed the changelog from the plug-in itself.
* done this because since I am hosting the plug-ins on github, there is an accurate changelog with the commits.
-->
<FILE Name="/boot/packages/python-2.6.6-i486-1.txz" Run="upgradepkg --install-new">
<URL>http://slackware.cs.utah.edu/pub/slackware/slackware-13.37/slackware/d/python-2.6.6-i486-1.txz</URL>
<MD5>b8de0c9f8b89aa7b3c89823d20076867</MD5>
</FILE>
<FILE Name="/boot/packages/git-1.7.4.4-i486-1.txz" Run="upgradepkg --install-new">
<URL>http://slackware.osuosl.org/slackware-13.37/slackware/d/git-1.7.4.4-i486-1.txz</URL>
<MD5>5d92bd44e67618dfdacc2e2fa9a41821</MD5>
</FILE>
<FILE Name="/boot/config/plugins/nzbmegasearch/nzbmegasearch_logo.png">
<URL>--no-check-certificate https://github.com/Influencer/UNplugged/raw/dev/megasearch_logo.png</URL>
</FILE>
<FILE Name="/boot/config/plugins/images/device_status.png">
<URL>--no-check-certificate https://github.com/downloads/Influencer/UNplugged/device_status.png</URL>
</FILE>
<FILE Name="/boot/config/plugins/images/new_config.png">
<URL>--no-check-certificate https://github.com/downloads/Influencer/UNplugged/new_config.png</URL>
</FILE>
<FILE Name="/boot/config/plugins/images/information.png">
<URL>--no-check-certificate https://github.com/downloads/Influencer/UNplugged/information.png</URL>
</FILE>
<!-- clean up previous install -->
<FILE Name="/tmp/nzbmegasearch-cleanup" Run="/bin/bash">
<INLINE>
<![CDATA[
[ -d /usr/local/emhttp/plugins/nzbmegasearch ] && rm -f -R /usr/local/emhttp/plugins/nzbmegasearch
[ -f /etc/rc.d/rc.nzbmegasearch ] && rm -f /etc/rc.d/rc.nzbmegasearch
[ -f /boot/config/plugins/nzbmegasearch/plgver.txt ] && rm -f /boot/config/plugins/nzbmegasearch/plgver.txt
rm /tmp/nzbmegasearch-cleanup
]]>
</INLINE>
</FILE>
<FILE Name="/boot/config/plugins/nzbmegasearch/plgver.txt">
<INLINE>
<![CDATA[
1.0
]]>
</INLINE>
</FILE>
<FILE Name="/boot/config/plugins/nzbmegasearch/nzbmegasearch.cfg">
<INLINE>
<![CDATA[
# nzbmegasearch configuration:
SERVICE="disable"
INSTALLDIR="/usr/local/nzbmegasearch"
PORT="5000"
RUNAS="nobody"
PLG_STORAGESIZE="yes"
PLG_DATACHECK="yes"
]]>
</INLINE>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/webGui/unplugged.page">
<INLINE>
<![CDATA[
Author="Influencer"
Version="1.0.0"
Title="Unplugged PLG"
Menu="Settings"
Type="menu"
]]>
</INLINE>
</FILE>
<FILE Name="/etc/rc.d/rc.nzbmegasearch" Mode="0770">
<INLINE>
<![CDATA[
#!/bin/sh
# start|stop|restart|enable|disable|install|update|storagesize|datacheck nzbmegasearch.
nzbmegasearch_start()
{
# no-op if not enabled
if [ $SERVICE != "enable" ]; then
sed -i "s/"disable"/"enable/"" $CONFIG
fi
# no-op if already running
if [ -r /var/run/nzbmegasearch/nzbmegasearch.pid ]; then
return
fi
# if directory doesn't exist or nzbmegasearch is not found, install it
if [[ "$INSTALLDIR" != "" && ! -e "$INSTALLDIR/mega2.py" ]]; then
nzbmegasearch_install
fi
cd
CMDLINE="sudo -u $RUNAS python $INSTALLDIR/mega2.py > /dev/null 2>&1"
echo "Starting NZBmegasearch: $CMDLINE"
sleep 1
cd $INSTALLDIR
$CMDLINE > /dev/null 2>&1 &
echo $! > /var/run/nzbmegasearch/nzbmegasearch.pid
TIMER=0
while [ ! -e /var/run/nzbmegasearch/nzbmegasearch.pid ]; do
sleep 1
let TIMER=$TIMER+1
echo -n $TIMER
if [ $TIMER -gt 10 ]; then
echo -n "nzbmegasearch.pid not created for some reason"
break
fi
done
echo "... OK"
}
nzbmegasearch_stop()
{
# no-op if not running
if [ ! -r /var/run/nzbmegasearch/nzbmegasearch.pid ]; then
return
fi
echo "Stopping nzbmegasearch..."
sleep 1
kill $(cat /var/run/nzbmegasearch/nzbmegasearch.pid)
sleep 3
if [ -e /var/run/nzbmegasearch/nzbmegasearch.pid ]; then
kill -9 $(cat /var/run/nzbmegasearch/nzbmegasearch.pid )
rm /var/run/nzbmegasearch/nzbmegasearch.pid
fi
echo "... OK"
sleep 1
}
nzbmegasearch_restart()
{
nzbmegasearch_stop
sleep 1
nzbmegasearch_start
}
nzbmegasearch_buttonstart()
{
echo "Enabling nzbmegasearch"
CONFIG="/boot/config/plugins/nzbmegasearch/nzbmegasearch.cfg"
if [ -f $CONFIG ]; then
sed -i "s/"disable"/"enable/"" $CONFIG
sleep 3
echo "Starting nzbmegasearch"
nzbmegasearch_start
fi
}
nzbmegasearch_update()
{
nzbmegasearch_stop
sleep 1
nzbmegasearch_install
sleep 1
nzbmegasearch_start
}
write_config()
{
CONFIG="/boot/config/plugins/nzbmegasearch/custom_params.ini"
echo "# nzbmegasearch configuration:" > /boot/config/plugins/nzbmegasearch/nzbmegasearch.cfg
echo "SERVICE=\"$SERVICE\"" >> /boot/config/plugins/nzbmegasearch/nzbmegasearch.cfg
echo "INSTALLDIR=\"$INSTALLDIR\"" >> /boot/config/plugins/nzbmegasearch/nzbmegasearch.cfg
echo "RUNAS=\"$RUNAS\"" >> /boot/config/plugins/nzbmegasearch/nzbmegasearch.cfg
echo "PLG_STORAGESIZE=\"$PLG_STORAGESIZE\"" >> /boot/config/plugins/nzbmegasearch/nzbmegasearch.cfg
if [ -e "$CONFIG" ]; then
sed -i 's!port = '"`cat "$CONFIG" | grep 'port = ' | cut -d' ' -f3 | awk 'NR==1'`"'!port = '"$PORT"'!' "$CONFIG"
fi
}
nzbmegasearch_change_settings()
{
INSTALLDIR="$1"
if [ $RUNAS != $3 ]; then
chown -R $3:users "$INSTALLDIR"
fi
RUNAS="$3"
PORT="$2"
PLG_STORAGESIZE="$4"
# create nzbmegasearch user if necessary
if [[ $RUNAS != "nobody" && $RUNAS != "root" ]]; then
if ( ! grep -q ^$RUNAS /etc/passwd ); then
useradd -r -g users -d / -s /bin/false $RUNAS &> /dev/null
cp /etc/passwd /etc/shadow /boot/config
fi
fi
}
nzbmegasearch_enable()
{
SERVICE=enable
nzbmegasearch_change_settings $1 $2 $3 $4 $5 $6 $7 $8 $9
write_config
nzbmegasearch_restart
}
nzbmegasearch_disable()
{
nzbmegasearch_stop
SERVICE=disable
nzbmegasearch_change_settings $1 $2 $3 $4 $5 $6 $7 $8 $9
write_config
}
nzbmegasearch_install()
{
echo "Installing latest version of nzbmegasearch..."
if [ ! -e "$INSTALLDIR" ]; then
mkdir -p "$INSTALLDIR"
fi
cd /tmp
git clone https://github.com/pillone/usntssearch.git usntssearch
cp -Rfu /tmp/usntssearch/NZBmegasearch/* $INSTALLDIR
rm -Rf /tmp/usntssearch
chmod -R 777 "$INSTALLDIR"
chown -R $RUNAS:users "$INSTALLDIR"
ln -s /boot/config/plugins/nzbmegasearch/custom_params.ini $INSTALLDIR/custom_params.ini
sleep 3
echo "... OK"
sleep 1
}
nzbmegasearch_storagesize()
{
if [ -d $1 ]; then
INST=`du -sh $1 | cut -f1`
elif [ -f $1 ]; then
INST=`ls -lah $1 | awk '{ print $5}'`
fi
echo "<p style="margin-left:10px\;">Storage memory usage: <b>$INST</b></p>"
}
nzbmegasearch_datacheck()
{
array=( ramfs proc tempfs sysfs )
fs=$( stat -f -c '%T' $INSTALLDIR )
for i in "${array[@]}"
do
if [ $i = $fs ]; then
echo "<p style="color:red\;margin-left:10px\;margin-right:10px\;"><b>WARNING:</b> Your Install Directory is not persistent and WILL NOT survive a reboot. Please locate Install Directory on disk for persistency</p>"
break
elif [ $i = msdos ]; then
echo "<p style="color:red\;margin-left:10px\;margin-right:10px\;"><b>WARNING:</b> Your Install Directory is located on your flash drive. This will decrease your flash drives life span!</p>"
break
else
echo "<p style="color:green\;margin-left:10px\;margin-right:10px\;">Your Install will persist after a reboot</p>"
break
fi
done
}
nzbmegasearch_updateplg()
{
cd /boot/config/plugins
[ -f nzbmegasearch_unplugged.plg.old ] && rm -f nzbmegasearch_unplugged.plg.old
if [ -f nzbmegasearch_unplugged.plg ]; then
mv nzbmegasearch_unplugged.plg nzbmegasearch_unplugged.plg.old
echo "Updating plugin"
wget -q --no-check-certificate https://github.com/Influencer/UNplugged/raw/master/nzbmegasearch_unplugged.plg
/usr/local/sbin/installplg /boot/config/plugins/nzbmegasearch_unplugged.plg
else
echo "Updating plugin"
wget -q --no-check-certificate https://github.com/Influencer/UNplugged/raw/master/nzbmegasearch_unplugged.plg
/usr/local/sbin/installplg /boot/config/plugins/nzbmegasearch_unplugged.plg
fi
}
nzbmegasearch_downgradeplg()
{
cd /boot/config/plugins
if [ -f nzbmegasearch_unplugged.plg.old ]; then
rm -f /nzbmegasearch_unplugged.plg
mv nzbmegasearch_unplugged.plg.old nzbmegasearch_unplugged.plg
echo "downgrading plugin"
/usr/local/sbin/installplg /boot/config/plugins/nzbmegasearch_unplugged.plg
fi
}
# read our configuration
source /boot/config/plugins/nzbmegasearch/nzbmegasearch.cfg
CONFIG="/boot/config/plugins/nzbmegasearch/nzbmegasearch.cfg"
case "$1" in
'start')
nzbmegasearch_start
;;
'stop')
nzbmegasearch_stop
;;
'restart')
nzbmegasearch_restart
;;
'enable')
nzbmegasearch_enable $2 $3 $4 $5 $6 $7 $8 $9
;;
'disable')
nzbmegasearch_disable $2 $3 $4 $5 $6 $7 $8 $9
;;
'install')
nzbmegasearch_install
;;
'update')
nzbmegasearch_update
;;
'storagesize')
nzbmegasearch_storagesize $2 $3
;;
'datacheck')
nzbmegasearch_datacheck
;;
'updateplg')
nzbmegasearch_updateplg
;;
'downgradeplg')
nzbmegasearch_downgradeplg
;;
'buttonstart')
nzbmegasearch_buttonstart
;;
*)
echo "usage $0 start|stop|restart|enable|disable|install|update|storagesize|datacheck|updateplg|downgradeplg"
esac
]]>
</INLINE>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/nzbmegasearch/nzbmegasearch.page">
<INLINE>
<![CDATA[
Menu="unplugged"
Icon="nzbmegasearch.png"
Version="1.0"
Author="Benjamin Waller; Influencer"
Type="php"
Title="NZBmegasearch"
]]>
</INLINE>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/nzbmegasearch/nzbmegasearch_logo.png">
<LOCAL>/boot/config/plugins/nzbmegasearch/nzbmegasearch_logo.png</LOCAL>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/nzbmegasearch/device_status.png">
<LOCAL>/boot/config/plugins/images/device_status.png</LOCAL>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/nzbmegasearch/new_config.png">
<LOCAL>/boot/config/plugins/images/new_config.png</LOCAL>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/nzbmegasearch/information.png">
<LOCAL>/boot/config/plugins/images/information.png</LOCAL>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/nzbmegasearch/nzbmegasearch.php">
<INLINE>
<![CDATA[
<?PHP
$nzbmegasearch_cfg = parse_ini_file( "/boot/config/plugins/nzbmegasearch/nzbmegasearch.cfg" );
$nzbmegasearch_installed = file_exists( $nzbmegasearch_cfg["INSTALLDIR"] . "/mega2.py" ) ? "yes" : "no";
$nzbmegasearch_rollback = file_exists( "boot/config/plugins/nzbmegasearch_unplugged.plg.old" ) ? "yes" : "no";
if ($nzbmegasearch_installed=="yes")
{
$nzbmegasearch_running = file_exists( "/var/run/nzbmegasearch/nzbmegasearch.pid") ? "yes" : "no";
if ($nzbmegasearch_cfg[PLG_STORAGESIZE]=="yes")
$nzbmegasearch_datasize = shell_exec ( "/etc/rc.d/rc.nzbmegasearch storagesize $nzbmegasearch_cfg[INSTALLDIR]" );
if ($nzbmegasearch_cfg[PLG_DATACHECK]=="yes")
$nzbmegasearch_datacheck = shell_exec ( "/etc/rc.d/rc.nzbmegasearch datacheck" );
$nzbmegasearch_plgver = shell_exec ( "cat /boot/config/plugins/nzbmegasearch/plgver.txt" );
if (file_exists($nzbmegasearch_cfg["INSTALLDIR"] . "/vernum.num"))
$nzbmegasearch_curversion = shell_exec( "cat $nzbmegasearch_cfg[INSTALLDIR]/vernum.num | cut -f2 -d ' '");
else
$nzbmegasearch_curversion = "couldn't determine the nzbmegasearch version";
if (file_exists("/boot/config/plugins/nzbmegasearch/custom_params.ini"))
$nzbmegasearch_port = trim(shell_exec( "cat /boot/config/plugins/nzbmegasearch/custom_params.ini | grep 'port =' | cut -d' ' -f3" ));
else
$nzbmegasearch_port = "5000";
}
?>
<div style="width: 49%; float:left">
<div id="title">
<span class="left">Status: <img src='/plugins/nzbmegasearch/device_status.png'>
<?if ($nzbmegasearch_installed=="yes"):?>
<?if ($nzbmegasearch_running=="yes"):?>
<a href="http://<?=$var['NAME'];?>:<?=$nzbmegasearch_port;?>" target="_blank"><span class="green"><b>RUNNING</b></span></a><span style="font-size:12px;"> with version: <b><?=$nzbmegasearch_curversion?></b></span>
<?else:?>
<span class="red"><b>STOPPED</b></span>
<?endif;?>
<?else:?>
<span class="red"><b>NOT INSTALLED</b></span>
<?endif;?>
</span>
</div>
<?if ($nzbmegasearch_installed=="yes"):?>
<?if ($nzbmegasearch_running=="yes"):?>
<div style="position:relative;float:left;width:50%;text-align:right; margin-bottom:24px">
<form name="nzbmegasearch_start_stop" method="POST" action="/update.htm" target="progressFrame">
<input type="hidden" name="cmd" value="/etc/rc.d/rc.nzbmegasearch stop">
<input type="submit" name="runCmd" value="Stop">
</form>
</div>
<div style="position:relative;float:left;width:50%;margin-bottom:24px">
<form name="nzbmegasearch_restart" method="POST" action="/update.htm" target="progressFrame">
<input type="hidden" name="cmd" value="/etc/rc.d/rc.nzbmegasearch restart">
<input type="submit" name="runCmd" value="Restart">
</form>
</div>
<?else:?>
<div style="position:relative;float:left;width:100%;text-align:center;margin-bottom:24px">
<form name="nzbmegasearch_start" method="POST" action="/update.htm" target="progressFrame">
<input type="hidden" name="cmd" value="/etc/rc.d/rc.nzbmegasearch buttonstart">
<input type="submit" name="runCmd" value="Start">
</form>
</div>
<?endif;?>
<?else:?>
<div style="position:relative;float:left;width:100%;text-align:center;margin-bottom:24px">
<form name="nzbmegasearch_install" method="POST" action="/update.htm" target="progressFrame">
<input type="hidden" name="cmd" value="/etc/rc.d/rc.nzbmegasearch install">
<input type="submit" name="runCmd" value="Install">
</form>
</div>
<?endif;?>
<? if ($nzbmegasearch_rollback=="yes"): ?>
<div style="position:relative;float:left;width:50%;text-align:right;margin-bottom:24px">
<form name="nzbmegasearch_update1" method="POST" action="/update.htm" target="progressFrame">
<input type="hidden" name="cmd" value="/etc/rc.d/rc.nzbmegasearch updateplg">
<input type="submit" name="runCmd" value="Update PLG">
</form>
</div>
<div style="position:relative;float:left;width:50%;text-align:left;margin-bottom:24px">
<form name="nzbmegasearch_downgrade" method="POST" action="/update.htm" target="progressFrame">
<input type="hidden" name="cmd" value="/etc/rc.d/rc.nzbmegasearch downgradeplg">
<input type="submit" name="runCmd" value="Downgrade PLG">
</form>
</div>
<?else:?>
<div style="position:relative;float:left;width:100%;text-align:center;margin-bottom:24px">
<form name="nzbmegasearch_update" method="POST" action="/update.htm" target="progressFrame">
<input type="hidden" name="cmd" value="/etc/rc.d/rc.nzbmegasearch updateplg">
<input type="submit" name="runCmd" value="Update PLG">
</form>
</div>
<?endif;?><br/>
<? if ($nzbmegasearch_installed=="yes"): ?>
<center><hr size="3" width="50%" color="grey"></center>
<? if ($nzbmegasearch_cfg[PLG_STORAGESIZE]=="yes"): ?>
<?=$nzbmegasearch_datasize?>
<? endif; ?>
<?=$nzbmegasearch_datacheck?>
<p style="margin-left:10px;"><b>Plug-in Version: <?=$nzbmegasearch_plgver;?></b></p>
<? endif; ?>
</div>
<div style="width: 49%; float:right">
<div id="title">
<span class="left">Configuration: <img src='/plugins/nzbmegasearch/new_config.png'></span>
</div>
<form name="nzbmegasearch_settings" method="POST" action="/update.htm" target="progressFrame">
<input type="hidden" name="cmd" value="/etc/rc.d/rc.nzbmegasearch">
<table class="settings">
<tr>
<td>Enable NZBmegasearch:</td>
<td>
<select name="arg1" size="1">
<?=mk_option($nzbmegasearch_cfg['SERVICE'], "disable", "No");?>
<?=mk_option($nzbmegasearch_cfg['SERVICE'], "enable", "Yes");?>
</select>
</td>
</tr>
<tr>
<td>Install directory:</td>
<td><input type="text" name="arg2" maxlength="60" value="<?=$nzbmegasearch_cfg['INSTALLDIR'];?>"></td>
</tr>
<tr>
<td>Port:</td>
<td><input type="text" name="arg3" maxlength="40" value="<?=$nzbmegasearch_port;?>"></td>
</tr>
<tr>
<td>Run as user:</td>
<td>
<select name="runas" size="1" onChange="checkUSER(this.form);">
<?=mk_option($nzbmegasearch_cfg['RUNAS'], "nobody", "nobody");?>
<?=mk_option($nzbmegasearch_cfg['RUNAS'], "root", "root");?>
<option value='other'<?=($nzbmegasearch_cfg['RUNAS'] != "root" && $nzbmegasearch_cfg['RUNAS'] != "nobody")?" selected=yes":"" ;?>>other</option>
</select>
<input type="hidden" name="arg4" style="width:66%" maxlength="40" value="<?=$nzbmegasearch_cfg['RUNAS'];?>">
</td>
</tr>
<tr><td>---</td></tr>
<tr>
<td>Show storage memory usage:</td>
<td>
<select name="storagesize" size="1" onChange="checkSTORAGE(this.form);">
<?=mk_option($nzbmegasearch_cfg['PLG_STORAGESIZE'], "yes", "Yes");?>
<?=mk_option($nzbmegasearch_cfg['PLG_STORAGESIZE'], "no", "No");?>
</select>
<input type="hidden" name="arg5" value="<?=$nzbmegasearch_cfg['PLG_STORAGESIZE'];?>">
</td>
</tr>
</table>
<div align="center">
<hr size="3" align="center" width="75%" color="grey" style="margin-top:20px;margin-bottom:18px" >
<input type="submit" name="runCmd" value="Apply" style="margin-bottom:8px">
<button type="button" style="margin-bottom:35px" onClick="done();">Done</button>
</div>
</form>
<br />
</div>
<script type="text/javascript">
function checkUSER(form)
{
if (form.runas.selectedIndex < 2 )
{
form.arg4.value = form.runas.options[form.runas.selectedIndex].value;
form.arg4.type = "hidden";
}
else
{
form.arg4.value = "<?=$nzbmegasearch_cfg['RUNAS'];?>";
form.arg4.type = "text";
}
}
function checkSTORAGE(form)
{
form.arg5.value = form.storagesize.options[form.storagesize.selectedIndex].value;
}
function checkDATA(form)
{
form.arg7.value = form.datacheck.options[form.datacheck.selectedIndex].value;
}
checkUSER(document.nzbmegasearch_settings);
checkSTORAGE(document.nzbmegasearch_settings);
checkDATA(document.nzbmegasearch_settings);
</script>
]]>
</INLINE>
</FILE>
<!-- event handler -->
<FILE Name="/usr/local/emhttp/plugins/nzbmegasearch/event/disks_mounted" Mode="0770">
<INLINE>
<![CDATA[
#!/bin/bash
source /boot/config/plugins/nzbmegasearch/nzbmegasearch.cfg
if [ $SERVICE = enable ]; then
/etc/rc.d/rc.nzbmegasearch start
fi
]]>
</INLINE>
</FILE>
<!-- event handler -->
<FILE Name="/usr/local/emhttp/plugins/nzbmegasearch/event/unmounting_disks" Mode="0770">
<INLINE>
<![CDATA[
#!/bin/bash
/etc/rc.d/rc.nzbmegasearch stop
]]>
</INLINE>
</FILE>
<FILE Name="/tmp/nzbmegasearch-install" Run="/bin/bash">
<INLINE>
<![CDATA[
# include our config vars
source /boot/config/plugins/nzbmegasearch/nzbmegasearch.cfg
# create nzbmegasearch-writable directory for pid file
if [ ! -e /var/run/nzbmegasearch ]; then
mkdir /var/run/nzbmegasearch
chown $RUNAS:users /var/run/nzbmegasearch
chmod 0777 /var/run/nzbmegasearch
fi
rm /tmp/nzbmegasearch-install
]]>
</INLINE>
</FILE>
<FILE Name="/var/log/plugins/nzbmegasearch">
<INLINE>
<![CDATA[
]]>
</INLINE>
</FILE>
</PLUGIN>