Skip to content

Commit

Permalink
removeInternal: disable postremove by default
Browse files Browse the repository at this point in the history
  • Loading branch information
kreatoo committed Sep 29, 2023
1 parent bc6ffd5 commit 8825586
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion kpkg/commands/removecmd.nim
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ proc remove*(packages: seq[string], yes = false, root = "",
if output.toLower() == "y":
createLockfile()
for i in packagesFinal:
removeInternal(i, root, force = force, depCheck = true, fullPkgList = packages, removeConfigs = configRemove)
removeInternal(i, root, force = force, depCheck = true, fullPkgList = packages, removeConfigs = configRemove, runPostRemove = true)
success("package "&i&" removed")
removeLockfile()
success("done", true)
Expand Down
9 changes: 5 additions & 4 deletions kpkg/modules/removeInternal.nim
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ proc bloatDepends*(package: string, installedDir: string, root: string): seq[str
proc removeInternal*(package: string, root = "",
installedDir = root&"/var/cache/kpkg/installed",
ignoreReplaces = false, force = true, depCheck = false,
noRunfile = false, fullPkgList = @[""], removeConfigs = false) =
noRunfile = false, fullPkgList = @[""], removeConfigs = false, runPostRemove = false) =

let init = getInit(root)

Expand Down Expand Up @@ -93,8 +93,9 @@ proc removeInternal*(package: string, root = "",
if symlinkExists(installedDir&"/"&i):
removeFile(installedDir&"/"&i)

if execCmdEx(". "&installedDir&"/"&actualPackage&"/run && command -v postremove > /dev/null").exitCode == 0:
if execCmdEx(". "&installedDir&"/"&actualPackage&"/run && postremove").exitCode != 0:
err "postremove failed"
if runPostRemove:
if execCmdEx(". "&installedDir&"/"&actualPackage&"/run && command -v postremove > /dev/null").exitCode == 0:
if execCmdEx(". "&installedDir&"/"&actualPackage&"/run && postremove").exitCode != 0:
err "postremove failed"

removeDir(installedDir&"/"&package)

0 comments on commit 8825586

Please sign in to comment.