Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
packages
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Johannes Rudolph
packages
Commits
9b539845
Commit
9b539845
authored
9 years ago
by
Jan-Tarek Butt
Browse files
Options
Downloads
Patches
Plain Diff
sed pid file if autoupdater still on running
parent
0c4ebd36
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
autoupdater-mod/files/lib/ffnw/autoupdater-mod/autoupdater
+20
-1
20 additions, 1 deletion
autoupdater-mod/files/lib/ffnw/autoupdater-mod/autoupdater
with
20 additions
and
1 deletion
autoupdater-mod/files/lib/ffnw/autoupdater-mod/autoupdater
+
20
−
1
View file @
9b539845
#!/usr/bin/lua
local
fs
=
require
(
'luci.fs'
)
local
nixio
=
require
(
'nixio'
)
local
platform_info
=
require
(
'platform_info'
)
...
...
@@ -9,10 +8,26 @@ local util = require('luci.util')
local
autoupdater_util
=
require
(
'autoupdater.util'
)
local
autoupdater_version
=
require
(
'autoupdater.version'
)
local
pidPath
=
"/var/run/autoupdater.pid"
if
io.open
(
pidPath
,
"r"
)
~=
nil
then
io.stderr
:
write
(
"The autoupdater is still running.\n"
)
os.exit
(
1
)
else
local
pidf
=
io.open
(
pidPath
,
"w"
)
io.close
(
pidf
)
end
function
pid_clean
()
if
io.open
(
pidPath
,
"r"
)
~=
nil
then
os.remove
(
pidPath
)
end
return
0
end
if
not
platform_info
.
get_image_name
()
then
io.stderr
:
write
(
"The autoupdater doesn't support this hardware model.\n"
)
pid_clean
()
os.exit
(
1
)
end
...
...
@@ -47,6 +62,7 @@ end
if
settings
.
enabled
~=
'1'
and
not
force
then
io.stderr
:
write
(
'autoupdater is disabled.\n'
)
pid_clean
()
os.exit
(
0
)
end
...
...
@@ -262,6 +278,7 @@ local function autoupdate(mirror)
-- We output the error message through stdout as stderr isn't available anymore
io.write
(
'Failed to call sysupgrade?\n'
)
os.remove
(
image
)
pid_clean
()
os.exit
(
1
)
end
...
...
@@ -271,9 +288,11 @@ local mirrors = branch.mirror
while
#
mirrors
>
0
do
local
mirror
=
table.remove
(
mirrors
,
math.random
(
#
mirrors
))
if
autoupdate
(
mirror
)
then
pid_clean
()
os.exit
(
0
)
end
end
io.stderr
:
write
(
'No usable mirror found.\n'
)
pid_clean
()
os.exit
(
1
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment