mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-14 17:52:10 -04:00
dankinstall: don't fail suse if addrepo fails
This commit is contained in:
@@ -476,7 +476,7 @@ func (o *OpenSUSEDistribution) enableOBSRepos(ctx context.Context, obsPkgs []Pac
|
|||||||
cmd := ExecSudoCommand(ctx, sudoPassword,
|
cmd := ExecSudoCommand(ctx, sudoPassword,
|
||||||
fmt.Sprintf("zypper addrepo -f %s", repoURL))
|
fmt.Sprintf("zypper addrepo -f %s", repoURL))
|
||||||
if err := o.runWithProgress(cmd, progressChan, PhaseSystemPackages, 0.20, 0.22); err != nil {
|
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
|
enabledRepos[pkg.RepoURL] = true
|
||||||
|
|||||||
1
quickshell/CODENAME
Normal file
1
quickshell/CODENAME
Normal file
@@ -0,0 +1 @@
|
|||||||
|
The Dark Knight
|
||||||
@@ -3,7 +3,6 @@ import QtQuick.Effects
|
|||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
import qs.Modules.Settings.Widgets
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: aboutTab
|
id: aboutTab
|
||||||
@@ -200,6 +199,16 @@ Item {
|
|||||||
width: parent.width
|
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 {
|
Row {
|
||||||
id: resourceButtonsRow
|
id: resourceButtonsRow
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
|
||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
@@ -20,6 +19,7 @@ Singleton {
|
|||||||
property string distribution: ""
|
property string distribution: ""
|
||||||
property bool distributionSupported: false
|
property bool distributionSupported: false
|
||||||
property string shellVersion: ""
|
property string shellVersion: ""
|
||||||
|
property string shellCodename: ""
|
||||||
|
|
||||||
readonly property var archBasedUCSettings: {
|
readonly property var archBasedUCSettings: {
|
||||||
"listUpdatesSettings": {
|
"listUpdatesSettings": {
|
||||||
@@ -34,7 +34,7 @@ Singleton {
|
|||||||
"currentVersion": match[2],
|
"currentVersion": match[2],
|
||||||
"newVersion": match[3],
|
"newVersion": match[3],
|
||||||
"description": `${match[1]} ${match[2]} → ${match[3]}`
|
"description": `${match[1]} ${match[2]} → ${match[3]}`
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ Singleton {
|
|||||||
"currentVersion": match[2],
|
"currentVersion": match[2],
|
||||||
"newVersion": match[3],
|
"newVersion": match[3],
|
||||||
"description": `${match[1]} ${match[2]} → ${match[3]}`
|
"description": `${match[1]} ${match[2]} → ${match[3]}`
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ Singleton {
|
|||||||
"currentVersion": "",
|
"currentVersion": "",
|
||||||
"newVersion": match[2],
|
"newVersion": match[2],
|
||||||
"description": `${match[1]} → ${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 '\"'"]
|
command: ["sh", "-c", "cat /etc/os-release | grep '^ID=' | cut -d'=' -f2 | tr -d '\"'"]
|
||||||
running: true
|
running: true
|
||||||
|
|
||||||
onExited: (exitCode) => {
|
onExited: exitCode => {
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
distribution = stdout.text.trim().toLowerCase()
|
distribution = stdout.text.trim().toLowerCase();
|
||||||
distributionSupported = supportedDistributions.includes(distribution)
|
distributionSupported = supportedDistributions.includes(distribution);
|
||||||
|
|
||||||
if (distributionSupported) {
|
if (distributionSupported) {
|
||||||
updateFinderDetection.running = true
|
updateFinderDetection.running = true;
|
||||||
pkgManagerDetection.running = true
|
pkgManagerDetection.running = true;
|
||||||
checkForUpdates()
|
checkForUpdates();
|
||||||
} else {
|
} else {
|
||||||
console.warn("SystemUpdate: Unsupported distribution:", distribution)
|
console.warn("SystemUpdate: Unsupported distribution:", distribution);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.warn("SystemUpdate: Failed to detect distribution")
|
console.warn("SystemUpdate: Failed to detect distribution");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stdout: StdioCollector {}
|
stdout: StdioCollector {}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
versionDetection.running = true
|
versionDetection.running = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: versionDetection
|
id: versionDetection
|
||||||
command: [
|
command: ["sh", "-c", `cd "${Quickshell.shellDir}" && if [ -d .git ]; then echo "(git) $(git rev-parse --short HEAD)"; elif [ -f VERSION ]; then cat VERSION; fi`]
|
||||||
"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 {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
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
|
id: updateFinderDetection
|
||||||
command: ["sh", "-c", "which checkupdates"]
|
command: ["sh", "-c", "which checkupdates"]
|
||||||
|
|
||||||
onExited: (exitCode) => {
|
onExited: exitCode => {
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
const exeFound = stdout.text.trim()
|
const exeFound = stdout.text.trim();
|
||||||
updChecker = exeFound.split('/').pop()
|
updChecker = exeFound.split('/').pop();
|
||||||
} else {
|
} 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
|
id: pkgManagerDetection
|
||||||
command: ["sh", "-c", "which paru || which yay || which dnf"]
|
command: ["sh", "-c", "which paru || which yay || which dnf"]
|
||||||
|
|
||||||
onExited: (exitCode) => {
|
onExited: exitCode => {
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
const exeFound = stdout.text.trim()
|
const exeFound = stdout.text.trim();
|
||||||
pkgManager = exeFound.split('/').pop()
|
pkgManager = exeFound.split('/').pop();
|
||||||
} else {
|
} else {
|
||||||
console.warn("SystemUpdate: No package manager found")
|
console.warn("SystemUpdate: No package manager found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,19 +182,17 @@ Singleton {
|
|||||||
Process {
|
Process {
|
||||||
id: updateChecker
|
id: updateChecker
|
||||||
|
|
||||||
onExited: (exitCode) => {
|
onExited: exitCode => {
|
||||||
isChecking = false
|
isChecking = false;
|
||||||
const correctExitCodes = updChecker.length > 0 ?
|
const correctExitCodes = updChecker.length > 0 ? [updChecker].concat(updateCheckerParams[updChecker].listUpdatesSettings.correctExitCodes) : [pkgManager].concat(packageManagerParams[pkgManager].listUpdatesSettings.correctExitCodes);
|
||||||
[updChecker].concat(updateCheckerParams[updChecker].listUpdatesSettings.correctExitCodes) :
|
|
||||||
[pkgManager].concat(packageManagerParams[pkgManager].listUpdatesSettings.correctExitCodes)
|
|
||||||
if (correctExitCodes.includes(exitCode)) {
|
if (correctExitCodes.includes(exitCode)) {
|
||||||
parseUpdates(stdout.text)
|
parseUpdates(stdout.text);
|
||||||
hasError = false
|
hasError = false;
|
||||||
errorMessage = ""
|
errorMessage = "";
|
||||||
} else {
|
} else {
|
||||||
hasError = true
|
hasError = true;
|
||||||
errorMessage = "Failed to check for updates"
|
errorMessage = "Failed to check for updates";
|
||||||
console.warn("SystemUpdate: Update check failed with code:", exitCode)
|
console.warn("SystemUpdate: Update check failed with code:", exitCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,67 +201,67 @@ Singleton {
|
|||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: updater
|
id: updater
|
||||||
onExited: (exitCode) => {
|
onExited: exitCode => {
|
||||||
checkForUpdates()
|
checkForUpdates();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkForUpdates() {
|
function checkForUpdates() {
|
||||||
if (!distributionSupported || (!pkgManager && !updChecker) || isChecking) return
|
if (!distributionSupported || (!pkgManager && !updChecker) || isChecking)
|
||||||
|
return;
|
||||||
isChecking = true
|
isChecking = true;
|
||||||
hasError = false
|
hasError = false;
|
||||||
if (updChecker.length > 0) {
|
if (updChecker.length > 0) {
|
||||||
updateChecker.command = [updChecker].concat(updateCheckerParams[updChecker].listUpdatesSettings.params)
|
updateChecker.command = [updChecker].concat(updateCheckerParams[updChecker].listUpdatesSettings.params);
|
||||||
} else {
|
} 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) {
|
function parseUpdates(output) {
|
||||||
const lines = output.trim().split('\n').filter(line => line.trim())
|
const lines = output.trim().split('\n').filter(line => line.trim());
|
||||||
const updates = []
|
const updates = [];
|
||||||
|
|
||||||
const regex = packageManagerParams[pkgManager].parserSettings.lineRegex
|
const regex = packageManagerParams[pkgManager].parserSettings.lineRegex;
|
||||||
const entryProducer = packageManagerParams[pkgManager].parserSettings.entryProducer
|
const entryProducer = packageManagerParams[pkgManager].parserSettings.entryProducer;
|
||||||
|
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
const match = line.match(regex)
|
const match = line.match(regex);
|
||||||
if (match) {
|
if (match) {
|
||||||
updates.push(entryProducer(match))
|
updates.push(entryProducer(match));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
availableUpdates = updates
|
availableUpdates = updates;
|
||||||
}
|
}
|
||||||
|
|
||||||
function runUpdates() {
|
function runUpdates() {
|
||||||
if (!distributionSupported || !pkgManager || updateCount === 0) return
|
if (!distributionSupported || !pkgManager || updateCount === 0)
|
||||||
|
return;
|
||||||
const terminal = Quickshell.env("TERMINAL") || "xterm"
|
const terminal = Quickshell.env("TERMINAL") || "xterm";
|
||||||
|
|
||||||
if (SettingsData.updaterUseCustomCommand && SettingsData.updaterCustomCommand.length > 0) {
|
if (SettingsData.updaterUseCustomCommand && SettingsData.updaterCustomCommand.length > 0) {
|
||||||
const updateCommand = `${SettingsData.updaterCustomCommand} && echo "Updates complete! Press Enter to close..." && read`
|
const updateCommand = `${SettingsData.updaterCustomCommand} && echo "Updates complete! Press Enter to close..." && read`;
|
||||||
const termClass = SettingsData.updaterTerminalAdditionalParams
|
const termClass = SettingsData.updaterTerminalAdditionalParams;
|
||||||
|
|
||||||
var finalCommand = [terminal]
|
var finalCommand = [terminal];
|
||||||
if (termClass.length > 0) {
|
if (termClass.length > 0) {
|
||||||
finalCommand = finalCommand.concat(termClass.split(" "))
|
finalCommand = finalCommand.concat(termClass.split(" "));
|
||||||
}
|
}
|
||||||
finalCommand.push("-e")
|
finalCommand.push("-e");
|
||||||
finalCommand.push("sh")
|
finalCommand.push("sh");
|
||||||
finalCommand.push("-c")
|
finalCommand.push("-c");
|
||||||
finalCommand.push(updateCommand)
|
finalCommand.push(updateCommand);
|
||||||
updater.command = finalCommand
|
updater.command = finalCommand;
|
||||||
} else {
|
} else {
|
||||||
const params = packageManagerParams[pkgManager].upgradeSettings.params.join(" ")
|
const params = packageManagerParams[pkgManager].upgradeSettings.params.join(" ");
|
||||||
const sudo = packageManagerParams[pkgManager].upgradeSettings.requiresSudo ? "sudo" : ""
|
const sudo = packageManagerParams[pkgManager].upgradeSettings.requiresSudo ? "sudo" : "";
|
||||||
const updateCommand = `${sudo} ${pkgManager} ${params} && echo "Updates complete! Press Enter to close..." && read`
|
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 {
|
Timer {
|
||||||
@@ -263,22 +270,22 @@ Singleton {
|
|||||||
running: refCount > 0 && distributionSupported && (pkgManager || updChecker)
|
running: refCount > 0 && distributionSupported && (pkgManager || updChecker)
|
||||||
onTriggered: checkForUpdates()
|
onTriggered: checkForUpdates()
|
||||||
}
|
}
|
||||||
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
target: "systemupdater"
|
target: "systemupdater"
|
||||||
|
|
||||||
function updatestatus(): string {
|
function updatestatus(): string {
|
||||||
if (root.isChecking) {
|
if (root.isChecking) {
|
||||||
return "ERROR: already checking"
|
return "ERROR: already checking";
|
||||||
}
|
}
|
||||||
if (!distributionSupported) {
|
if (!distributionSupported) {
|
||||||
return "ERROR: distribution not supported"
|
return "ERROR: distribution not supported";
|
||||||
}
|
}
|
||||||
if (!pkgManager && !updChecker) {
|
if (!pkgManager && !updChecker) {
|
||||||
return "ERROR: update checker not available"
|
return "ERROR: update checker not available";
|
||||||
}
|
}
|
||||||
root.checkForUpdates()
|
root.checkForUpdates();
|
||||||
return "SUCCESS: Now checking..."
|
return "SUCCESS: Now checking...";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user