- BPM Can now install and remove symlinks

This commit is contained in:
CapCreeperGR 2024-03-27 21:26:00 +02:00
parent 29a4c35a44
commit b6d217819c
5 changed files with 11 additions and 3 deletions

View File

@ -192,6 +192,13 @@ func InstallPackage(filename, installDir string, force bool) error {
if err != nil {
return err
}
case tar.TypeSymlink:
fmt.Println("old name: " + header.Linkname)
fmt.Println("new name: " + header.Name)
err := os.Symlink(header.Linkname, extractFilename)
if err != nil {
return err
}
default:
return errors.New("ExtractTarGz: uknown type: " + strconv.Itoa(int(header.Typeflag)) + " in " + extractFilename)
}
@ -376,7 +383,7 @@ func RemovePackage(pkg, rootDir string) error {
files := GetPackageFiles(pkg, rootDir)
for _, file := range files {
file = path.Join(rootDir, file)
stat, err := os.Stat(file)
stat, err := os.Lstat(file)
if os.IsNotExist(err) {
continue
}

View File

@ -17,7 +17,7 @@ import (
/* A simple-to-use package manager */
/* ---------------------------------- */
var bpmVer = "0.0.6"
var bpmVer = "0.0.7"
var rootDir = "/"
func main() {
@ -215,6 +215,7 @@ func resolveCommand() {
}
}
err := bpm_utils.RemovePackage(pkg, rootDir)
if err != nil {
log.Fatalf("Could not remove package\nError: %s\n", err)
}

Binary file not shown.

View File

@ -1,5 +1,5 @@
name: bpm
description: The Bubble Package Manager
version: 0.0.6
version: 0.0.7
architecture: x86_64
type: binary