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
fd6c5101
Commit
fd6c5101
authored
May 19, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(firmware) add check for reboot to check update script
parent
b7f53fc2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
pkg_updatecheck.sh
src/opnsense/scripts/pkg_updatecheck.sh
+6
-2
No files found.
src/opnsense/scripts/pkg_updatecheck.sh
View file @
fd6c5101
...
@@ -45,6 +45,7 @@
...
@@ -45,6 +45,7 @@
# Variables used
# Variables used
connection
=
"error"
connection
=
"error"
repository
=
"error"
repository
=
"error"
upgrade_needs_reboot
=
"0"
updates
=
""
updates
=
""
core_version
=
""
core_version
=
""
pkg_running
=
""
pkg_running
=
""
...
@@ -82,7 +83,7 @@ if [ "$pkg_running" == "" ]; then
...
@@ -82,7 +83,7 @@ if [ "$pkg_running" == "" ]; then
pkg_running
=
`
ps
-x
|
grep
"pkg "
|
grep
-v
"grep"
`
pkg_running
=
`
ps
-x
|
grep
"pkg "
|
grep
-v
"grep"
`
timer
=
`
echo
$timer
- 1 | bc
`
timer
=
`
echo
$timer
- 1 | bc
`
done
done
## check if timeout is not reached
## check if timeout is not reached
if
[
$timer
-gt
0
]
;
then
if
[
$timer
-gt
0
]
;
then
# Connection is ok
# Connection is ok
...
@@ -122,6 +123,9 @@ if [ "$pkg_running" == "" ]; then
...
@@ -122,6 +123,9 @@ if [ "$pkg_running" == "" ]; then
if
[
"
$download_size
"
==
""
]
;
then
if
[
"
$download_size
"
==
""
]
;
then
download_size
=
"none"
download_size
=
"none"
fi
fi
upgrade_needs_reboot
=
`
pkg upgrade
-nq
os-update |
grep
UPGRADED |
wc
-l
|
awk
'{print $1;}'
`
# First check if there are new packages that need to be installed
# First check if there are new packages that need to be installed
for
i
in
$(
cat
$tmp_pkg_output_file
)
;
do
for
i
in
$(
cat
$tmp_pkg_output_file
)
;
do
if
[
"
$itemcount
"
-gt
"
$linecount
"
]
;
then
if
[
"
$itemcount
"
-gt
"
$linecount
"
]
;
then
...
@@ -229,7 +233,7 @@ if [ "$pkg_running" == "" ]; then
...
@@ -229,7 +233,7 @@ if [ "$pkg_running" == "" ]; then
# Get date/timestamp
# Get date/timestamp
last_check
=
`
date
`
last_check
=
`
date
`
# Write our json structure to disk
# Write our json structure to disk
echo
"{
\"
connection
\"
:
\"
$connection
\"
,
\"
repository
\"
:
\"
$repository
\"
,
\"
last_check
\"
:
\"
$last_check
\"
,
\"
updates
\"
:
\"
$updates
\"
,
\"
core_version
\"
:
\"
$core_version
\"
,
\"
download_size
\"
:
\"
$download_size
\"
,
\"
extra_space_required
\"
:
\"
$required_space
\"
,
\"
new_packages
\"
:[
$packages_new
],
\"
reinstall_packages
\"
:[
$packages_reinstall
],
\"
upgrade_packages
\"
:[
$packages_upgraded
]}"
>
$package_json_output
echo
"{
\"
connection
\"
:
\"
$connection
\"
,
\"
repository
\"
:
\"
$repository
\"
,
\"
last_check
\"
:
\"
$last_check
\"
,
\"
updates
\"
:
\"
$updates
\"
,
\"
core_version
\"
:
\"
$core_version
\"
,
\"
download_size
\"
:
\"
$download_size
\"
,
\"
extra_space_required
\"
:
\"
$required_space
\"
,
\"
new_packages
\"
:[
$packages_new
],
\"
reinstall_packages
\"
:[
$packages_reinstall
],
\"
upgrade_packages
\"
:[
$packages_upgraded
]
,
\"
upgrade_needs_reboot
\"
:
\"
$upgrade_needs_reboot
\"
}"
>
$package_json_output
else
else
# pkg is already running, quitting
# pkg is already running, quitting
fi
fi
...
...
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