Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-system-updater
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximper-system-updater
Commits
197e62f4
Commit
197e62f4
authored
Mar 28, 2026
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add RebootRequired to UpdateCategory, use for reboot button logic
parent
7a754a31
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
23 deletions
+29
-23
update.go
model/update.go
+8
-7
update_service.go
service/update_service.go
+15
-11
actions.go
store/actions.go
+5
-3
window.go
ui/window.go
+1
-2
No files found.
model/update.go
View file @
197e62f4
package
model
package
model
type
UpdateCategory
struct
{
type
UpdateCategory
struct
{
Name
string
Name
string
Enabled
bool
// User can toggle this category
Enabled
bool
// User can toggle this category
Available
bool
// Has updates available
Available
bool
// Has updates available
Packages
[]
Package
RebootRequired
bool
DownloadSize
uint64
Packages
[]
Package
InstallSize
int64
DownloadSize
uint64
LastChecked
string
// RFC3339 timestamp
InstallSize
int64
LastChecked
string
// RFC3339 timestamp
}
}
type
KernelUpdateInfo
struct
{
type
KernelUpdateInfo
struct
{
...
...
service/update_service.go
View file @
197e62f4
...
@@ -148,7 +148,13 @@ func (us *UpdateService) RunUpdates(ctx context.Context) error {
...
@@ -148,7 +148,13 @@ func (us *UpdateService) RunUpdates(ctx context.Context) error {
startTime
:=
time
.
Now
()
startTime
:=
time
.
Now
()
packagesUpdated
:=
0
packagesUpdated
:=
0
var
categoryErrors
[]
string
var
categoryErrors
[]
string
systemOrKernelSucceeded
:=
false
rebootRequired
:=
false
categoryMap
:=
map
[
string
]
*
model
.
UpdateCategory
{
"System"
:
state
.
SystemUpdates
,
"Kernel"
:
state
.
KernelUpdates
,
"Play"
:
state
.
PlayUpdates
,
}
// Execute updates sequentially
// Execute updates sequentially
for
_
,
category
:=
range
categories
{
for
_
,
category
:=
range
categories
{
...
@@ -158,13 +164,11 @@ func (us *UpdateService) RunUpdates(ctx context.Context) error {
...
@@ -158,13 +164,11 @@ func (us *UpdateService) RunUpdates(ctx context.Context) error {
continue
continue
}
}
switch
category
{
if
cat
,
ok
:=
categoryMap
[
category
];
ok
{
case
"System"
:
packagesUpdated
+=
len
(
cat
.
Packages
)
packagesUpdated
+=
len
(
state
.
SystemUpdates
.
Packages
)
if
cat
.
RebootRequired
{
systemOrKernelSucceeded
=
true
rebootRequired
=
true
case
"Kernel"
:
}
packagesUpdated
+=
len
(
state
.
KernelUpdates
.
Packages
)
systemOrKernelSucceeded
=
true
}
}
}
}
...
@@ -174,9 +178,9 @@ func (us *UpdateService) RunUpdates(ctx context.Context) error {
...
@@ -174,9 +178,9 @@ func (us *UpdateService) RunUpdates(ctx context.Context) error {
// Finish update
// Finish update
success
:=
len
(
categoryErrors
)
==
0
success
:=
len
(
categoryErrors
)
==
0
us
.
store
.
Dispatch
(
&
store
.
FinishUpdateAction
{
us
.
store
.
Dispatch
(
&
store
.
FinishUpdateAction
{
Success
:
success
,
Success
:
success
,
Error
:
strings
.
Join
(
categoryErrors
,
"; "
),
Error
:
strings
.
Join
(
categoryErrors
,
"; "
),
SystemOrKernelSucceeded
:
systemOrKernelSucceed
ed
,
RebootRequired
:
rebootRequir
ed
,
})
})
// Record in history
// Record in history
...
...
store/actions.go
View file @
197e62f4
...
@@ -28,6 +28,7 @@ func (a *LoadSystemUpdatesAction) Apply(state *State) error {
...
@@ -28,6 +28,7 @@ func (a *LoadSystemUpdatesAction) Apply(state *State) error {
state
.
SystemUpdates
.
Packages
=
append
(
state
.
SystemUpdates
.
Packages
,
a
.
Changes
.
Install
...
)
state
.
SystemUpdates
.
Packages
=
append
(
state
.
SystemUpdates
.
Packages
,
a
.
Changes
.
Install
...
)
state
.
SystemUpdates
.
DownloadSize
=
a
.
Changes
.
DownloadSize
state
.
SystemUpdates
.
DownloadSize
=
a
.
Changes
.
DownloadSize
state
.
SystemUpdates
.
InstallSize
=
a
.
Changes
.
InstallSize
state
.
SystemUpdates
.
InstallSize
=
a
.
Changes
.
InstallSize
state
.
SystemUpdates
.
RebootRequired
=
true
state
.
SystemUpdates
.
LastChecked
=
time
.
Now
()
.
Format
(
time
.
RFC3339
)
state
.
SystemUpdates
.
LastChecked
=
time
.
Now
()
.
Format
(
time
.
RFC3339
)
return
nil
return
nil
}
}
...
@@ -42,6 +43,7 @@ func (a *LoadKernelUpdatesAction) Apply(state *State) error {
...
@@ -42,6 +43,7 @@ func (a *LoadKernelUpdatesAction) Apply(state *State) error {
state
.
KernelUpdates
.
Packages
=
append
(
state
.
KernelUpdates
.
Packages
,
a
.
Info
.
Packages
.
Install
...
)
state
.
KernelUpdates
.
Packages
=
append
(
state
.
KernelUpdates
.
Packages
,
a
.
Info
.
Packages
.
Install
...
)
state
.
KernelUpdates
.
DownloadSize
=
a
.
Info
.
Packages
.
DownloadSize
state
.
KernelUpdates
.
DownloadSize
=
a
.
Info
.
Packages
.
DownloadSize
state
.
KernelUpdates
.
InstallSize
=
a
.
Info
.
Packages
.
InstallSize
state
.
KernelUpdates
.
InstallSize
=
a
.
Info
.
Packages
.
InstallSize
state
.
KernelUpdates
.
RebootRequired
=
true
state
.
KernelUpdates
.
LastChecked
=
time
.
Now
()
.
Format
(
time
.
RFC3339
)
state
.
KernelUpdates
.
LastChecked
=
time
.
Now
()
.
Format
(
time
.
RFC3339
)
return
nil
return
nil
}
}
...
@@ -124,9 +126,9 @@ func (a *UpdateProgressAction) Apply(state *State) error {
...
@@ -124,9 +126,9 @@ func (a *UpdateProgressAction) Apply(state *State) error {
}
}
type
FinishUpdateAction
struct
{
type
FinishUpdateAction
struct
{
Success
bool
Success
bool
Error
string
Error
string
SystemOrKernelSucceed
ed
bool
RebootRequir
ed
bool
}
}
func
(
a
*
FinishUpdateAction
)
Apply
(
state
*
State
)
error
{
func
(
a
*
FinishUpdateAction
)
Apply
(
state
*
State
)
error
{
...
...
ui/window.go
View file @
197e62f4
...
@@ -136,8 +136,7 @@ func (w *Window) onStateChange(change store.StateChange) {
...
@@ -136,8 +136,7 @@ func (w *Window) onStateChange(change store.StateChange) {
case
store
.
ChangeUpdateFinish
:
case
store
.
ChangeUpdateFinish
:
action
,
ok
:=
change
.
Data
.
(
*
store
.
FinishUpdateAction
)
action
,
ok
:=
change
.
Data
.
(
*
store
.
FinishUpdateAction
)
if
ok
{
if
ok
{
showReboot
:=
action
.
Success
||
action
.
SystemOrKernelSucceeded
w
.
processPage
.
ShowComplete
(
action
.
Success
,
action
.
RebootRequired
)
w
.
processPage
.
ShowComplete
(
action
.
Success
,
showReboot
)
}
}
case
store
.
ChangeHistory
:
case
store
.
ChangeHistory
:
...
...
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