forked from hummypkg/webif
1.2.1-8
git-svn-id: file:///root/webif/svn/pkg/webif/trunk@2346 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
Package: webif
|
Package: webif
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: web
|
Section: web
|
||||||
Version: 1.2.1-7
|
Version: 1.2.1-8
|
||||||
Architecture: mipsel
|
Architecture: mipsel
|
||||||
Maintainer: af123@hummypkg.org.uk
|
Maintainer: af123@hummypkg.org.uk
|
||||||
Depends: webif-channelicons(>=1.1.14),lighttpd(>=1.4.35-2),jim(>=0.76),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.0),hmt(>=2.0.3),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,mongoose,recmon(>=2.0.2)
|
Depends: webif-channelicons(>=1.1.14),lighttpd(>=1.4.35-2),jim(>=0.76),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.0),hmt(>=2.0.3),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,mongoose,recmon(>=2.0.2)
|
||||||
|
|||||||
@@ -54,6 +54,12 @@ fi
|
|||||||
hook=/mod/boot/xinit.d/rt3070
|
hook=/mod/boot/xinit.d/rt3070
|
||||||
[ -f $hook ] && rm -f $hook
|
[ -f $hook ] && rm -f $hook
|
||||||
|
|
||||||
|
# Migrate record log to new name.
|
||||||
|
(
|
||||||
|
cd /mod/tmp
|
||||||
|
[ -f record.log -a ! -f activity.log ] && mv record.log activity.log
|
||||||
|
)
|
||||||
|
|
||||||
[ -f $tmpf ] && rm -f $tmpf
|
[ -f $tmpf ] && rm -f $tmpf
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -17,5 +17,6 @@ Humax [system model] Fox T2 ([system hostname])
|
|||||||
Custom firmware version: $modver
|
Custom firmware version: $modver
|
||||||
Web interface version: [system pkgver webif]
|
Web interface version: [system pkgver webif]
|
||||||
Serial Number: [system serialno]
|
Serial Number: [system serialno]
|
||||||
|
Last Boot Reason: [system lastbootreason]
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|||||||
BIN
boot/xinit.d/ahw
Executable file
BIN
boot/xinit.d/ahw
Executable file
Binary file not shown.
18
etc/init.d/S59webif
Executable file
18
etc/init.d/S59webif
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /mod/webif/lib/lib.sh
|
||||||
|
|
||||||
|
export TZ=GMT+0BST,M3.5.0/1,M10.5.0/2
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
/mod/webif/lib/bin/manage_logs
|
||||||
|
plog activity "System booted (`lbr_descr`)."
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
@@ -15,10 +15,5 @@ set ch [$ts get channel_name]
|
|||||||
set dur [$ts duration]
|
set dur [$ts duration]
|
||||||
set title [$ts get title]
|
set title [$ts get title]
|
||||||
|
|
||||||
set msg "Recorded: $dir/$title ($dur minutes - $ch)"
|
system plog activity "Recorded: $dir/$title ($dur minutes - $ch)"
|
||||||
set logfd [open "/mod/tmp/record.log" "a+"]
|
|
||||||
puts $logfd "[\
|
|
||||||
clock format [clock seconds] -format "%d/%m/%Y %H:%M"\
|
|
||||||
] - $msg"
|
|
||||||
$logfd close
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
#!/mod/bin/jimsh
|
|
||||||
|
|
||||||
package require cgi
|
|
||||||
source /mod/webif/lib/setup
|
|
||||||
require rsv.class system.class
|
|
||||||
|
|
||||||
httpheader
|
|
||||||
|
|
||||||
if {[cgi_get act] eq "cancel"} {
|
|
||||||
system restartpending 0
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
if {[cgi_get now] eq "yes"} {
|
|
||||||
# - Busybox reboot does sync the disk but may still not be clean enough.
|
|
||||||
puts "Restarting."
|
|
||||||
system reboot
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
system restartpending 0
|
|
||||||
jqplugin progressbar
|
|
||||||
header
|
|
||||||
|
|
||||||
# Commit pending reservations on older mod versions.
|
|
||||||
if {![file exists /sbin/rsvsync] && ![file exists /mod/boot/rsvsync]} {
|
|
||||||
rsv commit
|
|
||||||
}
|
|
||||||
|
|
||||||
puts {
|
|
||||||
|
|
||||||
<script type=text/javascript>
|
|
||||||
var handle = 0;
|
|
||||||
var pct = 0;
|
|
||||||
function update()
|
|
||||||
{
|
|
||||||
$('#progressbar').reportprogress(++pct);
|
|
||||||
if (pct == 100)
|
|
||||||
{
|
|
||||||
clearInterval(handle);
|
|
||||||
pct = 0;
|
|
||||||
window.location = '/';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('#progressbar').reportprogress(0);
|
|
||||||
handle = setInterval("update()" , 400);
|
|
||||||
$.get('/cgi-bin/restart.jim?now=yes');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
Please wait while the Humax restarts...<br>
|
|
||||||
<div id=progressbar></div>
|
|
||||||
}
|
|
||||||
|
|
||||||
footer
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/mod/bin/jimsh
|
|
||||||
|
|
||||||
source /mod/webif/lib/setup
|
|
||||||
httpheader
|
|
||||||
|
|
||||||
source /mod/webif/include/restart.jim
|
|
||||||
|
|
||||||
@@ -11,6 +11,7 @@ set schedtime 1200
|
|||||||
switch $runmode {
|
switch $runmode {
|
||||||
cgi {
|
cgi {
|
||||||
set type [cgi_get type "full"]
|
set type [cgi_get type "full"]
|
||||||
|
set schedtime [cgi_get schedtime 1200]
|
||||||
httpheader
|
httpheader
|
||||||
}
|
}
|
||||||
cli {
|
cli {
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ $(document).ready(function() {
|
|||||||
$('#restore_working').slideUp();
|
$('#restore_working').slideUp();
|
||||||
refresh_files();
|
refresh_files();
|
||||||
$('#restore_warning').slideDown();
|
$('#restore_warning').slideDown();
|
||||||
$('#restart_block').load(
|
$('#restart_block').slideDown('slow');
|
||||||
'/cgi-bin/restartblock.jim');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -456,15 +456,19 @@ div#restart_block
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
z-index: 31;
|
z-index: 31;
|
||||||
float: right;
|
float: right;
|
||||||
width: 60%;
|
width: 130px;
|
||||||
position: absolute;
|
position: relative;
|
||||||
top: 10px;
|
top: 20px;
|
||||||
left: 100px;
|
|
||||||
background-color: #f8f8f8;
|
background-color: #f8f8f8;
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
filter:alpha(opacity=90);
|
filter:alpha(opacity=90);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button#restart_humaxtv
|
||||||
|
{
|
||||||
|
margin-bottom: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
img.bmp, img.doublebmp
|
img.bmp, img.doublebmp
|
||||||
{
|
{
|
||||||
transform: scaleY(-1);
|
transform: scaleY(-1);
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ puts {
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=2>
|
<td colspan=2>
|
||||||
<button id=reboot style="width: 100%">Reboot System</button>
|
<button id=reboot class=red style="width: 100%">Reboot System</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|||||||
@@ -57,14 +57,9 @@ $('#dspace').click(function(e) {
|
|||||||
window.location = 'dspace/index.jim';
|
window.location = 'dspace/index.jim';
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#reboot').click(function(e) {
|
$('#reboot').button({icons:{primary:"ui-icon-power"}}).click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (confirm('Are you sure you wish to perform a reboot now?'))
|
window.location = '/restart/index.jim';
|
||||||
if (confirm('Really sure?\n\nThere is a small chance the ' +
|
|
||||||
' Humax may not restart\n' +
|
|
||||||
'without physical intervention.\n\n' +
|
|
||||||
'i.e. pressing the standby button or using the remote control'))
|
|
||||||
window.location = '/cgi-bin/restart.jim';
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#runreset').click(function(e) {
|
$('#runreset').click(function(e) {
|
||||||
|
|||||||
BIN
webif/html/img/amberring.png
Normal file
BIN
webif/html/img/amberring.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
BIN
webif/html/img/bluering.png
Normal file
BIN
webif/html/img/bluering.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
BIN
webif/html/img/purplering.png
Normal file
BIN
webif/html/img/purplering.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
BIN
webif/html/img/redring.png
Normal file
BIN
webif/html/img/redring.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
@@ -7,8 +7,7 @@ $(function() {
|
|||||||
'&event=' +
|
'&event=' +
|
||||||
encodeURIComponent($('#dialogue').attr('xe')) +
|
encodeURIComponent($('#dialogue').attr('xe')) +
|
||||||
'&type=' + type, function() {
|
'&type=' + type, function() {
|
||||||
$('#restart_block')
|
$('#restart_block').slideDown('slow');
|
||||||
.load('/cgi-bin/restartblock.jim');
|
|
||||||
});
|
});
|
||||||
$(":button:contains('Record')").fadeOut('slow');
|
$(":button:contains('Record')").fadeOut('slow');
|
||||||
$(":button:contains('Reminder')").fadeOut('slow');
|
$(":button:contains('Reminder')").fadeOut('slow');
|
||||||
|
|||||||
6
webif/html/js/restart.js
Normal file
6
webif/html/js/restart.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
$('#restart_humaxtv').button({icons:{primary:"ui-icon-power"}})
|
||||||
|
.on('click', function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
window.location = '/restart/index.jim';
|
||||||
|
});
|
||||||
|
|
||||||
@@ -44,9 +44,6 @@ puts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
source /mod/webif/html/lib/topbar.jim
|
source /mod/webif/html/lib/topbar.jim
|
||||||
puts "<center><div id=restart_block>"
|
|
||||||
source /mod/webif/include/restart.jim
|
|
||||||
puts "</div></center>"
|
|
||||||
source /mod/webif/include/diskcheck.jim
|
source /mod/webif/include/diskcheck.jim
|
||||||
source /mod/webif/include/notify.jim
|
source /mod/webif/include/notify.jim
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ puts {
|
|||||||
<!-- Start include diskspace - above other items to work around IE feature.. -->
|
<!-- Start include diskspace - above other items to work around IE feature.. -->
|
||||||
}
|
}
|
||||||
source /mod/webif/html/diskspace/diskspace.jim
|
source /mod/webif/html/diskspace/diskspace.jim
|
||||||
|
source /mod/webif/include/restart.jim
|
||||||
puts {
|
puts {
|
||||||
<!-- End include diskspace -->
|
<!-- End include diskspace -->
|
||||||
<img border=0 src=/images/516_1_26_Freeview_Logo.png>
|
<img border=0 src=/images/516_1_26_Freeview_Logo.png>
|
||||||
|
|||||||
76
webif/html/restart/index.jim
Executable file
76
webif/html/restart/index.jim
Executable file
@@ -0,0 +1,76 @@
|
|||||||
|
#!/mod/bin/jimsh
|
||||||
|
|
||||||
|
source /mod/webif/lib/setup
|
||||||
|
require rsv.class system.class
|
||||||
|
jqplugin progressbar blockui
|
||||||
|
jscss script.js style.css
|
||||||
|
|
||||||
|
header
|
||||||
|
|
||||||
|
puts {
|
||||||
|
|
||||||
|
<div class="va cleft">
|
||||||
|
<img class=va src=/img/bluering.png height=40>
|
||||||
|
<span class=va>Restart Humax...</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<fieldset class=cleft>
|
||||||
|
<legend><span class=blood><i>
|
||||||
|
Box status and events for the next two hours
|
||||||
|
</i></span></legend>
|
||||||
|
|
||||||
|
<div id=restart_status>
|
||||||
|
<span class=blood><img src=/img/loading.gif>
|
||||||
|
Retrieving status...
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
}
|
||||||
|
|
||||||
|
puts "
|
||||||
|
<div class=cleft>
|
||||||
|
<table class=keyval><tr>
|
||||||
|
<th>Last boot reason</th>
|
||||||
|
<td>[system lastbootreason]</td>
|
||||||
|
</tr></table>
|
||||||
|
"
|
||||||
|
if {[system lastbootreason 0] == 3} {
|
||||||
|
puts {
|
||||||
|
<div class="pinkshade" style="padding: 0.5em; margin: 1em 4em; width: 60%">
|
||||||
|
<dl>
|
||||||
|
<dt>WARNING:</dt>
|
||||||
|
<dd>
|
||||||
|
The last boot was for a scheduled recording/reminder event. If you reboot
|
||||||
|
the box in this state, it may end up in standby and require manual
|
||||||
|
intervention.
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
puts "
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class=cleft>
|
||||||
|
"
|
||||||
|
|
||||||
|
if {[system busy]} {
|
||||||
|
puts "<div class=blood>
|
||||||
|
System is busy, cannot restart at the moment.</div>"
|
||||||
|
} else {
|
||||||
|
puts {
|
||||||
|
<div class=cleft>
|
||||||
|
<button id=restartbutton class=red>Restart the Humax now...</button>
|
||||||
|
<div id=restarting class=hidden>
|
||||||
|
Please wait while the Humax restarts...<br>
|
||||||
|
<div id=xprogressbar></div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
puts "</div>"
|
||||||
|
|
||||||
|
footer
|
||||||
|
|
||||||
17
webif/html/restart/restart.jim
Executable file
17
webif/html/restart/restart.jim
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/mod/bin/jimsh
|
||||||
|
|
||||||
|
package require cgi
|
||||||
|
source /mod/webif/lib/setup
|
||||||
|
require system.class
|
||||||
|
|
||||||
|
set now [cgi_get now no]
|
||||||
|
|
||||||
|
httpheader
|
||||||
|
|
||||||
|
if {$now eq "yes"} {
|
||||||
|
puts "Rebooting..."
|
||||||
|
system reboot
|
||||||
|
} else {
|
||||||
|
puts "Not rebooting..."
|
||||||
|
}
|
||||||
|
|
||||||
45
webif/html/restart/script.js
Normal file
45
webif/html/restart/script.js
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
var handle = 0;
|
||||||
|
var pct = 0;
|
||||||
|
function update()
|
||||||
|
{
|
||||||
|
$('#progressbar').reportprogress(++pct);
|
||||||
|
if (pct == 100)
|
||||||
|
{
|
||||||
|
clearInterval(handle);
|
||||||
|
pct = 0;
|
||||||
|
$.blockUI({
|
||||||
|
message: '<h1><img src=/img/loading.gif> ' +
|
||||||
|
'Reconnecting...</h1>',
|
||||||
|
css: { background: '#ffffcc' }
|
||||||
|
});
|
||||||
|
window.location = '/';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
|
||||||
|
$('#restartbutton').button({icons:{primary:"ui-icon-power"}})
|
||||||
|
.button('disable')
|
||||||
|
.on('click', function() {
|
||||||
|
$(this).button('disable');
|
||||||
|
$('#restarting').slideDown('slow');
|
||||||
|
handle = setInterval("update()" , 500);
|
||||||
|
$.blockUI({
|
||||||
|
message: '<h1><img src=/img/loading.gif> Restarting...</h1>' +
|
||||||
|
'<br>' +
|
||||||
|
'<center><div id=progressbar></div></center>',
|
||||||
|
css: { background: '#ffffcc' }
|
||||||
|
});
|
||||||
|
$('#progressbar').reportprogress(0);
|
||||||
|
$.get('restart.jim?now=yes');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#restart_status').load('/cgi-bin/status.jim?schedtime=7200', function() {
|
||||||
|
$('#restartbutton').button('enable');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#restart_humaxtv').button('disable').hide();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
12
webif/html/restart/style.css
Normal file
12
webif/html/restart/style.css
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
div.cleft
|
||||||
|
{
|
||||||
|
padding-top: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#progressbar
|
||||||
|
{
|
||||||
|
width: 95%;
|
||||||
|
margin: 0 0 1em 0;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -9,8 +9,50 @@ puts -nonewline "
|
|||||||
<legend> Advanced Settings </legend>
|
<legend> Advanced Settings </legend>
|
||||||
<table>
|
<table>
|
||||||
"
|
"
|
||||||
|
|
||||||
setting_toggle "Show development and advanced packages?" "pkgdev" $pkgdev
|
setting_toggle "Show development and advanced packages?" "pkgdev" $pkgdev
|
||||||
|
|
||||||
|
puts -nonewline "
|
||||||
|
<tr>
|
||||||
|
<form class=auto id=logsize method=get action=$env(SCRIPT_NAME)>
|
||||||
|
<th class=key>Rotate logs when they exceed</th>
|
||||||
|
<td><select name=logsize
|
||||||
|
class=\"text ui-widget-content ui-corner-all\">
|
||||||
|
"
|
||||||
|
set sizes { 102400 262144 524288 1048576 1572864 2097152 }
|
||||||
|
foreach size $sizes {
|
||||||
|
puts -nonewline "<option value=$size"
|
||||||
|
if {$logsize == $size} { puts -nonewline " selected" }
|
||||||
|
puts ">[pretty_size $size]"
|
||||||
|
}
|
||||||
|
puts "
|
||||||
|
</select>
|
||||||
|
<small>
|
||||||
|
<input value=\"set\" type=submit>
|
||||||
|
</small>
|
||||||
|
<div id=logsize_output></div>
|
||||||
|
</td>
|
||||||
|
</form>
|
||||||
|
</tr>
|
||||||
|
"
|
||||||
|
|
||||||
|
puts -nonewline "
|
||||||
|
<tr>
|
||||||
|
<form class=auto id=logkeep method=get action=$env(SCRIPT_NAME)>
|
||||||
|
<th class=key>How many rotated logs to keep</th>
|
||||||
|
<td>
|
||||||
|
<input name=logkeep size=5 type=number
|
||||||
|
class=\"text ui-widget-content ui-corner-all\"
|
||||||
|
maxlength=10 value=\"$logkeep\">
|
||||||
|
<small>
|
||||||
|
<input value=\"set\" type=submit>
|
||||||
|
</small>
|
||||||
|
<div id=logkeep_output></div>
|
||||||
|
</td>
|
||||||
|
</form>
|
||||||
|
</tr>
|
||||||
|
"
|
||||||
|
|
||||||
if {[system modversion 1] >= 214} {
|
if {[system modversion 1] >= 214} {
|
||||||
setting_toggle "Expert mode telnet server?" "xtelnet" \
|
setting_toggle "Expert mode telnet server?" "xtelnet" \
|
||||||
[file exists /mod/boot/xtelnet] 0 1
|
[file exists /mod/boot/xtelnet] 0 1
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ set smtp_server [$settings smtp_server]
|
|||||||
set channel_group [$settings channel_group]
|
set channel_group [$settings channel_group]
|
||||||
set epg_style [$settings epg_style]
|
set epg_style [$settings epg_style]
|
||||||
set service_style [$settings service_style]
|
set service_style [$settings service_style]
|
||||||
set pkgdev [$settings pkgdev]
|
|
||||||
set notoolbar [$settings notoolbar]
|
set notoolbar [$settings notoolbar]
|
||||||
set nomobile [$settings nomobile]
|
set nomobile [$settings nomobile]
|
||||||
set nohelplinks [$settings nohelplinks]
|
set nohelplinks [$settings nohelplinks]
|
||||||
@@ -47,8 +46,11 @@ set chanchangenc [$settings chanchangenc]
|
|||||||
set xepghours [$settings xepghours]
|
set xepghours [$settings xepghours]
|
||||||
if {$xepghours == 0} { set xepghours 4 }
|
if {$xepghours == 0} { set xepghours 4 }
|
||||||
set genrededup [$settings genrededup]
|
set genrededup [$settings genrededup]
|
||||||
set autolog [$settings autolog]
|
|
||||||
set audiomp3 [$settings audiomp3]
|
set audiomp3 [$settings audiomp3]
|
||||||
|
set autolog [$settings autolog]
|
||||||
|
set pkgdev [$settings pkgdev]
|
||||||
|
set logsize [$settings logsize]
|
||||||
|
set logkeep [$settings logkeep]
|
||||||
|
|
||||||
# Handle updates
|
# Handle updates
|
||||||
|
|
||||||
@@ -87,6 +89,8 @@ handle_int_update xepghours $xepghours "Grid EPG Hours"
|
|||||||
handle_str_update epg_style $epg_style "EPG Type"
|
handle_str_update epg_style $epg_style "EPG Type"
|
||||||
handle_str_update service_style $service_style "EPG Channel Type"
|
handle_str_update service_style $service_style "EPG Channel Type"
|
||||||
handle_int_update pkgdev $pkgdev "Development Package Display"
|
handle_int_update pkgdev $pkgdev "Development Package Display"
|
||||||
|
handle_int_update logsize $logsize "Log rotation size"
|
||||||
|
handle_int_update logkeep $logkeep "Logs to keep"
|
||||||
handle_int_update notoolbar $notoolbar "Disable toolbar"
|
handle_int_update notoolbar $notoolbar "Disable toolbar"
|
||||||
handle_int_update nomobile $nomobile "Disable mobile link"
|
handle_int_update nomobile $nomobile "Disable mobile link"
|
||||||
handle_int_update nohelplinks $nohelplinks "Disable help links"
|
handle_int_update nohelplinks $nohelplinks "Disable help links"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ catch {set fhtcpversion [system fhtcpversion]}
|
|||||||
catch {set kernelver [system kernelver]}
|
catch {set kernelver [system kernelver]}
|
||||||
puts "<br>Humax Version: $fhtcpversion (kernel $kernelver)"
|
puts "<br>Humax Version: $fhtcpversion (kernel $kernelver)"
|
||||||
puts "<br>Serial Number: [system serialno]"
|
puts "<br>Serial Number: [system serialno]"
|
||||||
|
puts "<br>Last Boot Reason: [system lastbootreason]"
|
||||||
|
|
||||||
puts "</span>"
|
puts "</span>"
|
||||||
|
|
||||||
|
|||||||
@@ -1,62 +1,35 @@
|
|||||||
#!/mod/bin/jimsh
|
#!/mod/bin/jimsh
|
||||||
|
|
||||||
source /mod/webif/lib/setup
|
set class "class=hidden"
|
||||||
|
|
||||||
if {[file exists /tmp/.restartpending]} {
|
if {[file exists /tmp/.restartpending]} {
|
||||||
|
source /mod/webif/lib/setup
|
||||||
require system.class rsv.class
|
require system.class rsv.class
|
||||||
|
if {[rsv count pending] <= 0} {
|
||||||
if {[rsv count pending] > 0} {
|
system restartpending 0
|
||||||
|
set class ""
|
||||||
puts {
|
}
|
||||||
<center>
|
|
||||||
<div style="width: 100%; height: 0.7em;
|
|
||||||
background: url(/img/stripes.gif) repeat-x;"></div>
|
|
||||||
<div style="font-size: 1.2em; width: 60%; text-align: center; padding: 0.5em">
|
|
||||||
A restart is required in order to complete a scheduling operation or
|
|
||||||
system settings change.
|
|
||||||
<br>
|
|
||||||
<font class=blood>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
puts "<div id=restart_block $class>"
|
||||||
|
puts {
|
||||||
|
<div style="width: 100%; height: 0.7em;
|
||||||
|
background: url(/img/stripes.gif) repeat-x;"></div>
|
||||||
|
<div>
|
||||||
|
Restart required.
|
||||||
|
}
|
||||||
if {[system busy]} {
|
if {[system busy]} {
|
||||||
puts "Cannot restart whilst box is busy."
|
puts "<div class=blood><i>System busy...</i></div>"
|
||||||
} else {
|
} else {
|
||||||
puts {
|
puts {
|
||||||
Restart via the remote control or
|
<button class=red id=restart_humaxtv>Reboot now</button>
|
||||||
<small><button id=restart_humaxtv>Restart now</button></small>
|
<script type=text/javascript src=/js/restart.js></script>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
puts {
|
puts {
|
||||||
<small><button id=restart_cancel>Dismiss</button></small>
|
|
||||||
</font>
|
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 100%; height: 0.7em;
|
<div style="width: 100%; height: 0.7em;
|
||||||
background: url(/img/stripes.gif) repeat-x;"></div>
|
background: url(/img/stripes.gif) repeat-x;"></div>
|
||||||
</center>
|
</div>
|
||||||
<script type=text/javascript>
|
|
||||||
$('#restart_humaxtv').button()
|
|
||||||
.click(function() {
|
|
||||||
if (confirm('Are you sure you wish to perform a restart now?'))
|
|
||||||
if (confirm('Really sure?\n\nThere is a small chance the ' +
|
|
||||||
' Humax may not restart\n' +
|
|
||||||
'without physical intervention.\n\n' +
|
|
||||||
'i.e. pressing the standby button or using the ' +
|
|
||||||
'remote control'))
|
|
||||||
window.location = '/cgi-bin/restart.jim';
|
|
||||||
});
|
|
||||||
$('#restart_cancel').button()
|
|
||||||
.click(function() {
|
|
||||||
$.get('/cgi-bin/restart.jim?act=cancel');
|
|
||||||
$('#restart_block').slideUp('slow');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
system restartpending 0
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,9 +32,7 @@ if {[lindex $argv 0] eq "-d"} {
|
|||||||
|
|
||||||
proc log {msg {level 1}} {
|
proc log {msg {level 1}} {
|
||||||
if {$level > $::loglevel} return
|
if {$level > $::loglevel} return
|
||||||
puts $::logfd "[\
|
puts $::logfd "[system logtimestamp] - $msg"
|
||||||
clock format [clock seconds] -format "%d/%m/%Y %H:%M"\
|
|
||||||
] - $msg"
|
|
||||||
flush $::logfd
|
flush $::logfd
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,6 +166,7 @@ proc dedup {dir} {
|
|||||||
log $line 2
|
log $line 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
incr ::recalc
|
||||||
}
|
}
|
||||||
|
|
||||||
proc do_shrink {ts} {
|
proc do_shrink {ts} {
|
||||||
@@ -321,7 +320,7 @@ proc do_decrypt {ts} {
|
|||||||
|
|
||||||
if {[file size $file] != [file size "$tmp/$bfile"]} {
|
if {[file size $file] != [file size "$tmp/$bfile"]} {
|
||||||
log " $file - File size mismatch." 0
|
log " $file - File size mismatch." 0
|
||||||
file delete "$tmp/$bfile"
|
file tdelete "$tmp/$bfile"
|
||||||
endop
|
endop
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -330,7 +329,7 @@ proc do_decrypt {ts} {
|
|||||||
# now being played even though it was free when decryption started.
|
# now being played even though it was free when decryption started.
|
||||||
if {[$ts inuse]} {
|
if {[$ts inuse]} {
|
||||||
log " $file - In use."
|
log " $file - In use."
|
||||||
file delete "$tmp/$bfile"
|
file tdelete "$tmp/$bfile"
|
||||||
endop
|
endop
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -345,7 +344,7 @@ proc do_decrypt {ts} {
|
|||||||
if {$anencd != "0"} {
|
if {$anencd != "0"} {
|
||||||
log " $file - File did not decrypt properly." 0
|
log " $file - File did not decrypt properly." 0
|
||||||
system notify "$file - auto-decrypt failed."
|
system notify "$file - auto-decrypt failed."
|
||||||
file delete "$tmp/$bfile"
|
file tdelete "$tmp/$bfile"
|
||||||
endop
|
endop
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
68
webif/lib/bin/manage_logs
Executable file
68
webif/lib/bin/manage_logs
Executable file
@@ -0,0 +1,68 @@
|
|||||||
|
#!/mod/bin/jimsh
|
||||||
|
|
||||||
|
source /mod/webif/lib/setup
|
||||||
|
require settings.class
|
||||||
|
|
||||||
|
set s [settings]
|
||||||
|
set logsize [$s logsize]
|
||||||
|
set logkeep [$s logkeep]
|
||||||
|
|
||||||
|
puts "Rotating at $logsize, keeping $logkeep"
|
||||||
|
|
||||||
|
set logdir "/mod/tmp"
|
||||||
|
set baselogs {}
|
||||||
|
|
||||||
|
puts "\n-- Rotate\n"
|
||||||
|
|
||||||
|
foreach log [glob -nocomplain -tail -directory $logdir *.log] {
|
||||||
|
|
||||||
|
puts "\[$log\]"
|
||||||
|
set tstamp [clock format [clock seconds] -format {%Y%m%d%H%M%S}]
|
||||||
|
|
||||||
|
# Check for old-style rotated log.
|
||||||
|
if {[string match {*_old.log} $log]} {
|
||||||
|
set new "[string range $log 0 end-8].$tstamp.log"
|
||||||
|
puts " -> $new"
|
||||||
|
file rename "$logdir/$log" "$logdir/$new"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check for already rotated log.
|
||||||
|
if {[regexp -- {\.[0-9]{14}\.log$} $log]} {
|
||||||
|
puts " already rotated."
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
ladd baselogs $log
|
||||||
|
|
||||||
|
if {[file size "$logdir/$log"] > $logsize} {
|
||||||
|
set new "[file rootname $log].$tstamp.log"
|
||||||
|
puts " -> $new"
|
||||||
|
file rename "$logdir/$log" "$logdir/$new"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
puts "\n-- Purge\n"
|
||||||
|
|
||||||
|
proc logsort {a b} {
|
||||||
|
global logdir
|
||||||
|
return [expr [file mtime "$logdir/$a"] - [file mtime "$logdir/$b"]]
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach log $baselogs {
|
||||||
|
# Count the number of rotated logs
|
||||||
|
|
||||||
|
set old [glob -nocomplain -tail -directory $logdir \
|
||||||
|
"[string range $log 0 end-4].*.log"]
|
||||||
|
set num [llength $old]
|
||||||
|
|
||||||
|
puts "\[$log\] - $num"
|
||||||
|
|
||||||
|
if {$num <= $logkeep} continue
|
||||||
|
|
||||||
|
lmap i [lrange [lsort -command logsort $old] 0 end-$logkeep] {
|
||||||
|
puts " Deleting old log $i"
|
||||||
|
file tdelete "$logdir/$i"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
8
webif/lib/bin/reboot
Executable file
8
webif/lib/bin/reboot
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
/etc/init.d/S90settop shut
|
||||||
|
/mod/bin/sync
|
||||||
|
/sbin/reboot
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
34
webif/lib/lib.sh
Normal file
34
webif/lib/lib.sh
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
lbr_descr()
|
||||||
|
{
|
||||||
|
if [ -f /tmp/.lbr ]; then
|
||||||
|
case "`cat /tmp/.lbr`" in
|
||||||
|
1) echo "Front panel button" ;;
|
||||||
|
2) echo "Remote control handset" ;;
|
||||||
|
3) echo "Scheduled event" ;;
|
||||||
|
*) echo "Unknown `cat /tmp/.lbr`" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "Unknown"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
log_date()
|
||||||
|
{
|
||||||
|
date +'%d/%m/%Y %H:%M:%S'
|
||||||
|
}
|
||||||
|
|
||||||
|
log()
|
||||||
|
{
|
||||||
|
logf=$1; shift
|
||||||
|
echo "`log_date` - $*" >> /var/log/$logf.log
|
||||||
|
}
|
||||||
|
|
||||||
|
plog()
|
||||||
|
{
|
||||||
|
logf=$1; shift
|
||||||
|
echo "`log_date` - $*" >> /mod/tmp/$logf.log
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -33,6 +33,8 @@ class settings {
|
|||||||
autolog 0
|
autolog 0
|
||||||
changechangenc 0
|
changechangenc 0
|
||||||
audiomp3 0
|
audiomp3 0
|
||||||
|
logsize 1048576
|
||||||
|
logkeep 2
|
||||||
}
|
}
|
||||||
|
|
||||||
settings method hostname {{name ""}} {
|
settings method hostname {{name ""}} {
|
||||||
@@ -327,3 +329,19 @@ settings method smartdata {} {
|
|||||||
return $res
|
return $res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settings method logsize {{size -1}} {
|
||||||
|
set val [$self _nval_setting logsize $size]
|
||||||
|
if {$val == 0} {
|
||||||
|
return 1048576
|
||||||
|
}
|
||||||
|
return $val
|
||||||
|
}
|
||||||
|
|
||||||
|
settings method logkeep {{num -1}} {
|
||||||
|
set val [$self _nval_setting logkeep $num]
|
||||||
|
if {$val == 0} {
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
return $val
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,22 @@ proc {system modbuild} {} {{modbuild ""}} {
|
|||||||
return $modbuild
|
return $modbuild
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc {system lastbootreason} {{descr 1}} {{lbr -1}} {
|
||||||
|
if {$lbr == -1} {
|
||||||
|
set lbr 0
|
||||||
|
if {[file readable /tmp/.lbr]} {
|
||||||
|
set lbr [file read /tmp/.lbr]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if {!$descr} { return $lbr }
|
||||||
|
switch $lbr {
|
||||||
|
1 { return "Front panel button" }
|
||||||
|
2 { return "Remote control handset" }
|
||||||
|
3 { return "Scheduled event" }
|
||||||
|
}
|
||||||
|
return "Unknown ($lbr)"
|
||||||
|
}
|
||||||
|
|
||||||
proc {system fhtcpversion} {} {{ver ""}} {
|
proc {system fhtcpversion} {} {{ver ""}} {
|
||||||
if {$ver ne ""} { return $ver }
|
if {$ver ne ""} { return $ver }
|
||||||
set file "/etc/fhtcpversion"
|
set file "/etc/fhtcpversion"
|
||||||
@@ -268,8 +284,7 @@ proc {system dirinuse} {dir} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc {system reboot} {} {
|
proc {system reboot} {} {
|
||||||
exec /etc/init.d/S90settop shut
|
exec /mod/webif/lib/bin/reboot
|
||||||
exec /sbin/reboot
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proc {system restartpending} {{mode 1}} {
|
proc {system restartpending} {{mode 1}} {
|
||||||
@@ -351,14 +366,28 @@ proc {system is_listening} {mport} {
|
|||||||
return [llength [system listening $mport]]
|
return [llength [system listening $mport]]
|
||||||
}
|
}
|
||||||
|
|
||||||
proc {system notify} {msg} {
|
proc {system logtimestamp} {} {
|
||||||
set logfd [open "/mod/tmp/notify.log" "a+"]
|
return [clock format [clock seconds] -format "%d/%m/%Y %H:%M:%S"]
|
||||||
puts $logfd "[\
|
}
|
||||||
clock format [clock seconds] -format "%d/%m/%Y %H:%M"\
|
|
||||||
] - $msg"
|
proc {system _log} {log msg} {
|
||||||
|
set logfd [open $log "a+"]
|
||||||
|
puts $logfd "[system logtimestamp] - $msg"
|
||||||
$logfd close
|
$logfd close
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc {system log} {log msg} {
|
||||||
|
system _log "/var/log/$log.log" $msg
|
||||||
|
}
|
||||||
|
|
||||||
|
proc {system plog} {log msg} {
|
||||||
|
system _log "/mod/tmp/$log.log" $msg
|
||||||
|
}
|
||||||
|
|
||||||
|
proc {system notify} {msg} {
|
||||||
|
system plog notify $msg
|
||||||
|
}
|
||||||
|
|
||||||
proc {system display} {hdr hd} {
|
proc {system display} {hdr hd} {
|
||||||
if {[system model] eq "HDR"} {
|
if {[system model] eq "HDR"} {
|
||||||
exec /sbin/display $hdr
|
exec /sbin/display $hdr
|
||||||
|
|||||||
Reference in New Issue
Block a user