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
76eaa335
Commit
76eaa335
authored
Jun 10, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: roll back these changes into a simple test tool
parent
5d400ba7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
107 deletions
+57
-107
switch_repo.php
scripts/switch_repo.php
+57
-0
pfsense-utils.inc
src/etc/inc/pfsense-utils.inc
+0
-35
system.inc
src/etc/inc/system.inc
+0
-38
system_general.php
src/www/system_general.php
+0
-34
No files found.
scripts/switch_repo.php
0 → 100755
View file @
76eaa335
#!/usr/local/bin/php
<?php
/*
Copyright (C) 2015 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.
*/
$pkg_mirror
=
'http://pkg.opnsense.org'
;
$pkg_flavour
=
'latest'
;
if
(
isset
(
$argv
[
1
]))
{
$pkg_flavour
=
$argv
[
1
];
}
if
(
isset
(
$argv
[
2
]))
{
$pkg_flavour
=
$argv
[
2
];
}
$pkg_sample
=
file_get_contents
(
'/usr/local/etc/pkg/repos/OPNsense.conf.sample'
);
$pkg_sample
=
explode
(
PHP_EOL
,
$pkg_sample
);
$pkg_config
=
''
;
foreach
(
$pkg_sample
as
$pkg_line
)
{
if
(
!
strlen
(
$pkg_line
))
{
continue
;
}
elseif
(
!
strncasecmp
(
$pkg_line
,
' url:'
,
6
))
{
$pkg_line
=
sprintf
(
' url: "pkg+%s/${ABI}/%s",'
,
$pkg_mirror
,
$pkg_flavour
);
}
$pkg_config
.=
$pkg_line
.
PHP_EOL
;
}
file_put_contents
(
'/usr/local/etc/pkg/repos/OPNsense.conf'
,
$pkg_config
);
src/etc/inc/pfsense-utils.inc
View file @
76eaa335
...
@@ -531,41 +531,6 @@ function rmdir_recursive($path,$follow_links=false) {
...
@@ -531,41 +531,6 @@ function rmdir_recursive($path,$follow_links=false) {
return
;
return
;
}
}
/*
* check_firmware_version(): Check whether the current firmware installed is the most recently released.
*/
function
check_firmware_version
(
$tocheck
=
"all"
,
$return_php
=
true
)
{
global
$config
;
$xmlrpcfqdn
=
preg_replace
(
'(https?://)'
,
''
,
'/xmlrpc.php'
);
$ip
=
gethostbyname
(
$xmlrpcfqdn
);
if
(
$ip
==
$xmlrpcfqdn
)
return
false
;
$version
=
php_uname
(
'r'
);
$version
=
explode
(
'-'
,
$version
);
$rawparams
=
array
(
"firmware"
=>
array
(
"version"
=>
trim
(
file_get_contents
(
'/usr/local/opnsense/version/opnsense'
))),
"kernel"
=>
array
(
"version"
=>
$version
[
0
]),
"base"
=>
array
(
"version"
=>
$version
[
0
]),
"config_version"
=>
$config
[
'version'
]
);
unset
(
$version
);
if
(
$tocheck
==
"all"
)
{
$params
=
$rawparams
;
}
else
{
foreach
(
$tocheck
as
$check
)
{
$params
[
'check'
]
=
$rawparams
[
'check'
];
}
}
if
(
$config
[
'system'
][
'firmware'
][
'branch'
])
$params
[
'branch'
]
=
$config
[
'system'
][
'firmware'
][
'branch'
];
$versions
[
"current"
]
=
$params
;
return
$versions
;
}
/*
/*
* host_firmware_version(): Return the versions used in this install
* host_firmware_version(): Return the versions used in this install
*/
*/
...
...
src/etc/inc/system.inc
View file @
76eaa335
...
@@ -790,44 +790,6 @@ EOD;
...
@@ -790,44 +790,6 @@ EOD;
return
$retval
;
return
$retval
;
}
}
function
system_firmware_configure
()
{
global
$config
;
$pkg_mirror
=
'http://pkg.opnsense.org'
;
$pkg_flavour
=
'latest'
;
if
(
!
file_exists
(
'/usr/local/etc/pkg/repos/OPNsense.conf.sample'
))
{
return
;
}
if
(
isset
(
$config
[
'system'
][
'firmware'
][
'flavour'
]))
{
$pkg_flavour
=
$config
[
'system'
][
'firmware'
][
'flavour'
];
}
if
(
isset
(
$config
[
'system'
][
'firmware'
][
'mirror'
]))
{
$pkg_mirror
=
$config
[
'system'
][
'firmware'
][
'mirror'
];
}
$pkg_sample
=
file_get_contents
(
'/usr/local/etc/pkg/repos/OPNsense.conf.sample'
);
$pkg_sample
=
explode
(
PHP_EOL
,
$pkg_sample
);
$pkg_config
=
''
;
foreach
(
$pkg_sample
as
$pkg_line
)
{
if
(
!
strlen
(
$pkg_line
))
{
continue
;
}
elseif
(
!
strncasecmp
(
$pkg_line
,
' url:'
,
6
))
{
$pkg_line
=
sprintf
(
' url: "pkg+%s/${ABI}/%s",'
,
$pkg_mirror
,
$pkg_flavour
);
}
$pkg_config
.=
$pkg_line
.
PHP_EOL
;
}
file_put_contents
(
'/usr/local/etc/pkg/repos/OPNsense.conf'
,
$pkg_config
);
}
function
system_webgui_start
()
function
system_webgui_start
()
{
{
global
$config
;
global
$config
;
...
...
src/www/system_general.php
View file @
76eaa335
...
@@ -72,9 +72,6 @@ $pconfig['timeupdateinterval'] = $config['system']['time-update-interval'];
...
@@ -72,9 +72,6 @@ $pconfig['timeupdateinterval'] = $config['system']['time-update-interval'];
$pconfig
[
'timeservers'
]
=
$config
[
'system'
][
'timeservers'
];
$pconfig
[
'timeservers'
]
=
$config
[
'system'
][
'timeservers'
];
$pconfig
[
'theme'
]
=
$config
[
'system'
][
'theme'
];
$pconfig
[
'theme'
]
=
$config
[
'system'
][
'theme'
];
$pconfig
[
'language'
]
=
$config
[
'system'
][
'language'
];
$pconfig
[
'language'
]
=
$config
[
'system'
][
'language'
];
if
(
isset
(
$config
[
'system'
][
'firmware'
][
'flavour'
]))
{
$pconfig
[
'firmware_flavour'
]
=
$config
[
'system'
][
'firmware'
][
'flavour'
];
}
$pconfig
[
'dnslocalhost'
]
=
isset
(
$config
[
'system'
][
'dnslocalhost'
]);
$pconfig
[
'dnslocalhost'
]
=
isset
(
$config
[
'system'
][
'dnslocalhost'
]);
...
@@ -191,18 +188,6 @@ if ($_POST) {
...
@@ -191,18 +188,6 @@ if ($_POST) {
set_language
(
$config
[
'system'
][
'language'
]);
set_language
(
$config
[
'system'
][
'language'
]);
}
}
if
(
!
isset
(
$config
[
'system'
][
'firmware'
]))
{
$config
[
'system'
][
'firmware'
]
=
array
();
}
if
(
$_POST
[
'firmware_flavour'
])
{
$config
[
'system'
][
'firmware'
][
'flavour'
]
=
$_POST
[
'firmware_flavour'
];
}
else
{
if
(
isset
(
$config
[
'system'
][
'firmware'
][
'flavour'
]))
{
unset
(
$config
[
'system'
][
'firmware'
][
'flavour'
]);
}
}
system_firmware_configure
();
update_if_changed
(
"System Theme"
,
$config
[
'theme'
],
$_POST
[
'theme'
]);
update_if_changed
(
"System Theme"
,
$config
[
'theme'
],
$_POST
[
'theme'
]);
/* XXX - billm: these still need updating after figuring out how to check if they actually changed */
/* XXX - billm: these still need updating after figuring out how to check if they actually changed */
...
@@ -484,25 +469,6 @@ include("head.inc");
...
@@ -484,25 +469,6 @@ include("head.inc");
</span>
</span>
</td>
</td>
</tr>
</tr>
<tr>
<td
width=
"22%"
valign=
"top"
class=
"vncell"
>
<?=
gettext
(
"Cryptography"
);
?>
</td>
<td
width=
"78%"
class=
"vtable"
>
<select
name=
"firmware_flavour"
class=
"selectpicker"
data-style=
"btn-default"
data-width=
"auto"
>
<?php
foreach
(
get_flavour_list
()
as
$fcode
=>
$fdesc
)
{
$selected
=
' selected="selected"'
;
if
(
$fcode
!=
$pconfig
[
'firmware_flavour'
])
{
$selected
=
''
;
}
echo
"<option value=
\"
{
$fcode
}
\"
{
$selected
}
>
{
$fdesc
}
</option>"
;
}
?>
</select>
<strong>
<?=
gettext
(
"Choose the cryptography library to be used by the system."
);
?>
</strong>
</td>
</tr>
<tr>
<tr>
<td
width=
"22%"
valign=
"top"
class=
"vncell"
>
<?=
gettext
(
"Language"
);
?>
</td>
<td
width=
"22%"
valign=
"top"
class=
"vncell"
>
<?=
gettext
(
"Language"
);
?>
</td>
<td
width=
"78%"
class=
"vtable"
>
<td
width=
"78%"
class=
"vtable"
>
...
...
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