mirror of
https://github.com/luxfi/lpm.git
synced 2026-10-30 16:20:57 +00:00
Lux Partners Limited is the Isle of Man company. Lux Industries Inc, a Delaware C corporation, is the company these sites belong to, so it is the one they name — in metadata, copyright, and the press items that record who signed. The fund site names Lux Assets Management LLC, which is its own company. Two sentences were rewritten rather than renamed, because a name was doing work a name cannot do. One claimed an Isle of Man domicile the naming entity does not have. The other said a company acts on behalf of another; with one entity left it said a company acts on behalf of itself. The Isle of Man stays everywhere it is a JURISDICTION the product supports — the regulatory package, the jurisdiction guides, the compliance tables. Only this company's own identity changed.
76 lines
1.5 KiB
Go
76 lines
1.5 KiB
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package workflow
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"io/fs"
|
|
"path/filepath"
|
|
|
|
"github.com/spf13/afero"
|
|
|
|
"github.com/luxfi/lpm/state"
|
|
)
|
|
|
|
var _ Workflow = &Uninstall{}
|
|
|
|
func NewUninstall(config UninstallConfig) *Uninstall {
|
|
return &Uninstall{
|
|
name: config.Name,
|
|
repoAlias: config.RepoAlias,
|
|
plugin: config.Plugin,
|
|
stateFile: config.StateFile,
|
|
fs: config.Fs,
|
|
pluginPath: config.PluginPath,
|
|
}
|
|
}
|
|
|
|
type UninstallConfig struct {
|
|
Name string
|
|
Plugin string
|
|
RepoAlias string
|
|
StateFile state.File
|
|
Fs afero.Fs
|
|
PluginPath string
|
|
}
|
|
|
|
type Uninstall struct {
|
|
name string
|
|
plugin string
|
|
repoAlias string
|
|
stateFile state.File
|
|
fs afero.Fs
|
|
pluginPath string
|
|
}
|
|
|
|
func (u Uninstall) Execute() error {
|
|
installInfo, ok := u.stateFile.InstallationRegistry[u.name]
|
|
if !ok {
|
|
fmt.Printf("VM %s is already not installed. Skipping.\n", u.name)
|
|
return nil
|
|
}
|
|
|
|
vmPath := filepath.Join(u.pluginPath, installInfo.ID)
|
|
|
|
switch _, err := u.fs.Stat(vmPath); err {
|
|
case nil:
|
|
fmt.Printf("Deleting %s...\n", vmPath)
|
|
if err := u.fs.Remove(vmPath); err != nil {
|
|
return err
|
|
}
|
|
default:
|
|
if errors.Is(err, fs.ErrNotExist) {
|
|
fmt.Printf("%s doesn't exist already. Nothing to delete here.\n", vmPath)
|
|
} else {
|
|
return err
|
|
}
|
|
}
|
|
|
|
delete(u.stateFile.InstallationRegistry, u.name)
|
|
fmt.Printf("Successfully uninstalled %s.\n", u.name)
|
|
|
|
return nil
|
|
}
|