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
61fc13b3
Commit
61fc13b3
authored
Nov 11, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firmware: add changelogs tab, pull in index through info action #341
parent
dd50e688
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
25 deletions
+105
-25
FirmwareController.php
.../app/controllers/OPNsense/Core/Api/FirmwareController.php
+8
-0
firmware.volt
src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt
+31
-9
changelog.sh
src/opnsense/scripts/firmware/changelog.sh
+47
-15
check.sh
src/opnsense/scripts/firmware/check.sh
+1
-1
actions_firmware.conf
src/opnsense/service/conf/actions.d/actions_firmware.conf
+18
-0
No files found.
src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php
View file @
61fc13b3
...
...
@@ -379,6 +379,14 @@ class FirmwareController extends ApiControllerBase
}
}
/* also pull in changelogs from here */
$changelogs
=
json_decode
(
trim
(
$backend
->
configdRun
(
'firmware changelog list'
)),
true
);
if
(
$changelogs
==
null
)
{
$changelogs
=
array
();
}
$response
[
'changelog'
]
=
$changelogs
;
return
$response
;
}
...
...
src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt
View file @
61fc13b3
...
...
@@ -198,6 +198,7 @@ POSSIBILITY OF SUCH DAMAGE.
ajaxGet('/api/core/firmware/info', {}, function (data, status) {
$('#packageslist').empty();
$('#pluginlist').empty();
$('#changeloglist').empty();
var installed = {};
$("#packageslist").html("<tr><th>{{ lang._('Name') }}</th>" +
...
...
@@ -206,6 +207,8 @@ POSSIBILITY OF SUCH DAMAGE.
$("#pluginlist").html("<tr><th>{{ lang._('Name') }}</th>" +
"<th>{{ lang._('Version') }}</th><th>{{ lang._('Size') }}</th>" +
"<th>{{ lang._('Comment') }}</th><th></th></tr>");
$("#changeloglist").html("<tr><th>{{ lang._('Version') }}</th>" +
"<th>{{ lang._('Date') }}</th><th></th></tr>");
$.each(data['local'], function(index, row) {
$('#packageslist').append(
...
...
@@ -233,6 +236,12 @@ POSSIBILITY OF SUCH DAMAGE.
installed[row['name']] = row;
});
if (!data['local'].length) {
$('#packageslist').append(
'<tr><td colspan=5>{{ lang._('No packages were found on your system. Please call for help.') }}</td></tr>'
);
}
$.each(data['remote'], function(index, row) {
if (!row['name'].match(/^os-/g)) {
return 1;
...
...
@@ -261,6 +270,20 @@ POSSIBILITY OF SUCH DAMAGE.
);
}
$.each(data['changelog'], function(index, row) {
$('#changeloglist').append(
'<tr><td>' + row['version'] + '</td>' +
'<td>' + row['date'] + '</td>' +
'<td>not yet</td></tr>'
);
});
if (!data['changelog'].length) {
$('#changeloglist').append(
'<tr><td colspan=3>{{ lang._('Check for updates to view changelog history.') }}</td></tr>'
);
}
// link buttons to actions
$(".act_reinstall").click(function(event) {
event.preventDefault();
...
...
@@ -402,8 +425,6 @@ POSSIBILITY OF SUCH DAMAGE.
$("#change_mirror_progress").removeClass("fa fa-spinner fa-pulse");
});
});
});
</script>
...
...
@@ -422,6 +443,7 @@ POSSIBILITY OF SUCH DAMAGE.
<li id="settingstab" class="active"><a data-toggle="tab" href="#settings">{{ lang._('Settings') }}</a></li>
<li id="packagestab"><a data-toggle="tab" href="#packages">{{ lang._('Packages') }}</a></li>
<li id="plugintab"><a data-toggle="tab" href="#plugins">{{ lang._('Plugins') }}</a></li>
<li id="changelogtab"><a data-toggle="tab" href="#changelogs">{{ lang._('Changelogs') }}</a></li>
<li id="updatetab"><a data-toggle="tab" href="#updates">{{ lang._('Updates') }}</a></li>
<li id="progresstab"><a data-toggle="tab" href="#progress">{{ lang._('Progress') }}</a></li>
</ul>
...
...
@@ -476,7 +498,7 @@ POSSIBILITY OF SUCH DAMAGE.
<tr>
<td></td>
<td>
<button class="btn btn-primary"
id="change_mirror" type="button"><b>{{ lang._('Save') }}</b><i id="change_mirror_progress" class=""></i></button>
<button class="btn btn-primary" id="change_mirror" type="button"><b>{{ lang._('Save') }}</b><i id="change_mirror_progress" class=""></i></button>
</td>
<td></td>
</tr>
...
...
@@ -489,16 +511,16 @@ POSSIBILITY OF SUCH DAMAGE.
</table>
</div>
<div id="packages" class="tab-pane fade in">
<table class="table table-striped table-condensed table-responsive" id="packageslist">
</table>
<table class="table table-striped table-condensed table-responsive" id="packageslist"></table>
</div>
<div id="plugins" class="tab-pane fade in">
<table class="table table-striped table-condensed table-responsive" id="pluginlist">
</table>
<table class="table table-striped table-condensed table-responsive" id="pluginlist"></table>
</div>
<div id="changelogs" class="tab-pane fade in">
<table class="table table-striped table-condensed table-responsive" id="changeloglist"></table>
</div>
<div id="updates" class="tab-pane fade in">
<table class="table table-striped table-condensed table-responsive" id="updatelist">
</table>
<table class="table table-striped table-condensed table-responsive" id="updatelist"></table>
</div>
<div id="progress" class="tab-pane fade in">
<textarea name="output" id="update_status" class="form-control" rows="20" wrap="hard" readonly style="max-width:100%; font-family: monospace;"></textarea>
...
...
src/opnsense/scripts/firmware/changelog.sh
View file @
61fc13b3
...
...
@@ -27,25 +27,57 @@
set
-e
CORE_ABI
=
$(
cat
/usr/local/opnsense/version/opnsense.abi 2> /dev/null
)
SYS_ABI
=
$(
opnsense-verify
-a
2> /dev/null
)
URL
=
"https://pkg.opnsense.org"
URL
=
"
${
URL
}
/
${
SYS_ABI
}
/
${
CORE_ABI
}
"
URL
=
"
${
URL
}
/sets/changelog.txz"
DESTDIR
=
"/usr/local/opnsense/changelog"
WORKDIR
=
"/tmp/changelog"
FETCH
=
"fetch -aqT 5"
rm
-rf
${
WORKDIR
}
mkdir
-p
${
WORKDIR
}
changelog_remove
()
{
rm
-rf
${
DESTDIR
}
mkdir
-p
${
DESTDIR
}
}
changelog_fetch
()
{
CORE_ABI
=
$(
cat
/usr/local/opnsense/version/opnsense.abi 2> /dev/null
)
SYS_ABI
=
$(
opnsense-verify
-a
2> /dev/null
)
URL
=
"https://pkg.opnsense.org"
URL
=
"
${
URL
}
/
${
SYS_ABI
}
/
${
CORE_ABI
}
"
URL
=
"
${
URL
}
/sets/changelog.txz"
rm
-rf
${
WORKDIR
}
mkdir
-p
${
WORKDIR
}
${
FETCH
}
-o
${
WORKDIR
}
/changelog.txz.sig
"
${
URL
}
.sig"
${
FETCH
}
-o
${
WORKDIR
}
/changelog.txz
"
${
URL
}
"
opnsense-verify
-q
${
WORKDIR
}
/changelog.txz
changelog_remove
tar
-C
${
DESTDIR
}
-xJf
${
WORKDIR
}
/changelog.txz
}
changelog_show
()
{
FILE
=
"
${
DESTDIR
}
/
${
1
}
"
${
FETCH
}
-o
${
WORKDIR
}
/changelog.txz.sig
"
${
URL
}
.sig"
${
FETCH
}
-o
${
WORKDIR
}
/changelog.txz
"
${
URL
}
"
opnsense-verify
-q
${
WORKDIR
}
/changelog.txz
if
[
-f
"
${
FILE
}
"
]
;
then
cat
"
${
FILE
}
"
fi
}
rm
-rf
${
DESTDIR
}
mkdir
-p
${
DESTDIR
}
COMMAND
=
${
1
}
VERSION
=
${
2
}
tar
-C
${
DESTDIR
}
-xJf
${
WORKDIR
}
/changelog.txz
if
[
"
${
COMMAND
}
"
=
"fetch"
]
;
then
changelog_fetch
elif
[
"
${
COMMAND
}
"
=
"remove"
]
;
then
changelog_remove
elif
[
"
${
COMMAND
}
"
=
"list"
]
;
then
changelog_show index.json
elif
[
"
${
COMMAND
}
"
=
"html"
-a
-n
"
${
VERSION
}
"
]
;
then
changelog_show
"
$(
basename
${
VERSION
}
)
.htm"
elif
[
"
${
COMMAND
}
"
=
"text"
-a
-n
"
${
VERSION
}
"
]
;
then
changelog_show
"
$(
basename
${
VERSION
}
)
.txt"
fi
src/opnsense/scripts/firmware/check.sh
View file @
61fc13b3
...
...
@@ -63,7 +63,7 @@ tmp_pkg_update_file="/tmp/pkg_updates.output"
pkg_running
=
`
ps
-x
|
grep
"pkg "
|
grep
-v
"grep"
`
if
[
"
$pkg_running
"
==
""
]
;
then
# load changelogs first
/usr/local/opnsense/scripts/firmware/changelog.sh
/usr/local/opnsense/scripts/firmware/changelog.sh
fetch
# start pkg update
pkg update
-f
>
$tmp_pkg_update_file
&
pkg_running
=
"started"
# Set running state to arbitrary value
...
...
src/opnsense/service/conf/actions.d/actions_firmware.conf
View file @
61fc13b3
...
...
@@ -4,6 +4,24 @@ parameters:
type
:
script_output
message
:
retrieve
firmware
update
status
[
changelog
.
list
]
command
: /
usr
/
local
/
opnsense
/
scripts
/
firmware
/
changelog
.
sh
list
parameters
:
type
:
script_output
message
:
Retrieving
changelog
index
[
changelog
.
html
]
command
: /
usr
/
local
/
opnsense
/
scripts
/
firmware
/
changelog
.
sh
html
parameters
:%
s
type
:
script_output
message
:
Viewing
changelog
for
version
%
s
[
changelog
.
text
]
command
: /
usr
/
local
/
opnsense
/
scripts
/
firmware
/
changelog
.
sh
text
parameters
:%
s
type
:
script_output
message
:
Viewing
changelog
for
version
%
s
[
running
]
command
:/
usr
/
local
/
opnsense
/
scripts
/
firmware
/
running
.
sh
parameters
:
...
...
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