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
bcd89930
Commit
bcd89930
authored
May 15, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(firmware) add upgrade action
parent
ee863f0b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
+16
-5
FirmwareController.php
.../app/controllers/OPNsense/Core/Api/FirmwareController.php
+9
-2
firmware.volt
src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt
+4
-1
actions_firmware.conf
src/opnsense/service/conf/actions.d/actions_firmware.conf
+3
-2
No files found.
src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php
View file @
bcd89930
...
...
@@ -59,10 +59,12 @@ class FirmwareController extends ApiControllerBase
$response
[
"status_msg"
]
=
"no updates found"
;
}
elseif
(
array_key_exists
(
"updates"
,
$response
)
&&
$response
[
"upgrade_packages"
][
0
][
"name"
]
==
"pkg"
)
{
$response
[
"status"
]
=
"ok"
;
$response
[
"status_upgrade_action"
]
=
"pkg"
;
$response
[
"status_msg"
]
=
"There is a mandatory update for the package manager. "
.
"Please install and check for updates again."
;
}
elseif
(
array_key_exists
(
"updates"
,
$response
))
{
$response
[
"status"
]
=
"ok"
;
$response
[
"status_upgrade_action"
]
=
"all"
;
$response
[
"status_msg"
]
=
sprintf
(
"A total of %s update(s) are available."
,
$response
[
"updates"
]);
}
}
else
{
...
...
@@ -81,9 +83,14 @@ class FirmwareController extends ApiControllerBase
{
$backend
=
new
Backend
();
$response
=
array
();
if
(
$this
->
request
->
isPost
(
))
{
if
(
$this
->
request
->
hasPost
(
"upgrade"
))
{
$response
[
'status'
]
=
'ok'
;
$response
[
'uuid'
]
=
trim
(
$backend
->
configdRun
(
"firmware upgrade"
,
true
));
if
(
$this
->
request
->
getPost
(
"upgrade"
)
==
"pkg"
)
{
$action
=
"firmware upgrade pkg"
;
}
else
{
$action
=
"firmware upgrade all"
;
}
$response
[
'msg_uuid'
]
=
trim
(
$backend
->
configdRun
(
$action
,
true
));
}
else
{
$response
[
'status'
]
=
'failure'
;
}
...
...
src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt
View file @
bcd89930
...
...
@@ -48,6 +48,7 @@ POSSIBILITY OF SUCH DAMAGE.
$("#checkupdate_progress").removeClass("fa fa-spinner fa-pulse");
if (data['status'] == "ok") {
$.upgrade_action = data['status_upgrade_action'];
// unhide upgrade button
$("#upgrade").attr("style","");
// show upgrade list
...
...
@@ -80,7 +81,8 @@ POSSIBILITY OF SUCH DAMAGE.
$('#maintabs li:eq(1) a').tab('show');
$('#updatestatus').html("{{ lang._('Starting Upgrade.. Please do not leave this page while upgrade is in progress.') }}");
$("#upgrade_progress").addClass("fa fa-spinner fa-pulse");
ajaxCall('/api/core/firmware/upgrade',{},function() {
ajaxCall('/api/core/firmware/upgrade',{upgrade:$.upgrade_action},function() {
$("#upgrade_progress").removeClass("fa fa-spinner fa-pulse");
setTimeout(trackStatus, 1000) ;
});
...
...
@@ -106,6 +108,7 @@ POSSIBILITY OF SUCH DAMAGE.
type:BootstrapDialog.TYPE_INFO,
title: "{{ lang._('Upgrade') }}",
message: "{{ lang._('The upgrade is finished and your device is being rebooted at the moment, please wait.') }}",
closable: false,
buttons: [{
label: "{{ lang._('Close') }}",
cssClass: 'btn-success',
...
...
src/opnsense/service/conf/actions.d/actions_firmware.conf
View file @
bcd89930
...
...
@@ -6,9 +6,10 @@ message:retrieve package status
[
upgrade
]
command
: /
usr
/
sbin
/
daemon
-
f
/
usr
/
local
/
opnsense
/
scripts
/
pkg_upgrade
.
sh
parameters
:
parameters
:
%
s
type
:
script
message
:
perform
upgrade
message
:
perform
upgrade
%
s
[
upgrade_status
]
command
:
cat
/
tmp
/
pkg_upgrade
.
progress
2
>&
1
...
...
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