devzone 7.1.1 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devcontainer/Dockerfile +14 -14
- package/.devcontainer/ai/host-check.message +12 -12
- package/.devcontainer/ai/host-check.sh +1 -1
- package/.devcontainer/catalog/catalog-watcher.sh +7 -7
- package/.devcontainer/catalog.sh +1 -1
- package/.devcontainer/devzone +2 -14
- package/.devcontainer/devzone-ai.sh +1 -1
- package/.devcontainer/devzone-cluster.sh +1 -2
- package/.devcontainer/devzone-repair.sh +3 -3
- package/.devcontainer/devzone-services.sh +2 -2
- package/.devcontainer/gitlab/demo/.gitlab-ci.yml +1 -1
- package/.devcontainer/help.sh +0 -1
- package/.devcontainer/packages.sh +1 -1
- package/.devcontainer/password.sh +5 -6
- package/.devcontainer/ports.sh +1 -1
- package/.devcontainer/services-admin.sh +2 -2
- package/.devcontainer/workspace-init.sh +0 -7
- package/Makefile +3 -3
- package/README.md +1 -13
- package/bin/SHA256SUMS +6 -6
- package/bin/devzone-darwin-amd64 +0 -0
- package/bin/devzone-darwin-arm64 +0 -0
- package/bin/devzone-linux-amd64 +0 -0
- package/bin/devzone-linux-arm64 +0 -0
- package/bin/devzone-windows-amd64.exe +0 -0
- package/bin/devzone-windows-arm64.exe +0 -0
- package/manage/devzone +3 -16
- package/manage/scripts/ci/check-names.sh +5 -6
- package/manage/scripts/ci/ticket-protocol.txt +7 -0
- package/manage/scripts/ci/versions-tools-plan.sh +1 -1
- package/manage/scripts/devzone-create.sh +4 -4
- package/manage/scripts/devzone-update.sh +18 -22
- package/manage/scripts/workspace/argocd-services.sh +1 -1
- package/manage/scripts/workspace/argocd-workspace.sh +2 -2
- package/manage/scripts/workspace/ports-workspace.sh +5 -5
- package/manage/scripts/workspace/services-workspace.sh +3 -3
- package/manage/scripts/workspace/workspace-update.sh +0 -3
- package/manage/workspace.sh +0 -14
- package/package.json +1 -1
- package/.devcontainer/command-aliases.sh +0 -234
- package/.devcontainer/rename-legacy-files.sh +0 -172
- package/.devcontainer/rename-legacy-ports.sh +0 -119
- package/manage/scripts/ci/check-english.sh +0 -57
|
@@ -35,7 +35,7 @@ update_workstation() {
|
|
|
35
35
|
esac
|
|
36
36
|
done
|
|
37
37
|
if [ ! -d .devcontainer ]; then
|
|
38
|
-
echo "✖
|
|
38
|
+
echo "✖ Run this in a devzone folder (.devcontainer not found here)." >&2
|
|
39
39
|
exit 1
|
|
40
40
|
fi
|
|
41
41
|
|
|
@@ -55,11 +55,11 @@ update_workstation() {
|
|
|
55
55
|
[ -f "$folder/$rel" ] || missing=1
|
|
56
56
|
done <"$package_list"
|
|
57
57
|
if [ "$installed" = "$package" ] && [ -z "$missing" ]; then
|
|
58
|
-
echo "✔ devzone $installed
|
|
59
|
-
echo "
|
|
58
|
+
echo "✔ devzone $installed: already up to date."
|
|
59
|
+
echo "For the latest published version: npx devzone@latest update"
|
|
60
60
|
return 0
|
|
61
61
|
fi
|
|
62
|
-
echo "devzone
|
|
62
|
+
echo "devzone: folder $installed, package $package"
|
|
63
63
|
|
|
64
64
|
# 2. Files modified locally (checksum different from the manifest; without
|
|
65
65
|
# a manifest, different from the one of the package)
|
|
@@ -81,13 +81,13 @@ update_workstation() {
|
|
|
81
81
|
while IFS= read -r rel; do
|
|
82
82
|
[ -n "$rel" ] || continue
|
|
83
83
|
if ! path_allowed "$rel"; then
|
|
84
|
-
echo "devzone
|
|
84
|
+
echo "devzone: manifest: refused path: $rel" >&2
|
|
85
85
|
continue
|
|
86
86
|
fi
|
|
87
87
|
in_list "$package_list" "$rel" && continue
|
|
88
88
|
is_protected "$rel" && continue
|
|
89
89
|
if ! inside_folder "$folder" "$rel"; then
|
|
90
|
-
echo "devzone
|
|
90
|
+
echo "devzone: manifest: refused path: $rel" >&2
|
|
91
91
|
continue
|
|
92
92
|
fi
|
|
93
93
|
printf '%s\n' "$rel" >>"$work/to_remove"
|
|
@@ -106,7 +106,7 @@ update_workstation() {
|
|
|
106
106
|
while IFS= read -r f; do
|
|
107
107
|
rel="${f#"$folder"/}"
|
|
108
108
|
if ! path_allowed "$rel"; then
|
|
109
|
-
echo "devzone
|
|
109
|
+
echo "devzone: manifest: refused path: $rel" >&2
|
|
110
110
|
continue
|
|
111
111
|
fi
|
|
112
112
|
is_protected "$rel" && continue
|
|
@@ -125,13 +125,13 @@ update_workstation() {
|
|
|
125
125
|
mv "$work/to_save.sorted" "$work/to_save"
|
|
126
126
|
|
|
127
127
|
if [ -s "$work/modified" ]; then
|
|
128
|
-
echo "
|
|
128
|
+
echo "Locally modified files:"
|
|
129
129
|
while IFS= read -r rel; do
|
|
130
130
|
printf ' %s\n' "$rel"
|
|
131
131
|
done <"$work/modified"
|
|
132
132
|
if [ -z "$assume_yes" ]; then
|
|
133
133
|
if [ ! -t 0 ]; then
|
|
134
|
-
echo "✖
|
|
134
|
+
echo "✖ Locally modified files: rerun with --yes to replace them (backup in .devzone.backup/)." >&2
|
|
135
135
|
exit 1
|
|
136
136
|
fi
|
|
137
137
|
printf 'Replace these files (backup in .devzone.backup/)? [y/N] ' >&2
|
|
@@ -139,17 +139,13 @@ update_workstation() {
|
|
|
139
139
|
case "$answer" in
|
|
140
140
|
y | Y | yes) ;;
|
|
141
141
|
*)
|
|
142
|
-
echo "
|
|
142
|
+
echo "Aborted: nothing was modified."
|
|
143
143
|
return 1
|
|
144
144
|
;;
|
|
145
145
|
esac
|
|
146
146
|
fi
|
|
147
147
|
fi
|
|
148
148
|
|
|
149
|
-
# Former French names renamed before the backup (#733): the backup folder is
|
|
150
|
-
# .devzone.backup. The script comes from the package, the folder may be old
|
|
151
|
-
DEVZONE_ROOT="$folder" bash "$PAQUET/.devcontainer/rename-legacy-files.sh" || true
|
|
152
|
-
|
|
153
149
|
# 3. Backup of every file replaced or removed
|
|
154
150
|
if [ -s "$work/to_save" ]; then
|
|
155
151
|
base="$folder/.devzone.backup/$(date +%Y%m%d-%H%M%S)"
|
|
@@ -162,7 +158,7 @@ update_workstation() {
|
|
|
162
158
|
while IFS= read -r rel; do
|
|
163
159
|
[ -f "$folder/$rel" ] || continue
|
|
164
160
|
if ! inside_folder "$folder" "$rel"; then
|
|
165
|
-
echo "devzone
|
|
161
|
+
echo "devzone: manifest: refused path: $rel" >&2
|
|
166
162
|
continue
|
|
167
163
|
fi
|
|
168
164
|
mkdir -p "$backup/$(dirname "$rel")"
|
|
@@ -178,13 +174,13 @@ update_workstation() {
|
|
|
178
174
|
while IFS= read -r rel; do
|
|
179
175
|
mkdir -p "$folder/$(dirname "$rel")"
|
|
180
176
|
if ! inside_folder "$folder" "$rel"; then
|
|
181
|
-
echo "devzone
|
|
177
|
+
echo "devzone: manifest: refused path: $rel" >&2
|
|
182
178
|
continue
|
|
183
179
|
fi
|
|
184
180
|
# Never write through a link: the link (not its target) is removed
|
|
185
181
|
if [ -L "$folder/$rel" ]; then
|
|
186
182
|
rm -f -- "$folder/$rel"
|
|
187
|
-
echo "devzone
|
|
183
|
+
echo "devzone: manifest: link replaced: $rel" >&2
|
|
188
184
|
fi
|
|
189
185
|
cp -p "$PAQUET/$rel" "$folder/$rel"
|
|
190
186
|
if [ -x "$PAQUET/$rel" ]; then
|
|
@@ -195,7 +191,7 @@ update_workstation() {
|
|
|
195
191
|
[ -n "$rel" ] || continue
|
|
196
192
|
[ -f "$folder/$rel" ] || continue
|
|
197
193
|
if ! inside_folder "$folder" "$rel"; then
|
|
198
|
-
echo "devzone
|
|
194
|
+
echo "devzone: manifest: refused path: $rel" >&2
|
|
199
195
|
continue
|
|
200
196
|
fi
|
|
201
197
|
# rm does not follow links: only the link is removed, never its target
|
|
@@ -210,18 +206,18 @@ update_workstation() {
|
|
|
210
206
|
|
|
211
207
|
# 6. New manifest, then rebuild offered
|
|
212
208
|
write_manifest "$folder"
|
|
213
|
-
echo "✔ devzone $package
|
|
209
|
+
echo "✔ devzone $package: updated."
|
|
214
210
|
restart_ports_watcher "$folder"
|
|
215
211
|
# the update never changes the workstation mode (#472)
|
|
216
212
|
if [ "$(grep -E '^workspace=' "$folder/.devzone.modules" 2>/dev/null | tail -1)" = "workspace=kubernetes" ]; then
|
|
217
213
|
return 0
|
|
218
214
|
fi
|
|
219
215
|
if [ -n "$no_rebuild" ]; then
|
|
220
|
-
echo "
|
|
216
|
+
echo "Rebuild not started (--no-rebuild)."
|
|
221
217
|
return 0
|
|
222
218
|
fi
|
|
223
219
|
if [ ! -t 0 ]; then
|
|
224
|
-
echo "
|
|
220
|
+
echo "Rebuild: make -C $folder rebuild (run in a terminal)"
|
|
225
221
|
return 0
|
|
226
222
|
fi
|
|
227
223
|
printf 'Rebuild the container now? [y/N] ' >&2
|
|
@@ -229,7 +225,7 @@ update_workstation() {
|
|
|
229
225
|
case "$answer" in
|
|
230
226
|
y | Y | yes) ;;
|
|
231
227
|
*)
|
|
232
|
-
echo "
|
|
228
|
+
echo "Rebuild not started: make -C $folder rebuild"
|
|
233
229
|
return 0
|
|
234
230
|
;;
|
|
235
231
|
esac
|
|
@@ -155,7 +155,7 @@ argocd_toggle() {
|
|
|
155
155
|
# devzone workspace argocd status | app …
|
|
156
156
|
argocd_cmd() {
|
|
157
157
|
case "${1:-status}" in
|
|
158
|
-
status
|
|
158
|
+
status) argocd_status ;;
|
|
159
159
|
init)
|
|
160
160
|
gitops_init "${@:2}" || return $?
|
|
161
161
|
if argocd_installed; then gitops_root; fi
|
|
@@ -131,8 +131,8 @@ argocd_save_admin_password() {
|
|
|
131
131
|
|
|
132
132
|
# .password of the workstation regenerated from workspace/.*/ (password.sh of the package)
|
|
133
133
|
argocd_passwords_refresh() {
|
|
134
|
-
DEVZONE_ROOT="$PWD" bash "$RACINE/.devcontainer/password.sh"
|
|
135
|
-
echo "⚠ .password not updated (bash .devcontainer/password.sh
|
|
134
|
+
DEVZONE_ROOT="$PWD" bash "$RACINE/.devcontainer/password.sh" regenerate 2>/dev/null ||
|
|
135
|
+
echo "⚠ .password not updated (bash .devcontainer/password.sh regenerate)" >&2
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
# Installs Argo CD (pinned chart and values), idempotent (upgrade --install)
|
|
@@ -213,9 +213,9 @@ ports_status() {
|
|
|
213
213
|
# Subcommand "devzone workspace ports [start|stop|status]" (default: status).
|
|
214
214
|
ports() {
|
|
215
215
|
case "${1:-status}" in
|
|
216
|
-
start
|
|
217
|
-
stop
|
|
218
|
-
status
|
|
216
|
+
start) ports_start ;;
|
|
217
|
+
stop) ports_stop ;;
|
|
218
|
+
status) ports_status ;;
|
|
219
219
|
*) echo "✖ devzone workspace ports start|stop|status" >&2; return 1 ;;
|
|
220
220
|
esac
|
|
221
221
|
}
|
|
@@ -229,7 +229,7 @@ ports_etat() { ports_status "$@"; }
|
|
|
229
229
|
if [ "${BASH_SOURCE[0]}" = "$0" ]; then
|
|
230
230
|
pw_guard quiet || exit 2
|
|
231
231
|
case "${1:-}" in
|
|
232
|
-
loop
|
|
233
|
-
round
|
|
232
|
+
loop) pw_loop ;;
|
|
233
|
+
round) pw_round ;;
|
|
234
234
|
esac
|
|
235
235
|
fi
|
|
@@ -173,8 +173,8 @@ services_status() {
|
|
|
173
173
|
services() {
|
|
174
174
|
local sub="${1:-}"
|
|
175
175
|
case "$sub" in
|
|
176
|
-
enable
|
|
177
|
-
disable
|
|
176
|
+
enable) services_run enable "${2:-}" "${@:3}" ;;
|
|
177
|
+
disable) services_run disable "${2:-}" "${@:3}" ;;
|
|
178
178
|
# The data of gitlab (group, demo project, dev user, runner) seeded
|
|
179
179
|
# again, in the pod (#538): the only seed of the services
|
|
180
180
|
seed)
|
|
@@ -184,7 +184,7 @@ services() {
|
|
|
184
184
|
fi
|
|
185
185
|
services_run seed gitlab
|
|
186
186
|
;;
|
|
187
|
-
status |
|
|
187
|
+
status | '') services_status ;;
|
|
188
188
|
*)
|
|
189
189
|
echo "✖ unknown subcommand: $sub ($(services_usage))" >&2
|
|
190
190
|
return 1
|
|
@@ -96,9 +96,6 @@ update_workspace() {
|
|
|
96
96
|
;;
|
|
97
97
|
esac
|
|
98
98
|
fi
|
|
99
|
-
# Former French names renamed once the update is confirmed (#733); the
|
|
100
|
-
# script comes from the package, the devzone folder is the current one
|
|
101
|
-
DEVZONE_ROOT="$PWD" bash "$ROOT/.devcontainer/rename-legacy-files.sh" || true
|
|
102
99
|
# Same path as workspace start, at the release: Argo CD revision and image tag
|
|
103
100
|
export DEVZONE_ARGOCD_REVISION="v$version"
|
|
104
101
|
workspace_deploy "$IMAGE_REPO" "$version" ""
|
package/manage/workspace.sh
CHANGED
|
@@ -141,20 +141,6 @@ shell_workspace() {
|
|
|
141
141
|
# shellcheck source=manage/scripts/workspace/workspace-egress.sh
|
|
142
142
|
. "$HERE/scripts/workspace/workspace-egress.sh"
|
|
143
143
|
|
|
144
|
-
# Renamed names (#695): an old French name is refused before anything runs, with
|
|
145
|
-
# its English name (« devzone workspace start »). A copied devzone may miss the
|
|
146
|
-
# aliases file: then no check.
|
|
147
|
-
# shellcheck source=../.devcontainer/command-aliases.sh
|
|
148
|
-
# shellcheck disable=SC1091
|
|
149
|
-
if [ -f "$ROOT/.devcontainer/command-aliases.sh" ]; then
|
|
150
|
-
. "$ROOT/.devcontainer/command-aliases.sh"
|
|
151
|
-
reject_renamed workspace "$@" || exit 1
|
|
152
|
-
if [ "${1:-}" = ports ] && [ "$#" -gt 1 ]; then
|
|
153
|
-
reject_renamed "workspace ports" "${@:2}" || exit 1
|
|
154
|
-
fi
|
|
155
|
-
fi
|
|
156
|
-
|
|
157
|
-
|
|
158
144
|
case "${1:-}" in
|
|
159
145
|
start) start_workspace "${@:2}" ;;
|
|
160
146
|
update) update_workspace "${@:2}" ;;
|
package/package.json
CHANGED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Renamed names of the devzone CLI (#695): the French names of the commands,
|
|
3
|
-
# subcommands and options are no longer accepted, they are refused. Each old
|
|
4
|
-
# name prints « ✖ « old » was renamed: devzone new » on stderr, exits with
|
|
5
|
-
# code 1 and does nothing (no folder is created: « devzone stop » creates ./stop,
|
|
6
|
-
# « devzone mettre-a-jour » must not create ./mettre-a-jour).
|
|
7
|
-
#
|
|
8
|
-
# renamed_command <name> : English name of a renamed command, or 1
|
|
9
|
-
# renamed_subcommand <command> <name> : English name of a renamed subcommand, or 1
|
|
10
|
-
# renamed_option <option> : English name of a renamed option, or 1
|
|
11
|
-
# renamed_module <name> : new name of a renamed module (argument of
|
|
12
|
-
# enable, disable, is-enabled, apply), or 1
|
|
13
|
-
# reject_renamed <command> <args...> : refuses the first renamed name of a call
|
|
14
|
-
# (command, first word that is not an
|
|
15
|
-
# option, then each option); 0 if none
|
|
16
|
-
#
|
|
17
|
-
# bash 3.2 (macOS): case only, no associative array.
|
|
18
|
-
|
|
19
|
-
# English name of a renamed command, or return 1.
|
|
20
|
-
renamed_command() {
|
|
21
|
-
case "${1:-}" in
|
|
22
|
-
actif) echo is-enabled ;;
|
|
23
|
-
activer) echo enable ;;
|
|
24
|
-
desactiver) echo disable ;;
|
|
25
|
-
ia) echo ai ;;
|
|
26
|
-
aide) echo help ;;
|
|
27
|
-
appliquer) echo apply ;;
|
|
28
|
-
catalogue) echo catalog ;;
|
|
29
|
-
demarrer) echo start ;;
|
|
30
|
-
arreter) echo stop ;;
|
|
31
|
-
etat) echo status ;;
|
|
32
|
-
mots-de-passe) echo passwords ;;
|
|
33
|
-
paquets) echo packages ;;
|
|
34
|
-
plateforme) echo platform ;;
|
|
35
|
-
reparer) echo repair ;;
|
|
36
|
-
utiliser) echo use ;;
|
|
37
|
-
mettre-a-jour) echo update ;;
|
|
38
|
-
desinstaller) echo uninstall ;;
|
|
39
|
-
copier-vers) echo copy-to ;;
|
|
40
|
-
copier-depuis) echo copy-from ;;
|
|
41
|
-
*) return 1 ;;
|
|
42
|
-
esac
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
# English name of a renamed subcommand of <command> (English name), or return 1.
|
|
46
|
-
renamed_subcommand() {
|
|
47
|
-
local command="${1:-}" word="${2:-}"
|
|
48
|
-
case "$command" in
|
|
49
|
-
postgres | mysql)
|
|
50
|
-
case "$word" in
|
|
51
|
-
creer) echo create ;;
|
|
52
|
-
liste) echo list ;;
|
|
53
|
-
supprimer) echo delete ;;
|
|
54
|
-
supprimer-donnees) echo delete-data ;;
|
|
55
|
-
etat) echo status ;;
|
|
56
|
-
installer) echo install ;;
|
|
57
|
-
desinstaller) echo uninstall ;;
|
|
58
|
-
relais-lancer) echo relay-start ;;
|
|
59
|
-
relais-arreter) echo relay-stop ;;
|
|
60
|
-
autoriser) echo authorize ;;
|
|
61
|
-
interdire) echo forbid ;;
|
|
62
|
-
*) return 1 ;;
|
|
63
|
-
esac
|
|
64
|
-
;;
|
|
65
|
-
gitlab)
|
|
66
|
-
case "$word" in
|
|
67
|
-
migrer) echo migrate ;;
|
|
68
|
-
nouveau-mdp) echo new-password ;;
|
|
69
|
-
etat) echo status ;;
|
|
70
|
-
installer) echo install ;;
|
|
71
|
-
desinstaller) echo uninstall ;;
|
|
72
|
-
relais-lancer) echo relay-start ;;
|
|
73
|
-
relais-arreter) echo relay-stop ;;
|
|
74
|
-
relais-etat) echo relay-status ;;
|
|
75
|
-
*) return 1 ;;
|
|
76
|
-
esac
|
|
77
|
-
;;
|
|
78
|
-
argocd)
|
|
79
|
-
case "$word" in
|
|
80
|
-
etat) echo status ;;
|
|
81
|
-
installer) echo install ;;
|
|
82
|
-
desinstaller) echo uninstall ;;
|
|
83
|
-
relais-lancer) echo relay-start ;;
|
|
84
|
-
relais-arreter) echo relay-stop ;;
|
|
85
|
-
*) return 1 ;;
|
|
86
|
-
esac
|
|
87
|
-
;;
|
|
88
|
-
packages)
|
|
89
|
-
case "$word" in
|
|
90
|
-
ajouter) echo add ;;
|
|
91
|
-
retirer) echo remove ;;
|
|
92
|
-
appliquer) echo apply ;;
|
|
93
|
-
lister) echo list ;;
|
|
94
|
-
*) return 1 ;;
|
|
95
|
-
esac
|
|
96
|
-
;;
|
|
97
|
-
catalog)
|
|
98
|
-
case "$word" in
|
|
99
|
-
synchroniser) echo sync ;;
|
|
100
|
-
appliquer) echo apply ;;
|
|
101
|
-
lister) echo list ;;
|
|
102
|
-
desinstaller) echo remove ;;
|
|
103
|
-
*) return 1 ;;
|
|
104
|
-
esac
|
|
105
|
-
;;
|
|
106
|
-
port)
|
|
107
|
-
case "$word" in
|
|
108
|
-
ouvrir) echo open ;;
|
|
109
|
-
fermer) echo close ;;
|
|
110
|
-
liste) echo list ;;
|
|
111
|
-
relancer) echo restart ;;
|
|
112
|
-
exclure) echo exclude ;;
|
|
113
|
-
inclure) echo include ;;
|
|
114
|
-
*) return 1 ;;
|
|
115
|
-
esac
|
|
116
|
-
;;
|
|
117
|
-
workspace)
|
|
118
|
-
case "$word" in
|
|
119
|
-
demarrer) echo start ;;
|
|
120
|
-
mettre-a-jour) echo update ;;
|
|
121
|
-
arreter) echo stop ;;
|
|
122
|
-
etat) echo status ;;
|
|
123
|
-
copier-vers) echo copy-to ;;
|
|
124
|
-
copier-depuis) echo copy-from ;;
|
|
125
|
-
aide) echo help ;;
|
|
126
|
-
*) return 1 ;;
|
|
127
|
-
esac
|
|
128
|
-
;;
|
|
129
|
-
"workspace ports")
|
|
130
|
-
case "$word" in
|
|
131
|
-
demarrer) echo start ;;
|
|
132
|
-
arreter) echo stop ;;
|
|
133
|
-
etat) echo status ;;
|
|
134
|
-
*) return 1 ;;
|
|
135
|
-
esac
|
|
136
|
-
;;
|
|
137
|
-
agent)
|
|
138
|
-
case "$word" in
|
|
139
|
-
etat) echo state ;;
|
|
140
|
-
liberer) echo release ;;
|
|
141
|
-
aide) echo help ;;
|
|
142
|
-
*) return 1 ;;
|
|
143
|
-
esac
|
|
144
|
-
;;
|
|
145
|
-
*) return 1 ;;
|
|
146
|
-
esac
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
# English name of a renamed option, or return 1.
|
|
150
|
-
renamed_option() {
|
|
151
|
-
case "${1:-}" in
|
|
152
|
-
--fermer) echo --close ;;
|
|
153
|
-
--supprimer) echo --delete ;;
|
|
154
|
-
--nouveau-mdp) echo --new-password ;;
|
|
155
|
-
--oui) echo --yes ;;
|
|
156
|
-
--confirmer) echo --confirm ;;
|
|
157
|
-
--contexte) echo --context ;;
|
|
158
|
-
--modele) echo --model ;;
|
|
159
|
-
--tous) echo --all ;;
|
|
160
|
-
--sans-reconstruire) echo --no-rebuild ;;
|
|
161
|
-
*) return 1 ;;
|
|
162
|
-
esac
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
# New name of a renamed module, or return 1. Modules are not commands: the
|
|
166
|
-
# message names the module only (« ia » was renamed: ai).
|
|
167
|
-
renamed_module() {
|
|
168
|
-
case "${1:-}" in
|
|
169
|
-
ia) echo ai ;;
|
|
170
|
-
*) return 1 ;;
|
|
171
|
-
esac
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
# Names removed in 3.0 (#735): refused with the same exit code, with a notice
|
|
175
|
-
# that names no former feature and never creates a folder.
|
|
176
|
-
removed_notice() {
|
|
177
|
-
echo "✖ this command or option was removed in devzone 3.0 (see manage/docs/migrating-to-3.md)" >&2
|
|
178
|
-
return 1
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
# reject_renamed <command> <args...> : checks the command itself (top level),
|
|
182
|
-
# the first word of <args> that is not an option (subcommand), then every
|
|
183
|
-
# option. The first renamed name prints its message on stderr and returns 1;
|
|
184
|
-
# nothing is run. Returns 0 when no name is renamed.
|
|
185
|
-
reject_renamed() {
|
|
186
|
-
local command="${1:-}" word new
|
|
187
|
-
if [ "$#" -gt 0 ]; then shift; fi
|
|
188
|
-
case "$command" in
|
|
189
|
-
migrer | revenir | nettoyer-docker) removed_notice; return 1 ;;
|
|
190
|
-
esac
|
|
191
|
-
if new="$(renamed_command "$command")"; then
|
|
192
|
-
# these commands only exist under « devzone workspace »
|
|
193
|
-
case "$command" in
|
|
194
|
-
copier-vers | copier-depuis) new="workspace $new" ;;
|
|
195
|
-
esac
|
|
196
|
-
printf '✖ « %s » was renamed: devzone %s\n' "$command" "$new" >&2
|
|
197
|
-
return 1
|
|
198
|
-
fi
|
|
199
|
-
for word in "$@"; do
|
|
200
|
-
case "$word" in
|
|
201
|
-
-*) continue ;;
|
|
202
|
-
esac
|
|
203
|
-
if [ "$command" = workspace ]; then
|
|
204
|
-
case "$word" in
|
|
205
|
-
migrer | revenir | nettoyer-docker) removed_notice; return 1 ;;
|
|
206
|
-
esac
|
|
207
|
-
fi
|
|
208
|
-
case "$command" in
|
|
209
|
-
enable | disable | is-enabled | apply)
|
|
210
|
-
if new="$(renamed_module "$word")"; then
|
|
211
|
-
printf '✖ « %s » was renamed: %s\n' "$word" "$new" >&2
|
|
212
|
-
return 1
|
|
213
|
-
fi
|
|
214
|
-
;;
|
|
215
|
-
esac
|
|
216
|
-
if new="$(renamed_subcommand "$command" "$word")"; then
|
|
217
|
-
printf '✖ « %s » was renamed: devzone %s %s\n' "$word" "$command" "$new" >&2
|
|
218
|
-
return 1
|
|
219
|
-
fi
|
|
220
|
-
break
|
|
221
|
-
done
|
|
222
|
-
for word in "$@"; do
|
|
223
|
-
case "$word" in
|
|
224
|
-
--rapatrier) removed_notice; return 1 ;;
|
|
225
|
-
-*)
|
|
226
|
-
if new="$(renamed_option "$word")"; then
|
|
227
|
-
printf '✖ « %s » was renamed: %s\n' "$word" "$new" >&2
|
|
228
|
-
return 1
|
|
229
|
-
fi
|
|
230
|
-
;;
|
|
231
|
-
esac
|
|
232
|
-
done
|
|
233
|
-
return 0
|
|
234
|
-
}
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# shellcheck shell=bash
|
|
3
|
-
# Renames the files and folders that devzone wrote under their former French
|
|
4
|
-
# names to their English names (#733, lot 3), and the state keys plateforme= to
|
|
5
|
-
# platform= (lot 4) and ia= to ai= (#774, lot 3). #774, lot 4 adds the folders of the
|
|
6
|
-
# port watcher, the state backup, the AI measures file and the packages marker.
|
|
7
|
-
# #774, lot 5 adds the ports folder cap, the key ports_exclus=, the state files of
|
|
8
|
-
# the port automation, the locks of the agent, of the catalog watcher and of the
|
|
9
|
-
# state (rename-legacy-ports.sh).
|
|
10
|
-
# Called by the pod startup, by the workspace init, and on the
|
|
11
|
-
# workstation by devzone update and workspace update.
|
|
12
|
-
# Idempotent: a name is renamed only when the old one exists and the new one
|
|
13
|
-
# does not, so a second run does nothing. Two folders with both names are
|
|
14
|
-
# merged, the old one emptied and removed. An existing file is never
|
|
15
|
-
# overwritten. One line per rename or merge on stdout, exit 0. No alias of the
|
|
16
|
-
# old names is kept after this migration. bash 3.2 (macOS).
|
|
17
|
-
# DEVZONE_ROOT devzone folder (default: the parent of this .devcontainer)
|
|
18
|
-
# DEVZONE_TMP_DIR temporary folder (default: /tmp), set by the tests
|
|
19
|
-
# DEVZONE_PORTS_AUTO_DIR, DEVZONE_AGENT_STATE state folders of the port automation
|
|
20
|
-
# and of the agent (defaults: devzone-ports-auto of the temporary folder, ~/.local/state/oc-lancer)
|
|
21
|
-
|
|
22
|
-
ROOT="${DEVZONE_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}"
|
|
23
|
-
TMP_DIR="${DEVZONE_TMP_DIR:-/tmp}"
|
|
24
|
-
|
|
25
|
-
# is_real_dir PATH: true for a folder that is not a symbolic link
|
|
26
|
-
is_real_dir() {
|
|
27
|
-
[ -d "$1" ] && [ ! -L "$1" ]
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
# merge_legacy OLD NEW: both are folders. Each entry of OLD that NEW does not
|
|
31
|
-
# have is moved into NEW; an entry present on both sides is never overwritten,
|
|
32
|
-
# it stays in OLD and a message on stderr names it. OLD is removed (rmdir) only
|
|
33
|
-
# when it is left empty, and then the merge is announced on stdout. Hidden
|
|
34
|
-
# entries are merged too. The shell options live in a subshell, so they do not
|
|
35
|
-
# reach the other migrations.
|
|
36
|
-
merge_legacy() {
|
|
37
|
-
local old="$1" new="$2"
|
|
38
|
-
(
|
|
39
|
-
shopt -s dotglob nullglob
|
|
40
|
-
local entry target
|
|
41
|
-
for entry in "$old"/*; do
|
|
42
|
-
target="$new/${entry##*/}"
|
|
43
|
-
if [ -e "$target" ] || [ -L "$target" ]; then
|
|
44
|
-
echo "devzone : $entry kept: $target already exists" >&2
|
|
45
|
-
elif ! mv -- "$entry" "$target"; then
|
|
46
|
-
echo "devzone : $entry not merged into $target" >&2
|
|
47
|
-
fi
|
|
48
|
-
done
|
|
49
|
-
if rmdir -- "$old" 2>/dev/null; then
|
|
50
|
-
echo "devzone : $old merged into $new"
|
|
51
|
-
fi
|
|
52
|
-
)
|
|
53
|
-
return 0
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
# rename_legacy OLD NEW: moves OLD to NEW when OLD exists and NEW does not.
|
|
57
|
-
# When both are folders, they are merged (see merge_legacy). Any other conflict
|
|
58
|
-
# is reported on stderr and both names are left as they are.
|
|
59
|
-
rename_legacy() {
|
|
60
|
-
local old="$1" new="$2"
|
|
61
|
-
if [ ! -e "$old" ] && [ ! -L "$old" ]; then
|
|
62
|
-
return 0
|
|
63
|
-
fi
|
|
64
|
-
if [ -e "$new" ] || [ -L "$new" ]; then
|
|
65
|
-
if is_real_dir "$old" && is_real_dir "$new"; then
|
|
66
|
-
merge_legacy "$old" "$new"
|
|
67
|
-
else
|
|
68
|
-
echo "devzone : $old kept, $new already exists" >&2
|
|
69
|
-
fi
|
|
70
|
-
return 0
|
|
71
|
-
fi
|
|
72
|
-
if mv -- "$old" "$new"; then
|
|
73
|
-
echo "devzone : $old renamed to $new"
|
|
74
|
-
else
|
|
75
|
-
echo "devzone : $old not renamed to $new" >&2
|
|
76
|
-
fi
|
|
77
|
-
return 0
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
# Failure markers of the modules: .devzone.modules-echec-<module> becomes
|
|
81
|
-
# .devzone.modules-failed-<module>, one rename per marker found
|
|
82
|
-
migrate_markers() {
|
|
83
|
-
local f base
|
|
84
|
-
for f in "$ROOT"/.devzone.modules-echec-*; do
|
|
85
|
-
if [ ! -e "$f" ] && [ ! -L "$f" ]; then
|
|
86
|
-
continue
|
|
87
|
-
fi
|
|
88
|
-
base="${f##*/}"
|
|
89
|
-
rename_legacy "$f" "$ROOT/.devzone.modules-failed-${base#.devzone.modules-echec-}"
|
|
90
|
-
done
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
# Folders and files of the devzone folder
|
|
94
|
-
migrate_root() {
|
|
95
|
-
rename_legacy "$ROOT/.devzone.paquets" "$ROOT/.devzone.packages"
|
|
96
|
-
rename_legacy "$ROOT/.devzone.sauvegarde" "$ROOT/.devzone.backup"
|
|
97
|
-
rename_legacy "$ROOT/.devzone.ports-workspace" "$ROOT/.devzone.workspace-ports"
|
|
98
|
-
rename_legacy "$ROOT/.devzone.etat" "$ROOT/.devzone.state"
|
|
99
|
-
rename_legacy "$ROOT/.devzone.catalogue-veilleur" "$ROOT/.devzone.catalog-watcher"
|
|
100
|
-
migrate_markers
|
|
101
|
-
# Failure marker of the AI module, renamed with it (#774)
|
|
102
|
-
rename_legacy "$ROOT/.devzone.modules-failed-ia" "$ROOT/.devzone.modules-failed-ai"
|
|
103
|
-
# Backup of the previous state (#774, lot 4)
|
|
104
|
-
rename_legacy "$ROOT/.devzone.modules.prec" "$ROOT/.devzone.modules.prev"
|
|
105
|
-
migrate_ports
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
# Port watcher, locks and state files of the port automation (#774, lot 5)
|
|
109
|
-
# shellcheck source=SCRIPTDIR/rename-legacy-ports.sh
|
|
110
|
-
# shellcheck disable=SC1091
|
|
111
|
-
. "$(dirname "$0")/rename-legacy-ports.sh"
|
|
112
|
-
|
|
113
|
-
# Fingerprint of the devzone skill, next to its SKILL.md in each assistant folder
|
|
114
|
-
migrate_skills() {
|
|
115
|
-
local d
|
|
116
|
-
[ -n "${HOME:-}" ] || return 0
|
|
117
|
-
for d in "$HOME/.claude/skills/devzone" "$HOME/.config/opencode/skills/devzone"; do
|
|
118
|
-
rename_legacy "$d/.devzone-empreinte" "$d/.devzone-fingerprint"
|
|
119
|
-
done
|
|
120
|
-
# Measures of the host models (#774, lot 4); DEVZONE_AI_MEASURES points to
|
|
121
|
-
# a file of the user, never renamed
|
|
122
|
-
rename_legacy "$HOME/.config/devzone/ia-mesures.json" "$HOME/.config/devzone/ai-measures.json"
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
# Markers written in the temporary folder by the packages check
|
|
126
|
-
migrate_tmp() {
|
|
127
|
-
rename_legacy "$TMP_DIR/devzone-paquets.echec" "$TMP_DIR/devzone-packages.failed"
|
|
128
|
-
rename_legacy "$TMP_DIR/devzone-paquets.maj" "$TMP_DIR/devzone-packages.updated"
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
# Key of the state file: the line <old>=<v> becomes <new>=<v>. When a <new>=
|
|
132
|
-
# line is already there, only the old line goes. The file is rewritten in a
|
|
133
|
-
# temporary file, then moved over it; the other lines are copied as they are.
|
|
134
|
-
# A file without the old key is left alone.
|
|
135
|
-
migrate_state_key() {
|
|
136
|
-
local old="$1" new="$2"
|
|
137
|
-
local f="$ROOT/.devzone.modules" tmp="$ROOT/.devzone.modules.tmp.$$"
|
|
138
|
-
[ -f "$f" ] || return 0
|
|
139
|
-
grep -q "^$old=" "$f" || return 0
|
|
140
|
-
if grep -q "^$new=" "$f"; then
|
|
141
|
-
sed "/^$old=/d" "$f" >"$tmp"
|
|
142
|
-
else
|
|
143
|
-
sed "s/^$old=/$new=/" "$f" >"$tmp"
|
|
144
|
-
fi || {
|
|
145
|
-
rm -f "$tmp"
|
|
146
|
-
echo "devzone : $old= not renamed to $new=" >&2
|
|
147
|
-
return 0
|
|
148
|
-
}
|
|
149
|
-
if mv -- "$tmp" "$f"; then
|
|
150
|
-
echo "devzone : $old= renamed to $new="
|
|
151
|
-
else
|
|
152
|
-
rm -f "$tmp"
|
|
153
|
-
echo "devzone : $old= not renamed to $new=" >&2
|
|
154
|
-
fi
|
|
155
|
-
return 0
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
# Keys of the state file: plateforme= (#733, lot 4), ia= (#774, lot 3), ports_exclus= (#774, lot 5)
|
|
159
|
-
migrate_state_keys() {
|
|
160
|
-
migrate_state_key plateforme platform
|
|
161
|
-
migrate_state_key ia ai
|
|
162
|
-
migrate_state_key ports_exclus excluded_ports
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
migrate_root
|
|
166
|
-
migrate_skills
|
|
167
|
-
migrate_tmp
|
|
168
|
-
migrate_ports_auto
|
|
169
|
-
migrate_agent_locks
|
|
170
|
-
migrate_state_lock
|
|
171
|
-
migrate_state_keys
|
|
172
|
-
exit 0
|