Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make distrobox automatically disable, fix versioning #45

Merged
merged 10 commits into from
Dec 26, 2024

Conversation

gerblesh
Copy link
Collaborator

This PR makes the distrobox module disabled when the bin path isn't executable. I didn't make the changes to the other drivers because that would kinda be like "silently failing." If flatpak or bootc fail to update the user should probably know and the program should send an error.

This also makes it so there's proper versioning within the SPEC so it doesn't get built as "version 1.0" constantly

return up, err
}
// check if file is executable using bitmask
up.Config.Enabled = inf.Mode()&0111 != 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to check if the other ones exit when they get executed. Like, on that BootcCompatible function and stuff. I'd also remove RunLog from those.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the bootc compat already checks if it exits. IMO we don't need these checks for flatpak or the system because they're expected to be there, and if they aren't there, the program should throw an unexpected error

We also don't use RunLog here, just a CombinedOutput:

func BootcCompatible(binaryPath string) (bool, error) {
	cmd := exec.Command(binaryPath, "status", "--format=json")
	out, err := cmd.CombinedOutput()
	if err != nil {
		return false, nil
	}
	var status bootcStatus
	err = json.Unmarshal(out, &status)
	if err != nil {
		return false, nil
	}
	return !(status.Status.Booted.Incompatible || status.Status.Staged.Incompatible), nil
}

@tulilirockz
Copy link
Contributor

Whenever you feel this PR is done, please ping me! I'd like to test out those changes

@tulilirockz
Copy link
Contributor

Check out the patch I sent you on discord, that should be the literal last thing to get this done.

@gerblesh gerblesh merged commit a9f5e57 into main Dec 26, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants