mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-22 06:28:11 +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
@@ -11,7 +11,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
const configTemplate = `# Configuration JEAN — édite-moi puis: ajean restart
|
||||
const configTemplate = `# Configuration AJEAN — édite-moi puis: ajean restart
|
||||
# Le service systemd lit ce fichier et lance ton binaire llama.cpp.
|
||||
|
||||
# Chemins
|
||||
@@ -32,12 +32,12 @@ NGL="999"
|
||||
EXTRA_ARGS=""
|
||||
`
|
||||
|
||||
const sudoersTemplate = `# Allow %s to manage the %s systemd unit without a password (installed by jean).
|
||||
const sudoersTemplate = `# Allow %s to manage the %s systemd unit without a password (installed by ajean).
|
||||
%s ALL=(root) NOPASSWD: /bin/systemctl start %s, /bin/systemctl stop %s, /bin/systemctl restart %s, /bin/systemctl enable %s, /bin/systemctl disable %s
|
||||
`
|
||||
|
||||
const serviceUnitTemplate = `[Unit]
|
||||
Description=JEAN llama.cpp server
|
||||
Description=AJEAN llama.cpp server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
@@ -76,7 +76,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 {
|
||||
@@ -85,13 +85,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\n", svc)
|
||||
|
||||
// 1. Create directories
|
||||
@@ -114,7 +114,7 @@ func cmdInstall(args []string) error {
|
||||
fmt.Printf(" %s écrit %s\n", green("✓"), conf)
|
||||
}
|
||||
|
||||
// 3. Symlink current binary to /usr/local/bin/jean
|
||||
// 3. Symlink current binary to /usr/local/bin/ajean
|
||||
self, err := os.Executable()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -124,9 +124,9 @@ func cmdInstall(args []string) error {
|
||||
}
|
||||
target := installedExePath()
|
||||
// Garde-fou (issue #5) : si on tourne DÉJÀ depuis la cible (l'utilisateur a
|
||||
// posé le binaire dans /usr/local/bin/jean puis lancé `sudo ajean install`),
|
||||
// posé le binaire dans /usr/local/bin/ajean puis lancé `sudo ajean install`),
|
||||
// ne surtout pas Remove+Symlink sur soi-même — ça effacerait le vrai binaire
|
||||
// et créerait /usr/local/bin/jean -> /usr/local/bin/jean (« Too many levels
|
||||
// et créerait /usr/local/bin/ajean -> /usr/local/bin/ajean (« Too many levels
|
||||
// of symbolic links »). On compare les chemins réels (résolus).
|
||||
alreadyInPlace := false
|
||||
if tp, e := filepath.EvalSymlinks(target); e == nil && tp == self {
|
||||
@@ -147,7 +147,7 @@ func cmdInstall(args []string) error {
|
||||
|
||||
// 3 bis. Alias hérité : `ajean` doit rester tapable. Des utilisateurs ont des
|
||||
// alias shell, des cron, des scripts de déploiement et des tutos qui appellent
|
||||
// « jean » — on ne contrôle rien de tout ça, et un binaire renommé qui casse
|
||||
// « ajean » — on ne contrôle rien de tout ça, et un binaire renommé qui casse
|
||||
// la commande d'hier est une régression pour eux. Le lien pointe sur le
|
||||
// nouveau nom, donc il suit les mises à jour sans entretien.
|
||||
if alias := legacyExePath(); alias != target {
|
||||
@@ -163,7 +163,7 @@ func cmdInstall(args []string) error {
|
||||
|
||||
// 4. Drop /etc/default/ajean so root invocations resolve AJEAN_HOME correctly.
|
||||
// On écrit les DEUX clés : des scripts d'utilisateurs sourcent ce fichier et
|
||||
// lisent $JEAN_HOME. L'ancien /etc/default/jean est laissé en place — le
|
||||
// lisent $AJEAN_HOME. L'ancien /etc/default/ajean est laissé en place — le
|
||||
// supprimer casserait ces mêmes scripts, et AjeanHome() sait déjà le lire.
|
||||
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 {
|
||||
@@ -187,7 +187,7 @@ func cmdInstall(args []string) error {
|
||||
}
|
||||
fmt.Printf(" %s %s\n", green("✓"), sudoersPath)
|
||||
|
||||
// 6. chown JEAN_HOME contents to target user
|
||||
// 6. chown AJEAN_HOME contents to target user
|
||||
chown(ajeanHome, u)
|
||||
|
||||
// 7. systemd reload
|
||||
@@ -222,7 +222,7 @@ func cmdUninstall(args []string) error {
|
||||
for _, p := range []string{
|
||||
"/etc/systemd/system/" + svc + ".service",
|
||||
"/etc/sudoers.d/ajean-" + svc,
|
||||
"/etc/default/jean",
|
||||
"/etc/default/ajean",
|
||||
installedExePath(),
|
||||
} {
|
||||
if err := os.Remove(p); err == nil {
|
||||
@@ -231,7 +231,7 @@ func cmdUninstall(args []string) error {
|
||||
}
|
||||
_ = exec.Command("systemctl", "daemon-reload").Run()
|
||||
if !keepData {
|
||||
fmt.Println(dim("(données utilisateur conservées — supprime $JEAN_HOME manuellement si tu veux purger)"))
|
||||
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