Skip to content

Commit fff11f5

Browse files
committed
refact: renamed partition to slot
1 parent d65d569 commit fff11f5

17 files changed

Lines changed: 77 additions & 82 deletions

‎create-lxc-image.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -x
44
set -o pipefail
55

6-
PARTITION="A"
6+
SLOT="A"
77

88
raise() {
99
echo "Error: $*" >&2
@@ -73,7 +73,7 @@ docker run -it -d \
7373
--restart=always \
7474
--name "${CONTAINER_NAME}" \
7575
"${IMAGE_VERSION}" || raise "Failed to run container"
76-
docker exec "${CONTAINER_NAME}" /usr/local/cuos/first-run.sh "${PARTITION}" "${IMAGE_VERSION}" "${NEW_DIGEST}" \
76+
docker exec "${CONTAINER_NAME}" /usr/local/cuos/first-run.sh "${SLOT}" "${IMAGE_VERSION}" "${NEW_DIGEST}" \
7777
|| raise "Failed to run first-run script in container"
7878

7979
docker cp "${CONFIG_PATH}" "${CONTAINER_NAME}:/data/system_A.json" \

‎docs/architecture.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Core building blocks:
2222
| Update Layer | Updater image (`updater_image`) | Prepare new subvolume + boot switch, digest checks |
2323
| Persistence | BTRFS subvolumes `@os`, `@data`, `@swap` | Separate replaceable system from stable data |
2424
| Config files | `/system.json`, `/system_next.json` | Active vs staged (rollback) configuration |
25-
| Status files | `/data/state.json`, `/etc/partition_mode` | Runtime state + active slot indicator |
25+
| Status files | `/data/state.json`, `/etc/active_slot` | Runtime state + active slot indicator |
2626

2727
---
2828

@@ -32,7 +32,7 @@ Core building blocks:
3232
|------|---------|
3333
| `/usr/local/cuos/` | CuOS scripts (install, update, API, init) |
3434
| `/etc/image` | Current system image reference |
35-
| `/etc/partition_mode` | Logical slot (A/B) |
35+
| `/etc/active_slot` | Logical slot (A/B) |
3636
| `/system.json` | Active configuration |
3737
| `/system_next.json` | Staging / rollback configuration |
3838
| `/data/` | Persistent data (logs, docker, state) |

‎docs/common/cuos-app-init.md‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,9 @@ Its value replaces the default Docker run argument block (still augmented with s
4343
Default:
4444

4545
```shell
46-
--device /dev/tty7 \
47-
--network host \
4846
--volume /var/run/docker.sock:/var/run/docker.sock \
4947
--volume /root/.docker/config.json:/root/.docker/config.json:ro \
5048
--volume /system.json:/system.json:ro \
51-
--volume /etc/partition_mode:/etc/partition_mode:ro \
5249
--volume /var/run/cuos.sock:/var/run/cuos.sock \
5350
--volume /usr/local/share/ca-certificates/custom:/usr/local/share/ca-certificates/custom:ro
5451
```
@@ -60,6 +57,7 @@ Suggestions for more parameters:
6057
--user myuser:mygroup \
6158
--read-only \
6259
--tmpfs /etc/ssl/certs:rw,noexec,nosuid,size=16m
60+
--tmpfs /tmp:rw,size=64m
6361
```
6462

6563
### Entrypoint

‎docs/common/glossary.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Canonical terminology used across the CuOS project. Use these precise forms in d
2323
| State File | `/data/state.json` persisted state metadata | Mutated by core scripts |
2424
| Config File | `/system.json` active configuration | Source of truth after merges/patches |
2525
| Next Config File | `/system_next.json` rollback / staging config | Swapped during updates |
26-
| Partition Mode File | `/etc/partition_mode` indicating active slot name | Used by update & rollback logic |
26+
| Active Slot File | `/etc/active_slot` indicating active slot name | Used by update & rollback logic |
2727
| Trigger File | `/data/run-update` forces app container refresh | Created by API patch/update logic |
2828
| API Socket | `/var/run/cuos.sock` UNIX domain socket for commands | JSON line based protocol |
2929
| Resources Command | `cuos resources` JSON system metrics | CPU / memory / disk / network summary |
@@ -56,7 +56,7 @@ Canonical terminology used across the CuOS project. Use these precise forms in d
5656
| `/data/` | Persistent root (logs, docker, state) |
5757
| `/data/log/` | Journald persistent logs (via symlink) |
5858
| `/etc/image` | Current active system image reference string |
59-
| `/etc/partition_mode` | Current active slot indicator (logical A/B) |
59+
| `/etc/active_slot` | Current active slot indicator (logical A/B) |
6060
| `/var/run/cuos.sock` | API communication socket |
6161
| `/usr/local/cuos/` | Core CuOS scripts and helpers |
6262

‎docs/common/update-process.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Rollback actions:
136136
| `/system.json` | Active configuration |
137137
| `/system_next.json` | Staging / rollback source |
138138
| `/etc/image` | Active OS image label |
139-
| `/etc/partition_mode` | Active slot indicator |
139+
| `/etc/active_slot` | Active slot indicator, A or B |
140140
| `/data/run-update` | App restart trigger |
141141
| `/data/state.json` | Runtime state |
142142

‎docs/variants/variant1.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A minimal CuOS-based system consists of:
1111

1212
Key Features:
1313
- Minimal OS based on Debian
14-
- A/B partition scheme for safe updates
14+
- A/B slot scheme for safe updates
1515
- BTRFS filesystem for snapshots
1616
- Full systemd integration
1717
- Network configuration support
@@ -178,15 +178,15 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
178178

179179
### Update Mechanism
180180

181-
The update system uses an A/B partition scheme for safe system updates. This allows for:
181+
The update system uses an A/B slot scheme for safe system updates. This allows for:
182182
- Low-downtime updates
183183
- Automatic rollback on failure
184184
- Verified boot process
185185

186186
#### Update Process
187187

188-
1. System determines current active partition (A or B)
189-
2. Downloads new image to inactive partition
188+
1. System determines current active slot (A or B)
189+
2. Downloads new image to inactive slot
190190
3. Updates boot configuration
191191
4. Reboots into new system
192192
5. Verifies boot success or rolls back
@@ -203,12 +203,12 @@ docker run \
203203
-v /root/.docker/config.json:/root/.docker/config.json:ro \
204204
-v /etc/image:/etc/image:ro \
205205
-e "TARGET_DEVICE=${TARGET_DEVICE}" \
206-
ghcr.io/cuos-dev/cuos-updater:latest "${PARTITION}" "${IMAGE_VERSION}" "${IMAGE_DIGEST}"
206+
ghcr.io/cuos-dev/cuos-updater:latest "${SLOT}" "${IMAGE_VERSION}" "${IMAGE_DIGEST}"
207207
```
208208

209209
Parameters:
210210
- **TARGET_DEVICE**: Block device to update (e.g., `/dev/sda`)
211-
- **PARTITION**: Current active partition ("A" or "B")
211+
- **SLOT**: Current active slot ("A" or "B")
212212
- **IMAGE_VERSION**: Full image reference to install
213213
- **IMAGE_DIGEST**: SHA256 digest for verification (optional)
214214

@@ -231,4 +231,4 @@ Parameters:
231231

232232
- Learn about [creating custom update policies](../common/update-system.md)
233233
- Explore [advanced boot configurations](../common/boot-config.md)
234-
- See how to [customize the installation process](../common/installation-media.md)
234+
- See how to [customize the installation process](../common/installation-media.md)

‎docs/variants/variant2.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ A minimal CuOS-based system consists of:
1313

1414
Key Features:
1515
- Minimal OS based on Debian
16-
- A/B partition scheme for safe updates
16+
- A/B slot scheme for safe updates
1717
- BTRFS filesystem for snapshots
1818
- Full systemd integration
1919
- Network configuration support
@@ -226,4 +226,4 @@ See [Building CuOS Images](../common/building-images.md)
226226

227227
- Learn about [advanced API usage](../common/api-reference.md)
228228
- Explore [system monitoring](../common/monitoring.md)
229-
- Set up [custom update policies](../common/update-system.md)
229+
- Set up [custom update policies](../common/update-system.md)

‎image-factory/create_image.sh‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ OS_DIGEST="$(jq -r --arg arch "${OS_ARCH}" '.[$arch+"_image_digest"] // .os_imag
8484

8585
if [[ "${OS_ARCH}" == "lxc" ]]; then
8686
IMAGE="${IMAGE/img/tar.gz}"
87-
PARTITION="A"
87+
SLOT="A"
8888

8989
docker image pull "${OS_IMAGE}" || raise "Faild to fetch image"
9090
IMAGE_DIGEST="$(docker inspect --format='{{index .RepoDigests 0}}' "${OS_IMAGE}" 2>/dev/null | cut -d '@' -f 2)"
@@ -98,7 +98,7 @@ if [[ "${OS_ARCH}" == "lxc" ]]; then
9898
--pull=never \
9999
--name "${CONTAINER_NAME}" \
100100
"${OS_IMAGE}" || raise "Failed to run container"
101-
docker exec "${CONTAINER_NAME}" /usr/local/cuos/first-run.sh "${PARTITION}" "${OS_IMAGE}" "${IMAGE_DIGEST}" \
101+
docker exec "${CONTAINER_NAME}" /usr/local/cuos/first-run.sh "${SLOT}" "${OS_IMAGE}" "${IMAGE_DIGEST}" \
102102
|| raise "Failed to run first-run script in container"
103103

104104
docker cp "${CONFIG_PATH}" "${CONTAINER_NAME}:/system_init.json" \
@@ -114,7 +114,7 @@ if [[ "${OS_ARCH}" == "lxc" ]]; then
114114
exit 0
115115
fi
116116

117-
PARTITION="B"
117+
SLOT="B"
118118

119119
#SIZE_MB=2048
120120
SIZE_MB=4096
@@ -194,7 +194,7 @@ umount /mnt/root
194194

195195
export INSTALLIMAGE=true
196196
/usr/local/updater/updater.sh \
197-
"${PARTITION}" \
197+
"${SLOT}" \
198198
"${OS_IMAGE}" \
199199
"${OS_DIGEST}"
200200

‎system/cuos/api.sh‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ EOF
4747
VERSION="$(cat "/etc/image")"
4848
VERSION="${VERSION/*\//}"
4949
VERSION="${VERSION/@*/}"
50-
PARTITION="$(cat "/etc/partition_mode")"
50+
SLOT="$(cat "/etc/active_slot")"
5151
jq \
52-
--arg partition "${PARTITION}" \
52+
--arg slot "${SLOT}" \
5353
--arg version "${VERSION}" \
54-
'.partition = $partition | .version = $version' \
54+
'.slot = $slot | .version = $version' \
5555
"/data/state.json"
5656
;;
5757

@@ -120,7 +120,7 @@ EOF
120120
"${CONFIG_PATH}" || exit 0
121121
fi
122122

123-
# apply changes to current partition
123+
# apply changes to current slot
124124
"${SCRIPT_DIR}/init.sh" --reinit
125125
;;
126126

‎system/cuos/app-init.sh‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,9 @@ if ! docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}\$"; then
151151
DOCKER_ARGS="$(docker inspect --format '{{ index .Config.Labels "dev.cuos.app_command" }}' "${INITIAL_IMAGE}")"
152152
if [[ -z "${DOCKER_ARGS}" ]]; then
153153
DOCKER_ARGS="\
154-
--device /dev/tty7 \
155-
--network=host \
156154
--volume /var/run/docker.sock:/var/run/docker.sock \
157155
--volume /root/.docker/config.json:/root/.docker/config.json:ro \
158156
--volume /system.json:/system.json:ro \
159-
--volume /etc/partition_mode:/etc/partition_mode:ro \
160157
--volume /var/run/cuos.sock:/var/run/cuos.sock \
161158
--volume /usr/local/share/ca-certificates/custom:/usr/local/share/ca-certificates/custom:ro"
162159
fi

0 commit comments

Comments
 (0)