-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuilder.sh
More file actions
executable file
·72 lines (62 loc) · 1.67 KB
/
builder.sh
File metadata and controls
executable file
·72 lines (62 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
set -e
ACTION=$1
MODE=${2:-dev} # Default to dev mode if not specified
ISO_NAME="build/cloudify-os-noble-amd64.iso"
SKIP_COMPRESSION=true # Default: dev mode skips compression
if [[ "$MODE" == "release" ]]; then
SKIP_COMPRESSION=false
echo " Release mode enabled — compression will be used"
else
echo " Developer mode — skipping compression"
fi
if [ -z "$ACTION" ]; then
echo "Usage: $0 [prepare|build|deploy|all|debug] [dev|release]"
exit 1
fi
function build_image() {
echo " Building Docker image..."
docker build -t cloudi-os-builder .
}
function run_ansible() {
echo " Running Ansible playbook (SKIP_COMPRESSION=$SKIP_COMPRESSION)..."
docker run -it --privileged --rm -v "$(pwd):/workspace" -v /dev:/dev cloudi-os-builder \
ansible-playbook playbook.yml -e "SKIP_COMPRESSION=$SKIP_COMPRESSION"
}
function deploy_iso() {
echo "Launching ISO with QEMU..."
if [ ! -f "$ISO_NAME" ]; then
echo " ISO not found at $ISO_NAME"
exit 1
fi
qemu-system-x86_64 -m 2048 -cdrom "$ISO_NAME" -serial mon:stdio
}
function debug_shell() {
echo " Entering Docker debug shell..."
docker run -it --privileged --rm -v "$(pwd):/workspace" -v /dev:/dev cloudi-os-builder /bin/bash
}
case "$ACTION" in
prepare)
build_image
;;
build)
build_image
run_ansible
;;
deploy)
deploy_iso
;;
all)
build_image
run_ansible
deploy_iso
;;
debug)
debug_shell
;;
*)
echo " Invalid action: $ACTION"
echo "Usage: $0 [build|run|deploy|all|debug] [dev|release]"
exit 1
;;
esac