refactor: merge vbox into docker as pos docker vbox

This commit is contained in:
Your Name
2026-08-05 03:30:51 -04:00
parent 0c9d09c331
commit 49fb248454
8 changed files with 55 additions and 53 deletions
+8 -10
View File
@@ -46,7 +46,7 @@ Linux_post_install/
│ ├── pos-system-backup # Encrypted folder snapshots (tar + gpg AES-256, --service) (115 lines)
│ ├── pos-ssh-load-keys # Load SSH keys into ssh-agent
│ ├── pos-communication-telegram # Send Telegram messages via Bot API
│ ├── pos-vbox # Disposable Docker-based "VMs"
│ ├── pos-docker-vbox # Disposable Docker-based "VMs" (pos docker vbox)
│ ├── pos-network-hotspot # Wi-Fi hotspot (create_ap + wihotspot-gui)
│ ├── flag-reader # Inspect feature flags (list/status/--raw)
│ ├── flag-set # Set a feature flag (optionally with a value)
@@ -208,18 +208,15 @@ All non-interactive `pos` commands log output to `~/.local/share/linux_post_inst
| system | backup | `pos-system-backup` | Encrypted folder snapshots (`tar` + gpg AES-256; `--service` picks from `/srv` and `~/srv`) |
| ssh | load-keys | `pos-ssh-load-keys` | Load SSH keys into agent |
| communication | telegram | `pos-communication-telegram` | Send Telegram messages via Bot API (`--send`, `test`, `config set`); config in `~/.config/linux_post_install/telegram.env` |
| vbox | create | `pos-vbox create` | Create disposable VM (asks "Enter now?") |
| vbox | enter | `pos-vbox enter` | Start and exec into container |
| vbox | ls | `pos-vbox ls` | List vbox-managed containers only (label-filtered) |
| vbox | start/stop/rm | `pos-vbox start/stop/rm` | Lifecycle management |
| docker | vbox | `pos-docker-vbox` | Disposable Docker "VMs" (`create/enter/start/stop/rm/ls`; label-filtered, auto-enter prompt) |
### Legacy Wrappers
These forward to `pos` transparently: `wr-ip`, `wr-checkport`, `wr-scan-ping`, `wr-docker`, `wr-compose`, `wr-ufw`, `mp3`, `mp4`, `vbox`, `ssh-load-all`.
### pos vbox Details
### pos docker vbox Details
`pos-vbox` manages disposable Docker containers as lightweight VMs:
`pos-docker-vbox` manages disposable Docker containers as lightweight VMs:
- **Container labeling:** All created containers get `linux_post_install.vbox=true` label
- **`ls` filtering:** `docker ps --filter label=linux_post_install.vbox=true` — only shows vbox-managed containers
@@ -461,16 +458,16 @@ Use conventional prefixes: `feat:`, `fix:`, `docs:`, `refactor:`, `chore:`
| `bin/flag-set` | 21 | Set a flag (optionally with a value) |
| `bin/flag-clear` | 21 | Unset a flag |
| `features/autostart.sh` | 14 | Boot-time feature (moved from `bin/`, flag-gated service) |
| `bin/pos` | 154 | CLI dispatcher with smart arg matching + logging |
| `bin/pos` | 153 | CLI dispatcher with smart arg matching + logging |
| `bin/pos-docker-compose` | 363 | Largest script — full compose management |
| `bin/pos-system-firewall` | 284 | Interactive UFW manager |
| `bin/pos-system-backup` | 115 | Encrypted folder snapshots: path mode + `--service` (`/srv`, `~/srv` picker), tar + gpg AES-256 |
| `bin/pos-docker-ps` | 127 | Enhanced container overview |
| `bin/pos-docker-health` | 109 | Quick health dashboard |
| `bin/pos-vbox` | 156 | Docker-based disposable VMs (label-filtered, auto-enter prompt) |
| `bin/pos-docker-vbox` | 156 | Docker-based disposable VMs (`pos docker vbox`; label-filtered, auto-enter prompt) |
| `bin/pos-network-hotspot` | 91 | Wi-Fi hotspot: `create_ap` (start with background prompt/`--foreground`, stop, status) + `wihotspot-gui` |
| `bin/pos-communication-telegram` | 138 | Telegram sender via Bot API: `--send`, `test`, `config set`; token masked; config `~/.config/linux_post_install/telegram.env` |
| `completions/pos.bash` | 118 | Dynamic bash completion |
| `completions/pos.bash` | 122 | Dynamic bash completion |
| `apps/install.sh` | 171 | App install/uninstall picker/orchestrator |
---
@@ -491,6 +488,7 @@ Use conventional prefixes: `feat:`, `fix:`, `docs:`, `refactor:`, `chore:`
| Add bash completion | Edit `completions/pos.bash` |
| Modify Docker Compose logic | Edit `bin/pos-docker-compose` |
| Modify Docker health check | Edit `bin/pos-docker-health` |
| Modify vbox (Docker VM) logic | Edit `bin/pos-docker-vbox` |
| Modify UFW/firewall logic | Edit `bin/pos-system-firewall` |
| Modify pos logging | Edit log setup in `bin/pos` |
| Modify install phases/flags | Edit arg parsing in `install.sh` |
+15 -14
View File
@@ -11,7 +11,6 @@
- [system](#system)
- [ssh](#ssh)
- [communication](#communication)
- [vbox](#vbox)
- [flags](#flags)
- [Legacy wrappers](#legacy-wrappers)
@@ -125,6 +124,20 @@ Global config keys:
| `DNS_SERVER` | no | `9.9.9.9` | DNS server |
| `SERVICES_BASE` | no | `/srv` | Deployment root |
#### Docker vbox
**File:** `bin/pos-docker-vbox`
**Purpose:** manage disposable Docker containers as lightweight "VMs". Each container gets a bind-mounted host directory so files persist after the container is removed. Containers carry the label `linux_post_install.vbox=true`.
| Command | Behavior |
|---------|----------|
| `pos docker vbox create <name> [image] [--dir <path>]` | Creates a container from `ubuntu:22.04` (or the given image), bind-mounting `~/<name>` (or `--dir`, or `.` for cwd) as the working directory; prompts to enter immediately |
| `pos docker vbox enter <name>` | Shell into the container (auto-starts it if stopped); detects the working dir from the container mounts |
| `pos docker vbox start/stop/rm <name>` | Start, stop, or force-remove the container |
| `pos docker vbox ls` | List vbox containers only (label filter) |
The standalone `vbox` command still works and forwards to `pos docker vbox` (see [Legacy wrappers](#legacy-wrappers)).
### media
| Command | File | Purpose | Configuration |
@@ -165,18 +178,6 @@ Global config keys:
The bot token is a secret — it is stored only in `~/.config/linux_post_install/telegram.env` and never in the repo. Requires network access to `api.telegram.org`.
### vbox
**File:** `bin/pos-vbox`
**Purpose:** manage disposable Docker containers as lightweight "VMs". Each container gets a bind-mounted host directory so files persist after the container is removed. Containers carry the label `linux_post_install.vbox=true`.
| Command | Behavior |
|---------|----------|
| `pos vbox create <name> [image] [--dir <path>]` | Creates a container from `ubuntu:22.04` (or the given image), bind-mounting `~/<name>` (or `--dir`, or `.` for cwd) as the working directory; prompts to enter immediately |
| `pos vbox enter <name>` | Shell into the container (auto-starts it if stopped); detects the working dir from the container mounts |
| `pos vbox start/stop/rm <name>` | Start, stop, or force-remove the container |
| `pos vbox ls` | List vbox containers only (label filter) |
### flags
Feature-flag management CLIs (see [SCRIPTS.md → lib/flags.sh](SCRIPTS.md#libflagssh--feature-flags)):
@@ -205,5 +206,5 @@ Thin 2-line scripts that `exec pos … "$@"`. All of them still work:
| `wr-ufw` | `pos system firewall` |
| `mp3` | `pos media mp3` |
| `mp4` | `pos media mp4` |
| `vbox` | `pos vbox` |
| `vbox` | `pos docker vbox` |
| `ssh-load-all` | `pos ssh load-keys` |
+1 -1
View File
@@ -325,7 +325,7 @@ pos docker compose up jellyfin
---
## 6. `pos-vbox` Lifecycle
## 6. `pos docker vbox` Lifecycle
```
create lab1
+1 -1
View File
@@ -11,7 +11,7 @@ It is a **personal toolkit** — a bootstrap script, a unified `pos` CLI for eve
**What you get:**
- 25+ system packages installed automatically
- The `pos` CLI: network, Docker, media, system, SSH, communication (Telegram), and vbox tools
- The `pos` CLI: network, Docker (compose + vbox VMs), media, system, SSH, and communication (Telegram) tools
- Wi-Fi hotspot tools (`create_ap`, `wihotspot-gui`) via `pos network hotspot`
- 15 optional desktop apps (VS Code, Brave, OBS, Tailscale, …) — pick what you want
- 119+ self-hosted services with Tailscale access (Jellyfin, Home Assistant, …)
+5 -6
View File
@@ -38,13 +38,12 @@ USAGE
CATEGORIES
network ip | checkport | scan | hotspot
docker ps | compose
docker ps | compose | vbox
media mp3 | mp4
system firewall | backup
ssh load-keys
communication
telegram
vbox create | enter | stop | start | rm | ls
EXAMPLES
pos network ip Show interfaces, routes, public IP
@@ -68,10 +67,10 @@ EXAMPLES
pos communication telegram --send "Backup done"
Send a Telegram message
pos vbox create lab1 Create disposable Docker VM
pos vbox create lab1 --dir . Create VM using current directory
pos vbox enter lab1 Shell into a Docker VM
pos vbox ls List Docker VMs
pos docker vbox create lab1 Create disposable Docker VM
pos docker vbox create lab1 --dir . Create VM using current directory
pos docker vbox enter lab1 Shell into a Docker VM
pos docker vbox ls List Docker VMs
HELP
pos help <command> Show help for a command
+15 -15
View File
@@ -5,12 +5,12 @@ source "$(dirname "$0")/../lib/common.sh" 2>/dev/null || source "$(dirname "$0")
usage() {
cat <<EOF
Usage:
pos vbox create <name> [image] [--dir <path>]
pos vbox enter <name>
pos vbox stop <name>
pos vbox start <name>
pos vbox rm <name>
pos vbox ls
pos docker vbox create <name> [image] [--dir <path>]
pos docker vbox enter <name>
pos docker vbox stop <name>
pos docker vbox start <name>
pos docker vbox rm <name>
pos docker vbox ls
Manage disposable Docker containers as lightweight VMs.
@@ -22,15 +22,15 @@ Options:
Use "." for current directory
Examples:
pos vbox create lab1
pos vbox create lab1 --dir .
pos vbox create lab1 --dir /mnt/data/lab1
pos vbox create kali kalilinux/kali-rolling
pos vbox enter lab1
pos vbox stop lab1
pos vbox start lab1
pos vbox rm lab1
pos vbox ls
pos docker vbox create lab1
pos docker vbox create lab1 --dir .
pos docker vbox create lab1 --dir /mnt/data/lab1
pos docker vbox create kali kalilinux/kali-rolling
pos docker vbox enter lab1
pos docker vbox stop lab1
pos docker vbox start lab1
pos docker vbox rm lab1
pos docker vbox ls
EOF
exit 0
}
+1 -1
View File
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
exec pos vbox "$@"
exec pos docker vbox "$@"
+9 -5
View File
@@ -63,7 +63,7 @@ _pos() {
COMPREPLY=($(compgen -W "ls installed up down restart logs update config" -- "$cur"))
}
_pos_complete_vbox_cmds() {
_pos_complete_docker_vbox_cmds() {
COMPREPLY=($(compgen -W "create enter stop start rm ls" -- "$cur"))
}
@@ -93,8 +93,8 @@ _pos() {
;;
esac
;;
vbox-*)
_pos_complete_vbox_cmds
docker-vbox)
_pos_complete_docker_vbox_cmds
;;
esac
;;
@@ -107,8 +107,12 @@ _pos() {
;;
esac
;;
vbox-create|vbox-enter|vbox-stop|vbox-start|vbox-rm)
_pos_complete_docker_vbox_names
docker-vbox)
case "${words[3]}" in
create|enter|stop|start|rm)
_pos_complete_docker_vbox_names
;;
esac
;;
esac
;;