Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
5a3a3a84
Commit
5a3a3a84
authored
Jun 01, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firmware: add running API action and reattach if possible; closes #646
parent
2e10248c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
10 deletions
+71
-10
FirmwareController.php
.../app/controllers/OPNsense/Core/Api/FirmwareController.php
+13
-0
firmware.volt
src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt
+15
-9
running.sh
src/opnsense/scripts/firmware/running.sh
+36
-0
actions_firmware.conf
src/opnsense/service/conf/actions.d/actions_firmware.conf
+7
-1
No files found.
src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php
View file @
5a3a3a84
...
...
@@ -316,6 +316,19 @@ class FirmwareController extends ApiControllerBase
return
$response
;
}
/**
* retrieve exectution status
*/
public
function
runningAction
()
{
$backend
=
new
Backend
();
$result
=
array
(
'status'
=>
trim
(
$backend
->
configdRun
(
'firmware running'
))
);
return
$result
;
}
/**
* retrieve upgrade status (and log file of current process)
*/
...
...
src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt
View file @
5a3a3a84
...
...
@@ -85,7 +85,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
function upgrade(){
$('#progresstab > a').tab('show');
$('#updatestatus').html("{{ lang._('Upgrading... (do not leave this page while upgrade is in progress)') }}");
$('#updatestatus').html("{{ lang._('Upgrading...') }}");
$("#upgrade").attr("style","");
$("#upgrade_progress").addClass("fa fa-spinner fa-pulse");
ajaxCall('/api/core/firmware/upgrade',{upgrade:$.upgrade_action},function() {
...
...
@@ -102,7 +103,7 @@ POSSIBILITY OF SUCH DAMAGE.
function action(pkg_act, pkg_name)
{
$('#progresstab > a').tab('show');
$('#updatestatus').html("{{ lang._('Executing...
(do not leave this page while execute is in progress)
') }}");
$('#updatestatus').html("{{ lang._('Executing...') }}");
ajaxCall('/api/core/firmware/'+pkg_act+'/'+pkg_name,{},function() {
$('#updatelist').empty();
...
...
@@ -136,7 +137,6 @@ POSSIBILITY OF SUCH DAMAGE.
}]
});
} else {
upgrade();
}
...
...
@@ -178,7 +178,7 @@ POSSIBILITY OF SUCH DAMAGE.
"{{ lang._('The upgrade has finished and your device is being rebooted at the moment, please wait...') }}" +
' <i class="fa fa-cog fa-spin"></i>'
);
setTimeout(rebootWait,
30
000);
setTimeout(rebootWait,
45
000);
},
});
} else {
...
...
@@ -292,14 +292,20 @@ POSSIBILITY OF SUCH DAMAGE.
if ($('#message').html() != '') {
$('#message').attr('style', '');
}
// repopulate package information
packagesInfo();
// dashboard link: run check automatically
if (window.location.hash == '#checkupdate') {
updateStatus();
}
});
ajaxGet('/api/core/firmware/running',{},function(data, status) {
// if action is already running reattach now...
if (data['status'] == 'busy') {
upgrade();
// dashboard link: run check automatically
} else if (window.location.hash == '#checkupdate') {
updateStatus();
}
});
});
</script>
<div class="container-fluid">
...
...
src/opnsense/scripts/firmware/running.sh
0 → 100755
View file @
5a3a3a84
#!/bin/sh
# Copyright (C) 2016 Franco Fichtner <franco@opnsense.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
LOCKFILE
=
"/tmp/pkg_upgrade.progress"
FLOCK
=
"/usr/local/bin/flock -n"
(
if
${
FLOCK
}
9
;
then
echo
"ready"
else
echo
"busy"
fi
)
9<
${
LOCKFILE
}
src/opnsense/service/conf/actions.d/actions_firmware.conf
View file @
5a3a3a84
...
...
@@ -2,7 +2,13 @@
command
:/
usr
/
local
/
opnsense
/
scripts
/
firmware
/
check
.
sh
parameters
:
type
:
script_output
message
:
retrieve
package
status
message
:
retrieve
firmware
update
status
[
running
]
command
:/
usr
/
local
/
opnsense
/
scripts
/
firmware
/
running
.
sh
parameters
:
type
:
script_output
message
:
retrieve
firmware
execution
status
[
upgrade
]
command
: /
usr
/
sbin
/
daemon
-
f
/
usr
/
local
/
opnsense
/
scripts
/
firmware
/
launcher
.
sh
upgrade
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment