mirror of
https://github.com/mudler/luet.git
synced 2025-09-09 19:19:49 +00:00
Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
df14fe60fc | ||
|
459eb01a59 | ||
|
76328176c1 | ||
|
46ed6423ad | ||
|
d5df40512b | ||
|
d219a2e0fb | ||
|
4048138dcb | ||
|
e5f44eee09 | ||
|
6819a28f07 | ||
|
24eb6eaef5 | ||
|
58c4866289 | ||
|
c72565e019 | ||
|
0f59c207b0 | ||
|
68bc8d4d27 | ||
|
b24d335538 | ||
|
51417ecb5d | ||
|
130eb8de1a |
20
.travis.yml
20
.travis.yml
@@ -1,15 +1,31 @@
|
|||||||
|
dist: bionic
|
||||||
language: go
|
language: go
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
go:
|
go:
|
||||||
- "1.14"
|
- "1.14"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
global:
|
||||||
- "GO15VENDOREXPERIMENT=1"
|
- "GO15VENDOREXPERIMENT=1"
|
||||||
|
jobs:
|
||||||
|
- "DOCKER_BUILDKIT=0"
|
||||||
|
- "DOCKER_BUILDKIT=1"
|
||||||
before_install:
|
before_install:
|
||||||
|
- sudo rm -rf /var/lib/apt/lists/*
|
||||||
|
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||||
|
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge"
|
||||||
|
- sudo apt-get update
|
||||||
|
- echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json
|
||||||
|
- export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||||
|
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
|
||||||
|
- mkdir -vp ~/.docker/cli-plugins/
|
||||||
|
- curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
|
||||||
|
- chmod a+x ~/.docker/cli-plugins/docker-buildx
|
||||||
|
- docker buildx version
|
||||||
- sudo -E env "PATH=$PATH" apt-get install -y libcap2-bin
|
- sudo -E env "PATH=$PATH" apt-get install -y libcap2-bin
|
||||||
- sudo -E env "PATH=$PATH" make deps
|
- sudo -E env "PATH=$PATH" make deps
|
||||||
script:
|
script:
|
||||||
- sudo -E env "PATH=$PATH" make multiarch-build test-integration test-coverage
|
- sudo -E env "PATH=$PATH" make multiarch-build test-integration test-coverage
|
||||||
|
|
||||||
#after_success:
|
#after_success:
|
||||||
# - |
|
# - |
|
||||||
# if [ -n "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
# if [ -n "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||||
|
@@ -38,7 +38,7 @@ var Verbose bool
|
|||||||
var LockedCommands = []string{"install", "uninstall", "upgrade"}
|
var LockedCommands = []string{"install", "uninstall", "upgrade"}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
LuetCLIVersion = "0.8.13"
|
LuetCLIVersion = "0.8.15"
|
||||||
LuetEnvPrefix = "LUET"
|
LuetEnvPrefix = "LUET"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -75,6 +75,9 @@ var uninstallCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
Debug("Solver", LuetCfg.GetSolverOptions().CompactString())
|
Debug("Solver", LuetCfg.GetSolverOptions().CompactString())
|
||||||
|
|
||||||
|
// Load config protect configs
|
||||||
|
installer.LoadConfigProtectConfs(LuetCfg)
|
||||||
|
|
||||||
inst := installer.NewLuetInstaller(installer.LuetInstallerOptions{
|
inst := installer.NewLuetInstaller(installer.LuetInstallerOptions{
|
||||||
Concurrency: LuetCfg.GetGeneral().Concurrency,
|
Concurrency: LuetCfg.GetGeneral().Concurrency,
|
||||||
SolverOptions: *LuetCfg.GetSolverOptions(),
|
SolverOptions: *LuetCfg.GetSolverOptions(),
|
||||||
|
@@ -78,6 +78,9 @@ var upgradeCmd = &cobra.Command{
|
|||||||
|
|
||||||
Debug("Solver", LuetCfg.GetSolverOptions().String())
|
Debug("Solver", LuetCfg.GetSolverOptions().String())
|
||||||
|
|
||||||
|
// Load config protect configs
|
||||||
|
installer.LoadConfigProtectConfs(LuetCfg)
|
||||||
|
|
||||||
inst := installer.NewLuetInstaller(installer.LuetInstallerOptions{
|
inst := installer.NewLuetInstaller(installer.LuetInstallerOptions{
|
||||||
Concurrency: LuetCfg.GetGeneral().Concurrency,
|
Concurrency: LuetCfg.GetGeneral().Concurrency,
|
||||||
SolverOptions: *LuetCfg.GetSolverOptions(),
|
SolverOptions: *LuetCfg.GetSolverOptions(),
|
||||||
|
@@ -330,35 +330,25 @@ func tarModifierWrapperFunc(dst, path string, header *tar.Header, content io.Rea
|
|||||||
|
|
||||||
func (a *PackageArtifact) GetProtectFiles() []string {
|
func (a *PackageArtifact) GetProtectFiles() []string {
|
||||||
ans := []string{}
|
ans := []string{}
|
||||||
|
annotationDir := ""
|
||||||
|
|
||||||
if !LuetCfg.ConfigProtectSkip &&
|
if !LuetCfg.ConfigProtectSkip {
|
||||||
LuetCfg.GetConfigProtectConfFiles() != nil &&
|
|
||||||
len(LuetCfg.GetConfigProtectConfFiles()) > 0 {
|
|
||||||
|
|
||||||
for _, file := range a.Files {
|
// a.CompileSpec could be nil when artifact.Unpack is used for tree tarball
|
||||||
for _, conf := range LuetCfg.GetConfigProtectConfFiles() {
|
if a.CompileSpec != nil &&
|
||||||
for _, dir := range conf.Directories {
|
a.CompileSpec.GetPackage().HasAnnotation(string(pkg.ConfigProtectAnnnotation)) {
|
||||||
// Note file is without / at begin.
|
|
||||||
if strings.HasPrefix("/"+file, filepath.Clean(dir)) {
|
|
||||||
// docker archive modifier works with path without / at begin.
|
|
||||||
ans = append(ans, file)
|
|
||||||
goto nextFile
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if a.CompileSpec.GetPackage().HasAnnotation(string(pkg.ConfigProtectAnnnotation)) {
|
|
||||||
dir, ok := a.CompileSpec.GetPackage().GetAnnotations()[string(pkg.ConfigProtectAnnnotation)]
|
dir, ok := a.CompileSpec.GetPackage().GetAnnotations()[string(pkg.ConfigProtectAnnnotation)]
|
||||||
if ok {
|
if ok {
|
||||||
if strings.HasPrefix("/"+file, filepath.Clean(dir)) {
|
annotationDir = dir
|
||||||
ans = append(ans, file)
|
|
||||||
goto nextFile
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// TODO: check if skip this if we have a.CompileSpec nil
|
||||||
|
|
||||||
nextFile:
|
cp := NewConfigProtect(annotationDir)
|
||||||
}
|
cp.Map(a.Files)
|
||||||
|
|
||||||
|
// NOTE: for unpack we need files path without initial /
|
||||||
|
ans = cp.GetProtectFiles(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ans
|
return ans
|
||||||
|
@@ -112,15 +112,19 @@ RUN echo bar > /test2`))
|
|||||||
diffs, err := b.Changes(filepath.Join(tmpdir2, "output1.tar"), filepath.Join(tmpdir, "output2.tar"))
|
diffs, err := b.Changes(filepath.Join(tmpdir2, "output1.tar"), filepath.Join(tmpdir, "output2.tar"))
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
|
artifacts := []ArtifactNode{}
|
||||||
|
if os.Getenv("DOCKER_BUILDKIT") == "1" {
|
||||||
|
artifacts = append(artifacts, ArtifactNode{Name: "/etc/resolv.conf", Size: 0})
|
||||||
|
}
|
||||||
|
artifacts = append(artifacts, ArtifactNode{Name: "/test", Size: 4})
|
||||||
|
artifacts = append(artifacts, ArtifactNode{Name: "/test2", Size: 4})
|
||||||
|
|
||||||
Expect(diffs).To(Equal(
|
Expect(diffs).To(Equal(
|
||||||
[]ArtifactLayer{{
|
[]ArtifactLayer{{
|
||||||
FromImage: filepath.Join(tmpdir2, "output1.tar"),
|
FromImage: filepath.Join(tmpdir2, "output1.tar"),
|
||||||
ToImage: filepath.Join(tmpdir, "output2.tar"),
|
ToImage: filepath.Join(tmpdir, "output2.tar"),
|
||||||
Diffs: ArtifactDiffs{
|
Diffs: ArtifactDiffs{
|
||||||
Additions: []ArtifactNode{
|
Additions: artifacts,
|
||||||
{Name: "/test", Size: 4},
|
|
||||||
{Name: "/test2", Size: 4},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}}))
|
}}))
|
||||||
err = b.ExtractRootfs(CompilerBackendOptions{SourcePath: filepath.Join(tmpdir, "output2.tar"), Destination: rootfs}, false)
|
err = b.ExtractRootfs(CompilerBackendOptions{SourcePath: filepath.Join(tmpdir, "output2.tar"), Destination: rootfs}, false)
|
||||||
|
@@ -101,15 +101,19 @@ RUN echo bar > /test2`))
|
|||||||
Expect(b.ImageDefinitionToTar(opts)).ToNot(HaveOccurred())
|
Expect(b.ImageDefinitionToTar(opts)).ToNot(HaveOccurred())
|
||||||
Expect(helpers.Exists(filepath.Join(tmpdir, "output2.tar"))).To(BeTrue())
|
Expect(helpers.Exists(filepath.Join(tmpdir, "output2.tar"))).To(BeTrue())
|
||||||
|
|
||||||
|
artifacts := []ArtifactNode{}
|
||||||
|
if os.Getenv("DOCKER_BUILDKIT") == "1" {
|
||||||
|
artifacts = append(artifacts, ArtifactNode{Name: "/etc/resolv.conf", Size: 0})
|
||||||
|
}
|
||||||
|
artifacts = append(artifacts, ArtifactNode{Name: "/test", Size: 4})
|
||||||
|
artifacts = append(artifacts, ArtifactNode{Name: "/test2", Size: 4})
|
||||||
|
|
||||||
Expect(b.Changes(filepath.Join(tmpdir2, "output1.tar"), filepath.Join(tmpdir, "output2.tar"))).To(Equal(
|
Expect(b.Changes(filepath.Join(tmpdir2, "output1.tar"), filepath.Join(tmpdir, "output2.tar"))).To(Equal(
|
||||||
[]ArtifactLayer{{
|
[]ArtifactLayer{{
|
||||||
FromImage: filepath.Join(tmpdir2, "output1.tar"),
|
FromImage: filepath.Join(tmpdir2, "output1.tar"),
|
||||||
ToImage: filepath.Join(tmpdir, "output2.tar"),
|
ToImage: filepath.Join(tmpdir, "output2.tar"),
|
||||||
Diffs: ArtifactDiffs{
|
Diffs: ArtifactDiffs{
|
||||||
Additions: []ArtifactNode{
|
Additions: artifacts,
|
||||||
{Name: "/test", Size: 4},
|
|
||||||
{Name: "/test2", Size: 4},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}}))
|
}}))
|
||||||
|
|
||||||
|
@@ -18,6 +18,8 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ConfigProtectConfFile struct {
|
type ConfigProtectConfFile struct {
|
||||||
@@ -39,3 +41,79 @@ func (c *ConfigProtectConfFile) String() string {
|
|||||||
return fmt.Sprintf("[%s] filename: %s, dirs: %s", c.Name, c.Filename,
|
return fmt.Sprintf("[%s] filename: %s, dirs: %s", c.Name, c.Filename,
|
||||||
c.Directories)
|
c.Directories)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ConfigProtect struct {
|
||||||
|
AnnotationDir string
|
||||||
|
MapProtected map[string]bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewConfigProtect(annotationDir string) *ConfigProtect {
|
||||||
|
if len(annotationDir) > 0 && annotationDir[0:1] != "/" {
|
||||||
|
annotationDir = "/" + annotationDir
|
||||||
|
}
|
||||||
|
return &ConfigProtect{
|
||||||
|
AnnotationDir: annotationDir,
|
||||||
|
MapProtected: make(map[string]bool, 0),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ConfigProtect) AddAnnotationDir(d string) {
|
||||||
|
c.AnnotationDir = d
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ConfigProtect) GetAnnotationDir() string {
|
||||||
|
return c.AnnotationDir
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ConfigProtect) Map(files []string) {
|
||||||
|
if LuetCfg.ConfigProtectSkip {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, file := range files {
|
||||||
|
|
||||||
|
if file[0:1] != "/" {
|
||||||
|
file = "/" + file
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(LuetCfg.GetConfigProtectConfFiles()) > 0 {
|
||||||
|
for _, conf := range LuetCfg.GetConfigProtectConfFiles() {
|
||||||
|
for _, dir := range conf.Directories {
|
||||||
|
// Note file is without / at begin (on unpack)
|
||||||
|
if strings.HasPrefix(file, filepath.Clean(dir)) {
|
||||||
|
// docker archive modifier works with path without / at begin.
|
||||||
|
c.MapProtected[file] = true
|
||||||
|
goto nextFile
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if c.AnnotationDir != "" && strings.HasPrefix(file, filepath.Clean(c.AnnotationDir)) {
|
||||||
|
c.MapProtected[file] = true
|
||||||
|
}
|
||||||
|
nextFile:
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ConfigProtect) Protected(file string) bool {
|
||||||
|
if file[0:1] != "/" {
|
||||||
|
file = "/" + file
|
||||||
|
}
|
||||||
|
_, ans := c.MapProtected[file]
|
||||||
|
return ans
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ConfigProtect) GetProtectFiles(withSlash bool) []string {
|
||||||
|
ans := []string{}
|
||||||
|
|
||||||
|
for key, _ := range c.MapProtected {
|
||||||
|
if withSlash {
|
||||||
|
ans = append(ans, key)
|
||||||
|
} else {
|
||||||
|
ans = append(ans, key[1:])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ans
|
||||||
|
}
|
||||||
|
118
pkg/config/config_protect_test.go
Normal file
118
pkg/config/config_protect_test.go
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
// Copyright © 2019-2020 Ettore Di Giacinto <mudler@gentoo.org>
|
||||||
|
// Daniele Rondina <geaaru@sabayonlinux.org>
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License along
|
||||||
|
// with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package config_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
config "github.com/mudler/luet/pkg/config"
|
||||||
|
|
||||||
|
. "github.com/onsi/ginkgo"
|
||||||
|
. "github.com/onsi/gomega"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ = Describe("Config", func() {
|
||||||
|
|
||||||
|
Context("Test config protect", func() {
|
||||||
|
|
||||||
|
It("Protect1", func() {
|
||||||
|
|
||||||
|
files := []string{
|
||||||
|
"etc/foo/my.conf",
|
||||||
|
"usr/bin/foo",
|
||||||
|
"usr/share/doc/foo.md",
|
||||||
|
}
|
||||||
|
|
||||||
|
cp := config.NewConfigProtect("/etc")
|
||||||
|
cp.Map(files)
|
||||||
|
|
||||||
|
Expect(cp.Protected("etc/foo/my.conf")).To(BeTrue())
|
||||||
|
Expect(cp.Protected("/etc/foo/my.conf")).To(BeTrue())
|
||||||
|
Expect(cp.Protected("usr/bin/foo")).To(BeFalse())
|
||||||
|
Expect(cp.Protected("/usr/bin/foo")).To(BeFalse())
|
||||||
|
Expect(cp.Protected("/usr/share/doc/foo.md")).To(BeFalse())
|
||||||
|
|
||||||
|
Expect(cp.GetProtectFiles(false)).To(Equal(
|
||||||
|
[]string{
|
||||||
|
"etc/foo/my.conf",
|
||||||
|
},
|
||||||
|
))
|
||||||
|
|
||||||
|
Expect(cp.GetProtectFiles(true)).To(Equal(
|
||||||
|
[]string{
|
||||||
|
"/etc/foo/my.conf",
|
||||||
|
},
|
||||||
|
))
|
||||||
|
})
|
||||||
|
|
||||||
|
It("Protect2", func() {
|
||||||
|
|
||||||
|
files := []string{
|
||||||
|
"etc/foo/my.conf",
|
||||||
|
"usr/bin/foo",
|
||||||
|
"usr/share/doc/foo.md",
|
||||||
|
}
|
||||||
|
|
||||||
|
cp := config.NewConfigProtect("")
|
||||||
|
cp.Map(files)
|
||||||
|
|
||||||
|
Expect(cp.Protected("etc/foo/my.conf")).To(BeFalse())
|
||||||
|
Expect(cp.Protected("/etc/foo/my.conf")).To(BeFalse())
|
||||||
|
Expect(cp.Protected("usr/bin/foo")).To(BeFalse())
|
||||||
|
Expect(cp.Protected("/usr/bin/foo")).To(BeFalse())
|
||||||
|
Expect(cp.Protected("/usr/share/doc/foo.md")).To(BeFalse())
|
||||||
|
|
||||||
|
Expect(cp.GetProtectFiles(false)).To(Equal(
|
||||||
|
[]string{},
|
||||||
|
))
|
||||||
|
|
||||||
|
Expect(cp.GetProtectFiles(true)).To(Equal(
|
||||||
|
[]string{},
|
||||||
|
))
|
||||||
|
})
|
||||||
|
|
||||||
|
It("Protect3: Annotation dir without initial slash", func() {
|
||||||
|
|
||||||
|
files := []string{
|
||||||
|
"etc/foo/my.conf",
|
||||||
|
"usr/bin/foo",
|
||||||
|
"usr/share/doc/foo.md",
|
||||||
|
}
|
||||||
|
|
||||||
|
cp := config.NewConfigProtect("etc")
|
||||||
|
cp.Map(files)
|
||||||
|
|
||||||
|
Expect(cp.Protected("etc/foo/my.conf")).To(BeTrue())
|
||||||
|
Expect(cp.Protected("/etc/foo/my.conf")).To(BeTrue())
|
||||||
|
Expect(cp.Protected("usr/bin/foo")).To(BeFalse())
|
||||||
|
Expect(cp.Protected("/usr/bin/foo")).To(BeFalse())
|
||||||
|
Expect(cp.Protected("/usr/share/doc/foo.md")).To(BeFalse())
|
||||||
|
|
||||||
|
Expect(cp.GetProtectFiles(false)).To(Equal(
|
||||||
|
[]string{
|
||||||
|
"etc/foo/my.conf",
|
||||||
|
},
|
||||||
|
))
|
||||||
|
|
||||||
|
Expect(cp.GetProtectFiles(true)).To(Equal(
|
||||||
|
[]string{
|
||||||
|
"/etc/foo/my.conf",
|
||||||
|
},
|
||||||
|
))
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
@@ -610,16 +610,37 @@ func (l *LuetInstaller) installerWorker(i int, wg *sync.WaitGroup, c <-chan Arti
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l *LuetInstaller) uninstall(p pkg.Package, s *System) error {
|
func (l *LuetInstaller) uninstall(p pkg.Package, s *System) error {
|
||||||
|
var cp *config.ConfigProtect
|
||||||
|
annotationDir := ""
|
||||||
|
|
||||||
files, err := s.Database.GetPackageFiles(p)
|
files, err := s.Database.GetPackageFiles(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "Failed getting installed files")
|
return errors.Wrap(err, "Failed getting installed files")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !config.LuetCfg.ConfigProtectSkip {
|
||||||
|
|
||||||
|
if p.HasAnnotation(string(pkg.ConfigProtectAnnnotation)) {
|
||||||
|
dir, ok := p.GetAnnotations()[string(pkg.ConfigProtectAnnnotation)]
|
||||||
|
if ok {
|
||||||
|
annotationDir = dir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cp = config.NewConfigProtect(annotationDir)
|
||||||
|
cp.Map(files)
|
||||||
|
}
|
||||||
|
|
||||||
// Remove from target
|
// Remove from target
|
||||||
for _, f := range files {
|
for _, f := range files {
|
||||||
target := filepath.Join(s.Target, f)
|
target := filepath.Join(s.Target, f)
|
||||||
Debug("Removing", target)
|
|
||||||
|
|
||||||
|
if !config.LuetCfg.ConfigProtectSkip && cp.Protected(f) {
|
||||||
|
Debug("Preserving protected file:", f)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug("Removing", target)
|
||||||
if l.Options.PreserveSystemEssentialData &&
|
if l.Options.PreserveSystemEssentialData &&
|
||||||
strings.HasPrefix(f, config.LuetCfg.GetSystem().GetSystemPkgsCacheDirPath()) ||
|
strings.HasPrefix(f, config.LuetCfg.GetSystem().GetSystemPkgsCacheDirPath()) ||
|
||||||
strings.HasPrefix(f, config.LuetCfg.GetSystem().GetSystemRepoDatabaseDirPath()) {
|
strings.HasPrefix(f, config.LuetCfg.GetSystem().GetSystemRepoDatabaseDirPath()) {
|
||||||
@@ -642,7 +663,7 @@ func (l *LuetInstaller) uninstall(p pkg.Package, s *System) error {
|
|||||||
Warning("Failed reading folder", target, err.Error())
|
Warning("Failed reading folder", target, err.Error())
|
||||||
}
|
}
|
||||||
if len(files) != 0 {
|
if len(files) != 0 {
|
||||||
Warning("Preserving not-empty folder", target, err.Error())
|
Warning("Preserving not-empty folder", target)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -91,6 +91,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' ]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -91,6 +91,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/opt/etc/._cfg0001_conf' ]"
|
assertTrue 'config protect created' "[ -e '$tmpdir/testrootfs/opt/etc/._cfg0001_conf' ]"
|
||||||
|
assertTrue 'config protect maintains the protected files' "[ -e '$tmpdir/testrootfs/opt/etc/conf' ]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user