From ef9d28597b06588b7c16d277e0c3e5d13e944b98 Mon Sep 17 00:00:00 2001 From: bbedward Date: Mon, 8 Dec 2025 23:03:46 -0500 Subject: [PATCH] dankinstall: don't fail suse if addrepo fails --- core/internal/distros/opensuse.go | 2 +- quickshell/CODENAME | 1 + quickshell/Modules/Settings/AboutTab.qml | 11 +- quickshell/Services/SystemUpdateService.qml | 159 ++++++++++---------- 4 files changed, 95 insertions(+), 78 deletions(-) create mode 100644 quickshell/CODENAME diff --git a/core/internal/distros/opensuse.go b/core/internal/distros/opensuse.go index be00f9b9..9e5dc55c 100644 --- a/core/internal/distros/opensuse.go +++ b/core/internal/distros/opensuse.go @@ -476,7 +476,7 @@ func (o *OpenSUSEDistribution) enableOBSRepos(ctx context.Context, obsPkgs []Pac cmd := ExecSudoCommand(ctx, sudoPassword, fmt.Sprintf("zypper addrepo -f %s", repoURL)) if err := o.runWithProgress(cmd, progressChan, PhaseSystemPackages, 0.20, 0.22); err != nil { - return fmt.Errorf("failed to enable OBS repo %s: %w", pkg.RepoURL, err) + o.log(fmt.Sprintf("OBS repo %s add failed (may already exist): %v", pkg.RepoURL, err)) } enabledRepos[pkg.RepoURL] = true diff --git a/quickshell/CODENAME b/quickshell/CODENAME new file mode 100644 index 00000000..9a9f276d --- /dev/null +++ b/quickshell/CODENAME @@ -0,0 +1 @@ +The Dark Knight diff --git a/quickshell/Modules/Settings/AboutTab.qml b/quickshell/Modules/Settings/AboutTab.qml index 40df5c30..0f560714 100644 --- a/quickshell/Modules/Settings/AboutTab.qml +++ b/quickshell/Modules/Settings/AboutTab.qml @@ -3,7 +3,6 @@ import QtQuick.Effects import qs.Common import qs.Services import qs.Widgets -import qs.Modules.Settings.Widgets Item { id: aboutTab @@ -200,6 +199,16 @@ Item { width: parent.width } + StyledText { + visible: SystemUpdateService.shellCodename.length > 0 + text: `"${SystemUpdateService.shellCodename}"` + font.pixelSize: Theme.fontSizeMedium + font.italic: true + color: Theme.surfaceVariantText + horizontalAlignment: Text.AlignHCenter + width: parent.width + } + Row { id: resourceButtonsRow anchors.horizontalCenter: parent.horizontalCenter diff --git a/quickshell/Services/SystemUpdateService.qml b/quickshell/Services/SystemUpdateService.qml index c4876bab..a455a255 100644 --- a/quickshell/Services/SystemUpdateService.qml +++ b/quickshell/Services/SystemUpdateService.qml @@ -1,5 +1,4 @@ pragma Singleton - pragma ComponentBehavior: Bound import QtQuick @@ -20,6 +19,7 @@ Singleton { property string distribution: "" property bool distributionSupported: false property string shellVersion: "" + property string shellCodename: "" readonly property var archBasedUCSettings: { "listUpdatesSettings": { @@ -34,7 +34,7 @@ Singleton { "currentVersion": match[2], "newVersion": match[3], "description": `${match[1]} ${match[2]} → ${match[3]}` - } + }; } } } @@ -56,7 +56,7 @@ Singleton { "currentVersion": match[2], "newVersion": match[3], "description": `${match[1]} ${match[2]} → ${match[3]}` - } + }; } } } @@ -78,7 +78,7 @@ Singleton { "currentVersion": "", "newVersion": match[2], "description": `${match[1]} → ${match[2]}` - } + }; } } } @@ -100,40 +100,49 @@ Singleton { command: ["sh", "-c", "cat /etc/os-release | grep '^ID=' | cut -d'=' -f2 | tr -d '\"'"] running: true - onExited: (exitCode) => { + onExited: exitCode => { if (exitCode === 0) { - distribution = stdout.text.trim().toLowerCase() - distributionSupported = supportedDistributions.includes(distribution) + distribution = stdout.text.trim().toLowerCase(); + distributionSupported = supportedDistributions.includes(distribution); if (distributionSupported) { - updateFinderDetection.running = true - pkgManagerDetection.running = true - checkForUpdates() + updateFinderDetection.running = true; + pkgManagerDetection.running = true; + checkForUpdates(); } else { - console.warn("SystemUpdate: Unsupported distribution:", distribution) + console.warn("SystemUpdate: Unsupported distribution:", distribution); } } else { - console.warn("SystemUpdate: Failed to detect distribution") + console.warn("SystemUpdate: Failed to detect distribution"); } } stdout: StdioCollector {} Component.onCompleted: { - versionDetection.running = true + versionDetection.running = true; } } Process { id: versionDetection - command: [ - "sh", "-c", - `cd "${Quickshell.shellDir}" && if [ -d .git ]; then echo "(git) $(git rev-parse --short HEAD)"; elif [ -f VERSION ]; then cat VERSION; fi` - ] + command: ["sh", "-c", `cd "${Quickshell.shellDir}" && if [ -d .git ]; then echo "(git) $(git rev-parse --short HEAD)"; elif [ -f VERSION ]; then cat VERSION; fi`] stdout: StdioCollector { onStreamFinished: { - shellVersion = text.trim() + shellVersion = text.trim(); + } + } + } + + Process { + id: codenameDetection + command: ["sh", "-c", `cd "${Quickshell.shellDir}" && if [ -f CODENAME ]; then cat CODENAME; fi`] + running: true + + stdout: StdioCollector { + onStreamFinished: { + shellCodename = text.trim(); } } } @@ -142,12 +151,12 @@ Singleton { id: updateFinderDetection command: ["sh", "-c", "which checkupdates"] - onExited: (exitCode) => { + onExited: exitCode => { if (exitCode === 0) { - const exeFound = stdout.text.trim() - updChecker = exeFound.split('/').pop() + const exeFound = stdout.text.trim(); + updChecker = exeFound.split('/').pop(); } else { - console.warn("SystemUpdate: No update checker found. Will use package manager.") + console.warn("SystemUpdate: No update checker found. Will use package manager."); } } @@ -158,12 +167,12 @@ Singleton { id: pkgManagerDetection command: ["sh", "-c", "which paru || which yay || which dnf"] - onExited: (exitCode) => { + onExited: exitCode => { if (exitCode === 0) { - const exeFound = stdout.text.trim() - pkgManager = exeFound.split('/').pop() + const exeFound = stdout.text.trim(); + pkgManager = exeFound.split('/').pop(); } else { - console.warn("SystemUpdate: No package manager found") + console.warn("SystemUpdate: No package manager found"); } } @@ -173,19 +182,17 @@ Singleton { Process { id: updateChecker - onExited: (exitCode) => { - isChecking = false - const correctExitCodes = updChecker.length > 0 ? - [updChecker].concat(updateCheckerParams[updChecker].listUpdatesSettings.correctExitCodes) : - [pkgManager].concat(packageManagerParams[pkgManager].listUpdatesSettings.correctExitCodes) + onExited: exitCode => { + isChecking = false; + const correctExitCodes = updChecker.length > 0 ? [updChecker].concat(updateCheckerParams[updChecker].listUpdatesSettings.correctExitCodes) : [pkgManager].concat(packageManagerParams[pkgManager].listUpdatesSettings.correctExitCodes); if (correctExitCodes.includes(exitCode)) { - parseUpdates(stdout.text) - hasError = false - errorMessage = "" + parseUpdates(stdout.text); + hasError = false; + errorMessage = ""; } else { - hasError = true - errorMessage = "Failed to check for updates" - console.warn("SystemUpdate: Update check failed with code:", exitCode) + hasError = true; + errorMessage = "Failed to check for updates"; + console.warn("SystemUpdate: Update check failed with code:", exitCode); } } @@ -194,67 +201,67 @@ Singleton { Process { id: updater - onExited: (exitCode) => { - checkForUpdates() + onExited: exitCode => { + checkForUpdates(); } } function checkForUpdates() { - if (!distributionSupported || (!pkgManager && !updChecker) || isChecking) return - - isChecking = true - hasError = false + if (!distributionSupported || (!pkgManager && !updChecker) || isChecking) + return; + isChecking = true; + hasError = false; if (updChecker.length > 0) { - updateChecker.command = [updChecker].concat(updateCheckerParams[updChecker].listUpdatesSettings.params) + updateChecker.command = [updChecker].concat(updateCheckerParams[updChecker].listUpdatesSettings.params); } else { - updateChecker.command = [pkgManager].concat(packageManagerParams[pkgManager].listUpdatesSettings.params) + updateChecker.command = [pkgManager].concat(packageManagerParams[pkgManager].listUpdatesSettings.params); } - updateChecker.running = true + updateChecker.running = true; } function parseUpdates(output) { - const lines = output.trim().split('\n').filter(line => line.trim()) - const updates = [] + const lines = output.trim().split('\n').filter(line => line.trim()); + const updates = []; - const regex = packageManagerParams[pkgManager].parserSettings.lineRegex - const entryProducer = packageManagerParams[pkgManager].parserSettings.entryProducer + const regex = packageManagerParams[pkgManager].parserSettings.lineRegex; + const entryProducer = packageManagerParams[pkgManager].parserSettings.entryProducer; for (const line of lines) { - const match = line.match(regex) + const match = line.match(regex); if (match) { - updates.push(entryProducer(match)) + updates.push(entryProducer(match)); } } - availableUpdates = updates + availableUpdates = updates; } function runUpdates() { - if (!distributionSupported || !pkgManager || updateCount === 0) return - - const terminal = Quickshell.env("TERMINAL") || "xterm" + if (!distributionSupported || !pkgManager || updateCount === 0) + return; + const terminal = Quickshell.env("TERMINAL") || "xterm"; if (SettingsData.updaterUseCustomCommand && SettingsData.updaterCustomCommand.length > 0) { - const updateCommand = `${SettingsData.updaterCustomCommand} && echo "Updates complete! Press Enter to close..." && read` - const termClass = SettingsData.updaterTerminalAdditionalParams + const updateCommand = `${SettingsData.updaterCustomCommand} && echo "Updates complete! Press Enter to close..." && read`; + const termClass = SettingsData.updaterTerminalAdditionalParams; - var finalCommand = [terminal] + var finalCommand = [terminal]; if (termClass.length > 0) { - finalCommand = finalCommand.concat(termClass.split(" ")) + finalCommand = finalCommand.concat(termClass.split(" ")); } - finalCommand.push("-e") - finalCommand.push("sh") - finalCommand.push("-c") - finalCommand.push(updateCommand) - updater.command = finalCommand + finalCommand.push("-e"); + finalCommand.push("sh"); + finalCommand.push("-c"); + finalCommand.push(updateCommand); + updater.command = finalCommand; } else { - const params = packageManagerParams[pkgManager].upgradeSettings.params.join(" ") - const sudo = packageManagerParams[pkgManager].upgradeSettings.requiresSudo ? "sudo" : "" - const updateCommand = `${sudo} ${pkgManager} ${params} && echo "Updates complete! Press Enter to close..." && read` + const params = packageManagerParams[pkgManager].upgradeSettings.params.join(" "); + const sudo = packageManagerParams[pkgManager].upgradeSettings.requiresSudo ? "sudo" : ""; + const updateCommand = `${sudo} ${pkgManager} ${params} && echo "Updates complete! Press Enter to close..." && read`; - updater.command = [terminal, "-e", "sh", "-c", updateCommand] + updater.command = [terminal, "-e", "sh", "-c", updateCommand]; } - updater.running = true + updater.running = true; } Timer { @@ -263,22 +270,22 @@ Singleton { running: refCount > 0 && distributionSupported && (pkgManager || updChecker) onTriggered: checkForUpdates() } - + IpcHandler { target: "systemupdater" function updatestatus(): string { if (root.isChecking) { - return "ERROR: already checking" + return "ERROR: already checking"; } if (!distributionSupported) { - return "ERROR: distribution not supported" + return "ERROR: distribution not supported"; } if (!pkgManager && !updChecker) { - return "ERROR: update checker not available" + return "ERROR: update checker not available"; } - root.checkForUpdates() - return "SUCCESS: Now checking..." + root.checkForUpdates(); + return "SUCCESS: Now checking..."; } } }