diff --git a/kpkg/commands/removecmd.nim b/kpkg/commands/removecmd.nim index 481c1a59..44dec6c2 100644 --- a/kpkg/commands/removecmd.nim +++ b/kpkg/commands/removecmd.nim @@ -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) diff --git a/kpkg/modules/removeInternal.nim b/kpkg/modules/removeInternal.nim index 3fab88d9..3b6e98dd 100644 --- a/kpkg/modules/removeInternal.nim +++ b/kpkg/modules/removeInternal.nim @@ -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) @@ -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)