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: disallow updating built-in package managers #406

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/pkgManagers.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,11 @@ func updatePkgManager(cmd *cobra.Command, args []string) error {
return error
}

if pkgmanager.BuiltIn {
cmdr.Error.Println(apx.Trans("pkgmanagers.update.error.builtIn"))
os.Exit(126)
}

if autoRemove == "" {
if !assumeYes {
cmdr.Info.Printfln(apx.Trans("pkgmanagers.update.info.askNewCommand"), "autoRemove", pkgmanager.CmdAutoRemove)
Expand Down
2 changes: 2 additions & 0 deletions locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ pkgmanagers:
error:
noName: "No name specified."
missingCommand: "Missing command for %s."
builtIn: "Built-in package managers cannot be modified."
rm:
description: "Remove the specified package manager."
error:
Expand Down Expand Up @@ -268,6 +269,7 @@ stacks:
noPkgManager: "No package manager specified."
pkgManagerDoesNotExist: "The specified package manager does not exist. Create
it with 'apx pkgmanagers new' or contact the system administrator."
builtIn: "Built-in stacks cannot be modified."
info:
askBase: "Type a new base or confirm the current one (%s):"
askPkgManager: "Choose a new package manager or confirm the current one (%s):"
Expand Down