mirror of
https://github.com/mudler/luet.git
synced 2025-09-07 10:10:17 +00:00
config_protect: don't protect files during uninstall by default
Otherwise during uninstall we would retain the files which are protected. We introduced a specific flag for it to pass during uninstall, but for now we choose semplicity and expected default first. Signed-off-by: Ettore Di Giacinto <mudler@sabayon.org>
This commit is contained in:
@@ -67,10 +67,12 @@ var uninstallCmd = &cobra.Command{
|
|||||||
dbpath := LuetCfg.Viper.GetString("system.database_path")
|
dbpath := LuetCfg.Viper.GetString("system.database_path")
|
||||||
rootfs := LuetCfg.Viper.GetString("system.rootfs")
|
rootfs := LuetCfg.Viper.GetString("system.rootfs")
|
||||||
engine := LuetCfg.Viper.GetString("system.database_engine")
|
engine := LuetCfg.Viper.GetString("system.database_engine")
|
||||||
|
keepProtected, _ := cmd.Flags().GetBool("keep-protected-files")
|
||||||
|
|
||||||
LuetCfg.System.DatabaseEngine = engine
|
LuetCfg.System.DatabaseEngine = engine
|
||||||
LuetCfg.System.DatabasePath = dbpath
|
LuetCfg.System.DatabasePath = dbpath
|
||||||
LuetCfg.System.Rootfs = rootfs
|
LuetCfg.System.Rootfs = rootfs
|
||||||
|
LuetCfg.ConfigProtectSkip = !keepProtected
|
||||||
|
|
||||||
LuetCfg.GetSolverOptions().Type = stype
|
LuetCfg.GetSolverOptions().Type = stype
|
||||||
LuetCfg.GetSolverOptions().LearnRate = float32(rate)
|
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("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().Bool("solver-concurrent", false, "Use concurrent solver (experimental)")
|
||||||
uninstallCmd.Flags().BoolP("yes", "y", false, "Don't ask questions")
|
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)
|
RootCmd.AddCommand(uninstallCmd)
|
||||||
}
|
}
|
||||||
|
@@ -92,7 +92,7 @@ testUnInstall() {
|
|||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
# TODO: we need remove it or not??
|
# TODO: we need remove it or not??
|
||||||
assertTrue 'config protect created' "[ -e '$tmpdir/testrootfs/etc/a/._cfg0001_conf' ]"
|
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' ]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -87,7 +87,7 @@ testInstall() {
|
|||||||
|
|
||||||
|
|
||||||
testUnInstall() {
|
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=$?
|
installst=$?
|
||||||
assertEquals 'uninstall test successfully' "$installst" "0"
|
assertEquals 'uninstall test successfully' "$installst" "0"
|
||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
|
@@ -86,7 +86,7 @@ testInstall() {
|
|||||||
|
|
||||||
|
|
||||||
testUnInstall() {
|
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=$?
|
installst=$?
|
||||||
assertEquals 'uninstall test successfully' "$installst" "0"
|
assertEquals 'uninstall test successfully' "$installst" "0"
|
||||||
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
assertTrue 'package uninstalled' "[ ! -e '$tmpdir/testrootfs/c' ]"
|
||||||
|
Reference in New Issue
Block a user