1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-06 21:48:30 -04:00

feat(dms updater): add support for ignoring specific packages during system updates

- Added UI component & popout settings to manage ignored packages
- Added CLI support available in danklinux docs

Fixes: #2827
Closes: #2344, #1741
Port 1.5

(cherry picked from commit e4657aa5f9)
This commit is contained in:
purian23
2026-07-13 12:02:13 -04:00
committed by dms-ci[bot]
parent dd9edd8a00
commit e9d958b32b
19 changed files with 674 additions and 40 deletions
@@ -4,7 +4,9 @@ import (
"context"
"encoding/xml"
"errors"
"fmt"
"os/exec"
"strings"
)
func init() {
@@ -81,5 +83,20 @@ func (zypperBackend) Upgrade(ctx context.Context, opts UpgradeOptions, onLine fu
}
func zypperUpgradeArgv(opts UpgradeOptions) []string {
return privilegedArgv(opts, "zypper", "--non-interactive", "update")
ignored := shellSafeNames(opts.Ignored)
if len(ignored) == 0 {
return privilegedArgv(opts, "zypper", "--non-interactive", "update")
}
return privilegedArgv(opts, "sh", "-c", zypperLockScript(ignored))
}
// zypperLockScript locks ignored packages only for the update, leaving pre-existing user locks untouched.
func zypperLockScript(ignored []string) string {
names := strings.Join(ignored, " ")
return fmt.Sprintf(
`new=""; for p in %s; do grep -qsE "^solvable_name:[[:space:]]*$p$" /etc/zypp/locks || new="$new $p"; done; `+
`[ -n "$new" ] && zypper --non-interactive al $new; `+
`zypper --non-interactive update; rc=$?; `+
`[ -n "$new" ] && zypper --non-interactive rl $new; exit $rc`,
names)
}