diff --git a/cmd/uninstall.go b/cmd/uninstall.go index 2f7ddadc..8a8fe67b 100644 --- a/cmd/uninstall.go +++ b/cmd/uninstall.go @@ -67,10 +67,12 @@ var uninstallCmd = &cobra.Command{ dbpath := LuetCfg.Viper.GetString("system.database_path") rootfs := LuetCfg.Viper.GetString("system.rootfs") engine := LuetCfg.Viper.GetString("system.database_engine") + keepProtected, _ := cmd.Flags().GetBool("keep-protected-files") LuetCfg.System.DatabaseEngine = engine LuetCfg.System.DatabasePath = dbpath LuetCfg.System.Rootfs = rootfs + LuetCfg.ConfigProtectSkip = !keepProtected LuetCfg.GetSolverOptions().Type = stype LuetCfg.GetSolverOptions().LearnRate = float32(rate) @@ -123,6 +125,7 @@ func init() { uninstallCmd.Flags().Bool("full-clean", false, "(experimental) Uninstall packages and all the other deps/revdeps of it.") uninstallCmd.Flags().Bool("solver-concurrent", false, "Use concurrent solver (experimental)") uninstallCmd.Flags().BoolP("yes", "y", false, "Don't ask questions") + uninstallCmd.Flags().BoolP("keep-protected-files", "k", false, "Keep package protected files around") RootCmd.AddCommand(uninstallCmd) } diff --git a/tests/integration/12_config_protect.sh b/tests/integration/12_config_protect.sh index 16a57cbf..910085a0 100755 --- a/tests/integration/12_config_protect.sh +++ b/tests/integration/12_config_protect.sh @@ -92,7 +92,7 @@ testUnInstall() { assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]" # TODO: we need remove it or not?? assertTrue 'config protect created' "[ -e '$tmpdir/testrootfs/etc/a/._cfg0001_conf' ]" - assertTrue 'config protect maintains the protected files' "[ -e '$tmpdir/testrootfs/etc/a/conf' ]" + assertTrue 'config protect maintains the protected files' "[ ! -e '$tmpdir/testrootfs/etc/a/conf' ]" } diff --git a/tests/integration/12_config_protect_samefile.sh b/tests/integration/12_config_protect_samefile.sh index 1f0d581f..d66a5bed 100755 --- a/tests/integration/12_config_protect_samefile.sh +++ b/tests/integration/12_config_protect_samefile.sh @@ -87,7 +87,7 @@ testInstall() { testUnInstall() { - luet uninstall -y --full --config $tmpdir/luet.yaml test/a + luet uninstall -y --full --keep-protected-files --config $tmpdir/luet.yaml test/a installst=$? assertEquals 'uninstall test successfully' "$installst" "0" assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]" diff --git a/tests/integration/13_config_protect_annotation.sh b/tests/integration/13_config_protect_annotation.sh index c396833d..9466ec48 100755 --- a/tests/integration/13_config_protect_annotation.sh +++ b/tests/integration/13_config_protect_annotation.sh @@ -86,7 +86,7 @@ testInstall() { testUnInstall() { - luet uninstall -y --full --config $tmpdir/luet.yaml test/a + luet uninstall -y --full --keep-protected-files --config $tmpdir/luet.yaml test/a installst=$? assertEquals 'uninstall test successfully' "$installst" "0" assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"