mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-24 15:38:12 +02:00
Purge du code de compatibilite jean, base bbolt et arborescence ajean
- suppression des migrations d'agencement, d'unites et de dossier de donnees - store bbolt unique (ajean.db) : config, prefs, conversation, cles, drapeaux - arborescence backends/ bin/ presets/ memory/ models/ workspace/ - plus aucune variable, unite ou asset nomme jean
This commit is contained in:
1 parent
081a88c846
commit
2455d9f402
78 files changed
+1160
-2293
No files matched your search
@@ -14,10 +14,10 @@ import (
|
||||
// sys_install_darwin.go — installation macOS via launchd (LaunchDaemon), équivalent
|
||||
// de sys_install_linux.go (systemd). ⚠️ NON TESTÉ sur un vrai Mac : le support macOS
|
||||
// était totalement absent (le code systemd/Linux tournait par erreur et échouait
|
||||
// sur « systemctl: command not found » / « /etc/default/jean », cf. issue #4).
|
||||
// sur « systemctl: command not found » / « /etc/default/ajean », cf. issue #4).
|
||||
// Implémentation prudente ; à valider sur une machine Apple.
|
||||
|
||||
const configTemplate = `# Configuration JEAN — édite-moi puis: ajean restart
|
||||
const configTemplate = `# Configuration AJEAN — édite-moi puis: ajean restart
|
||||
# Le service launchd lit ce fichier et lance ton binaire llama.cpp.
|
||||
|
||||
# Chemins
|
||||
@@ -39,14 +39,14 @@ EXTRA_ARGS=""
|
||||
`
|
||||
|
||||
// launchdPlistTemplate — champs formatés : Label, chemin du binaire, UserName,
|
||||
// WorkingDirectory, AJEAN_HOME, JEAN_HOME, StandardOutPath, StandardErrorPath.
|
||||
// WorkingDirectory, AJEAN_HOME, AJEAN_HOME, StandardOutPath, StandardErrorPath.
|
||||
// KeepAlive/SuccessfulExit=false ≈ Restart=on-failure ; RunAtLoad relance au
|
||||
// boot une fois chargé avec `-w`.
|
||||
//
|
||||
// Le chemin du binaire est injecté et non codé en dur : il a changé avec le
|
||||
// renommage, et un plist figé sur l'ancien chemin donnerait un daemon qui refuse
|
||||
// de démarrer. Les deux variables d'environnement sont posées car le code lit
|
||||
// encore JEAN_HOME en héritage.
|
||||
// encore AJEAN_HOME en héritage.
|
||||
const launchdPlistTemplate = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
@@ -60,7 +60,7 @@ const launchdPlistTemplate = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<key>UserName</key><string>%s</string>
|
||||
<key>WorkingDirectory</key><string>%s</string>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict><key>AJEAN_HOME</key><string>%s</string><key>JEAN_HOME</key><string>%s</string></dict>
|
||||
<dict><key>AJEAN_HOME</key><string>%s</string><key>AJEAN_HOME</key><string>%s</string></dict>
|
||||
<key>RunAtLoad</key><true/>
|
||||
<key>KeepAlive</key>
|
||||
<dict><key>SuccessfulExit</key><false/></dict>
|
||||
@@ -87,7 +87,7 @@ func cmdInstall(args []string) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("utilisateur '%s' introuvable: %w", targetUser, err)
|
||||
}
|
||||
// Migration de l'agencement jean -> ajean AVANT de résoudre les chemins :
|
||||
// Migration de l'agencement ajean -> ajean AVANT de résoudre les chemins :
|
||||
// `install` est root et délibéré, c'est le bon moment. Ne fait rien si la
|
||||
// machine est déjà en ajean, ou si l'utilisateur a imposé un chemin.
|
||||
if err := migrateLayout(defaultLayoutPlan()); err != nil {
|
||||
@@ -96,13 +96,13 @@ func cmdInstall(args []string) error {
|
||||
resetResolvedHome() // le dossier a pu changer à l'instant
|
||||
|
||||
ajeanHome := defaultAjeanHome()
|
||||
if v := os.Getenv("JEAN_HOME"); v != "" {
|
||||
if v := os.Getenv("AJEAN_HOME"); v != "" {
|
||||
ajeanHome = v
|
||||
}
|
||||
svc := serviceName()
|
||||
|
||||
fmt.Printf("Installation pour utilisateur %s\n", cyan(targetUser))
|
||||
fmt.Printf(" JEAN_HOME = %s\n", ajeanHome)
|
||||
fmt.Printf(" AJEAN_HOME = %s\n", ajeanHome)
|
||||
fmt.Printf(" service = %s (launchd)\n", svc)
|
||||
|
||||
// 1. Répertoires
|
||||
@@ -154,7 +154,7 @@ func cmdInstall(args []string) error {
|
||||
fmt.Printf(" %s %s -> %s\n", green("✓"), target, self)
|
||||
}
|
||||
|
||||
// 3 bis. Alias hérité : `jean` doit rester tapable (voir sys_paths.go).
|
||||
// 3 bis. Alias hérité : `ajean` doit rester tapable (voir sys_paths.go).
|
||||
if alias := legacyExePath(); alias != target {
|
||||
if rp, e := filepath.EvalSymlinks(alias); e != nil || rp != self {
|
||||
_ = os.Remove(alias)
|
||||
@@ -168,7 +168,7 @@ func cmdInstall(args []string) error {
|
||||
|
||||
// 4. /etc/default/ajean pour que les invocations CLI résolvent AJEAN_HOME.
|
||||
// Les deux clés sont écrites : des scripts d'utilisateurs sourcent ce fichier
|
||||
// et lisent encore $JEAN_HOME.
|
||||
// et lisent encore $AJEAN_HOME.
|
||||
_ = os.MkdirAll("/etc/default", 0o755)
|
||||
defaults := fmt.Sprintf("# Generated by ajean install — racine des configs/memoire/presets\nAJEAN_HOME=%s\nJEAN_HOME=%s\n", ajeanHome, ajeanHome)
|
||||
if err := os.WriteFile("/etc/default/ajean", []byte(defaults), 0o644); err != nil {
|
||||
@@ -176,7 +176,7 @@ func cmdInstall(args []string) error {
|
||||
}
|
||||
fmt.Printf(" %s /etc/default/ajean\n", green("✓"))
|
||||
|
||||
// 5. LaunchDaemon plist (le log va sous JEAN_HOME, accessible au user cible)
|
||||
// 5. LaunchDaemon plist (le log va sous AJEAN_HOME, accessible au user cible)
|
||||
logPath := filepath.Join(ajeanHome, svc+".log")
|
||||
plist := fmt.Sprintf(launchdPlistTemplate, launchdLabel(svc), target, targetUser, ajeanHome, ajeanHome, ajeanHome, logPath, logPath)
|
||||
plistPath := launchdPlistPath(svc)
|
||||
@@ -185,7 +185,7 @@ func cmdInstall(args []string) error {
|
||||
}
|
||||
fmt.Printf(" %s %s\n", green("✓"), plistPath)
|
||||
|
||||
// 6. chown JEAN_HOME au user cible
|
||||
// 6. chown AJEAN_HOME au user cible
|
||||
chown(ajeanHome, u)
|
||||
|
||||
fmt.Println()
|
||||
@@ -214,8 +214,8 @@ func cmdUninstall(args []string) error {
|
||||
fmt.Printf(" %s %s\n", green("✓"), p)
|
||||
}
|
||||
}
|
||||
// On ne supprime jamais JEAN_HOME automatiquement (modèles, configs).
|
||||
fmt.Println(dim("(données utilisateur conservées — supprime $JEAN_HOME manuellement si tu veux purger)"))
|
||||
// On ne supprime jamais AJEAN_HOME automatiquement (modèles, configs).
|
||||
fmt.Println(dim("(données utilisateur conservées — supprime $AJEAN_HOME manuellement si tu veux purger)"))
|
||||
fmt.Println(green("[ok]") + " désinstallé")
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user