underpost 3.2.9 → 3.2.11

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.
Files changed (104) hide show
  1. package/.github/workflows/npmpkg.ci.yml +1 -0
  2. package/.github/workflows/pwa-microservices-template-test.ci.yml +1 -1
  3. package/.github/workflows/release.cd.yml +1 -0
  4. package/.vscode/extensions.json +9 -9
  5. package/.vscode/settings.json +20 -4
  6. package/CHANGELOG.md +195 -1
  7. package/CLI-HELP.md +92 -23
  8. package/README.md +38 -9
  9. package/bin/build.js +27 -7
  10. package/bin/build.template.js +187 -0
  11. package/bin/deploy.js +12 -2
  12. package/bin/index.js +2 -1
  13. package/bump.config.js +26 -0
  14. package/conf.js +20 -7
  15. package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +1 -1
  16. package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +1 -1
  17. package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
  18. package/manifests/deployment/dd-test-development/deployment.yaml +4 -2
  19. package/manifests/kind-config-dev.yaml +8 -0
  20. package/manifests/lxd/lxd-admin-profile.yaml +12 -3
  21. package/manifests/mongodb/pv-pvc.yaml +44 -8
  22. package/manifests/mongodb/statefulset.yaml +55 -68
  23. package/manifests/mongodb-4.4/headless-service.yaml +10 -0
  24. package/manifests/mongodb-4.4/kustomization.yaml +3 -1
  25. package/manifests/mongodb-4.4/mongodb-nodeport.yaml +17 -0
  26. package/manifests/mongodb-4.4/pv-pvc.yaml +10 -14
  27. package/manifests/mongodb-4.4/statefulset.yaml +79 -0
  28. package/manifests/mongodb-4.4/storage-class.yaml +9 -0
  29. package/manifests/valkey/statefulset.yaml +1 -1
  30. package/manifests/valkey/valkey-nodeport.yaml +17 -0
  31. package/package.json +27 -12
  32. package/scripts/ipxe-setup.sh +52 -49
  33. package/scripts/k3s-node-setup.sh +81 -46
  34. package/scripts/lxd-vm-setup.sh +193 -8
  35. package/scripts/maas-nat-firewalld.sh +145 -0
  36. package/src/api/core/core.router.js +19 -14
  37. package/src/api/core/core.service.js +5 -5
  38. package/src/api/default/default.router.js +22 -18
  39. package/src/api/default/default.service.js +5 -5
  40. package/src/api/document/document.router.js +28 -23
  41. package/src/api/document/document.service.js +100 -23
  42. package/src/api/file/file.router.js +19 -13
  43. package/src/api/file/file.service.js +9 -7
  44. package/src/api/test/test.router.js +17 -12
  45. package/src/api/types.js +24 -0
  46. package/src/api/user/guest.service.js +5 -4
  47. package/src/api/user/user.router.js +297 -288
  48. package/src/api/user/user.service.js +100 -35
  49. package/src/cli/baremetal.js +132 -101
  50. package/src/cli/cluster.js +700 -232
  51. package/src/cli/db.js +59 -60
  52. package/src/cli/deploy.js +216 -137
  53. package/src/cli/fs.js +13 -3
  54. package/src/cli/index.js +80 -15
  55. package/src/cli/ipfs.js +4 -6
  56. package/src/cli/kubectl.js +4 -1
  57. package/src/cli/lxd.js +1099 -223
  58. package/src/cli/monitor.js +9 -3
  59. package/src/cli/release.js +334 -140
  60. package/src/cli/repository.js +68 -23
  61. package/src/cli/run.js +191 -47
  62. package/src/cli/secrets.js +11 -2
  63. package/src/cli/test.js +9 -3
  64. package/src/client/Default.index.js +9 -3
  65. package/src/client/components/core/Auth.js +5 -0
  66. package/src/client/components/core/ClientEvents.js +76 -0
  67. package/src/client/components/core/EventBus.js +4 -0
  68. package/src/client/components/core/Modal.js +82 -41
  69. package/src/client/components/core/PanelForm.js +56 -52
  70. package/src/client/components/core/Worker.js +162 -363
  71. package/src/client/sw/core.sw.js +174 -112
  72. package/src/db/DataBaseProvider.js +115 -15
  73. package/src/db/mariadb/MariaDB.js +2 -1
  74. package/src/db/mongo/MongoBootstrap.js +657 -0
  75. package/src/db/mongo/MongooseDB.js +129 -21
  76. package/src/index.js +1 -1
  77. package/src/runtime/express/Express.js +2 -2
  78. package/src/runtime/wp/Wp.js +8 -5
  79. package/src/server/auth.js +2 -2
  80. package/src/server/client-build-docs.js +1 -1
  81. package/src/server/client-build.js +94 -129
  82. package/src/server/conf.js +81 -79
  83. package/src/server/process.js +180 -19
  84. package/src/server/proxy.js +9 -2
  85. package/src/server/runtime.js +1 -1
  86. package/src/server/start.js +16 -4
  87. package/src/server/valkey.js +2 -0
  88. package/src/ws/IoInterface.js +16 -16
  89. package/src/ws/core/channels/core.ws.chat.js +11 -11
  90. package/src/ws/core/channels/core.ws.mailer.js +29 -29
  91. package/src/ws/core/channels/core.ws.stream.js +19 -19
  92. package/src/ws/core/core.ws.connection.js +8 -8
  93. package/src/ws/core/core.ws.server.js +6 -5
  94. package/src/ws/default/channels/default.ws.main.js +10 -10
  95. package/src/ws/default/default.ws.connection.js +4 -4
  96. package/src/ws/default/default.ws.server.js +4 -3
  97. package/bin/file.js +0 -202
  98. package/bin/vs.js +0 -74
  99. package/bin/zed.js +0 -84
  100. package/src/client/ssr/email/DefaultRecoverEmail.js +0 -21
  101. package/src/client/ssr/email/DefaultVerifyEmail.js +0 -17
  102. /package/src/client/ssr/{offline → views}/Maintenance.js +0 -0
  103. /package/src/client/ssr/{offline → views}/NoNetworkConnection.js +0 -0
  104. /package/src/client/ssr/{pages → views}/Test.js +0 -0
@@ -4,7 +4,8 @@ metadata:
4
4
  name: mongodb # Specifies the name of the statefulset
5
5
  spec:
6
6
  serviceName: 'mongodb-service' # Specifies the service to use
7
- replicas: 2
7
+ podManagementPolicy: OrderedReady # or Parallel
8
+ replicas: 3
8
9
  selector:
9
10
  matchLabels:
10
11
  app: mongodb
@@ -13,80 +14,58 @@ spec:
13
14
  labels:
14
15
  app: mongodb
15
16
  spec:
17
+ subdomain: mongodb-service
18
+ securityContext:
19
+ fsGroup: 999
20
+ initContainers:
21
+ - name: internal-keyfile-provisioner
22
+ image: docker.io/library/mongo:latest
23
+ securityContext:
24
+ runAsUser: 0
25
+ runAsGroup: 0
26
+ command:
27
+ - sh
28
+ - -c
29
+ - |
30
+ set -ex
31
+ mkdir -p /opt/mongodb
32
+ cp /tmp/raw-keyfile/mongodb-keyfile /opt/mongodb/mongodb-keyfile
33
+ chmod 400 /opt/mongodb/mongodb-keyfile
34
+ chown -R 999:999 /opt/mongodb
35
+ chown -R 999:999 /data/db
36
+ rm -f /data/db/mongod.lock
37
+ volumeMounts:
38
+ - name: raw-secret-keyfile-volume
39
+ mountPath: /tmp/raw-keyfile
40
+ - name: isolated-runtime-keyfile-volume
41
+ mountPath: /opt/mongodb
42
+ - name: mongodb-storage
43
+ mountPath: /data/db
16
44
  containers:
17
45
  - name: mongodb
18
46
  image: docker.io/library/mongo:latest
19
47
  command:
20
48
  - mongod
49
+ args:
21
50
  - '--replSet'
22
51
  - 'rs0'
23
- # - '--config'
24
- # - '-f'
25
- # - '/etc/mongod.conf'
26
- # - '--auth'
27
- # - '--clusterAuthMode'
28
- # - 'keyFile'
29
- # - '--keyFile'
30
- # - '/etc/mongodb-keyfile'
31
- # - '--interleave'
32
- # - 'all'
33
- # - '--wiredTigerCacheSizeGB'
34
- # - '0.25'
35
- # - '--setParameter'
36
- # - 'authenticationMechanisms=SCRAM-SHA-1'
37
- # - '--fork'
38
- - '--logpath'
39
- - '/var/log/mongodb/mongod.log'
52
+ - '--auth'
53
+ - '--clusterAuthMode'
54
+ - 'keyFile'
55
+ - '--keyFile'
56
+ - '/opt/mongodb/mongodb-keyfile'
40
57
  - '--bind_ip_all'
41
- # command: ['sh', '-c']
42
- # args:
43
- # - |
44
- # mongod --replSet rs0 --bind_ip_all &
45
- # sleep 1000
46
- # if mongosh --host mongodb-0.mongodb-service:27017 --eval "rs.status()" | grep -q "not yet initialized"; then
47
- # mongosh --host mongodb-0.mongodb-service:27017 <<EOF
48
- # use admin;
49
- # rs.initiate({
50
- # _id: "rs0",
51
- # members: [
52
- # { _id: 0, host: "mongodb-0.mongodb-service:27017", priority: 1 },
53
- # { _id: 1, host: "mongodb-1.mongodb-service:27017", priority: 1 }
54
- # ]
55
- # });
56
- # db.getSiblingDB("admin").createUser({
57
- # user: process.env.MONGO_INITDB_ROOT_USERNAME,
58
- # pwd: process.env.MONGO_INITDB_ROOT_PASSWORD,
59
- # roles: [{ role: "userAdminAnyDatabase", db: "admin" }]
60
- # });
61
- # use default;
62
- # db.createUser(
63
- # {
64
- # user: process.env.MONGO_INITDB_ROOT_USERNAME,
65
- # pwd: process.env.MONGO_INITDB_ROOT_PASSWORD,
66
- # roles: [
67
- # { role: "read", db: "test" },
68
- # { role: "readWrite", db: "default" }
69
- # ]
70
- # }
71
- # );
72
- # EOF
73
- # fi
74
- # wait
58
+
75
59
  ports:
76
60
  - containerPort: 27017
77
61
  volumeMounts:
62
+ - name: isolated-runtime-keyfile-volume
63
+ mountPath: /opt/mongodb
78
64
  - name: mongodb-storage
79
65
  mountPath: /data/db
80
- - name: keyfile
81
- mountPath: /etc/mongodb-keyfile
82
- readOnly: true
83
- # - name: mongodb-configuration-file
84
- # mountPath: /etc/mongod.conf
85
- # subPath: mongod.conf
86
- # readOnly: true
87
- # - name: mongodb-config
88
- # mountPath: /config
89
66
  env:
67
+ - name: MONGO_REPLICA_SET_NAME
68
+ value: rs0
90
69
  - name: MONGO_INITDB_ROOT_USERNAME
91
70
  valueFrom:
92
71
  secretKeyRef:
@@ -97,6 +76,18 @@ spec:
97
76
  secretKeyRef:
98
77
  name: mongodb-secret
99
78
  key: password
79
+ readinessProbe:
80
+ tcpSocket:
81
+ port: 27017
82
+ initialDelaySeconds: 15
83
+ periodSeconds: 10
84
+ timeoutSeconds: 5
85
+ livenessProbe:
86
+ tcpSocket:
87
+ port: 27017
88
+ initialDelaySeconds: 30
89
+ periodSeconds: 20
90
+ timeoutSeconds: 5
100
91
  resources:
101
92
  requests:
102
93
  cpu: '100m'
@@ -105,16 +96,12 @@ spec:
105
96
  cpu: '500m'
106
97
  memory: '512Mi'
107
98
  volumes:
108
- - name: keyfile
99
+ - name: raw-secret-keyfile-volume
109
100
  secret:
110
101
  secretName: mongodb-keyfile
111
102
  defaultMode: 0400
112
- # - name: mongodb-configuration-file
113
- # configMap:
114
- # name: mongodb-config-file
115
- # - name: mongodb-config
116
- # configMap:
117
- # name: mongodb-config
103
+ - name: isolated-runtime-keyfile-volume
104
+ emptyDir: {}
118
105
  volumeClaimTemplates:
119
106
  - metadata:
120
107
  name: mongodb-storage
@@ -0,0 +1,10 @@
1
+ apiVersion: v1
2
+ kind: Service
3
+ metadata:
4
+ name: mongodb-service
5
+ spec:
6
+ clusterIP: None
7
+ selector:
8
+ app: mongodb
9
+ ports:
10
+ - port: 27017
@@ -4,4 +4,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
4
4
  kind: Kustomization
5
5
  resources:
6
6
  - pv-pvc.yaml
7
- - service-deployment.yaml
7
+ - storage-class.yaml
8
+ - headless-service.yaml
9
+ - statefulset.yaml
@@ -0,0 +1,17 @@
1
+ apiVersion: v1
2
+ kind: Service
3
+ metadata:
4
+ name: mongodb-nodeport
5
+ labels:
6
+ app: mongodb
7
+ spec:
8
+ type: NodePort
9
+ externalTrafficPolicy: Cluster
10
+ selector:
11
+ app: mongodb
12
+ ports:
13
+ - name: mongodb
14
+ protocol: TCP
15
+ port: 27017
16
+ targetPort: 27017
17
+ nodePort: 32017
@@ -1,23 +1,19 @@
1
1
  apiVersion: v1
2
2
  kind: PersistentVolume
3
3
  metadata:
4
- name: mongodb-pv
4
+ name: mongodb-pv-0
5
+ labels:
6
+ app: mongodb
5
7
  spec:
6
8
  capacity:
7
9
  storage: 5Gi
8
10
  accessModes:
9
11
  - ReadWriteOnce
12
+ persistentVolumeReclaimPolicy: Retain
13
+ storageClassName: mongodb-storage-class
14
+ claimRef:
15
+ namespace: default
16
+ name: mongodb-storage-mongodb-0
10
17
  hostPath:
11
- path: /data/mongodb
12
- ---
13
- apiVersion: v1
14
- kind: PersistentVolumeClaim
15
- metadata:
16
- name: mongodb-pvc
17
- spec:
18
- storageClassName: ''
19
- accessModes:
20
- - ReadWriteOnce
21
- resources:
22
- requests:
23
- storage: 5Gi
18
+ path: /data/mongodb/v0
19
+ type: DirectoryOrCreate
@@ -0,0 +1,79 @@
1
+ apiVersion: apps/v1
2
+ kind: StatefulSet
3
+ metadata:
4
+ name: mongodb # Specifies the name of the statefulset
5
+ spec:
6
+ serviceName: 'mongodb-service' # Specifies the service to use
7
+ podManagementPolicy: OrderedReady # or Parallel
8
+ replicas: 1
9
+ selector:
10
+ matchLabels:
11
+ app: mongodb
12
+ template:
13
+ metadata:
14
+ labels:
15
+ app: mongodb
16
+ spec:
17
+ subdomain: mongodb-service
18
+ securityContext:
19
+ fsGroup: 999
20
+ initContainers:
21
+ - name: data-dir-permissions
22
+ image: docker.io/library/mongo:4.4
23
+ securityContext:
24
+ runAsUser: 0
25
+ runAsGroup: 0
26
+ command:
27
+ - sh
28
+ - -c
29
+ - |
30
+ chown -R 999:999 /data/db
31
+ rm -f /data/db/mongod.lock
32
+ volumeMounts:
33
+ - name: mongodb-storage
34
+ mountPath: /data/db
35
+ containers:
36
+ - name: mongodb
37
+ image: docker.io/library/mongo:4.4
38
+ command:
39
+ - mongod
40
+ args:
41
+ - '--replSet'
42
+ - 'rs0'
43
+ - '--bind_ip_all'
44
+ ports:
45
+ - containerPort: 27017
46
+ volumeMounts:
47
+ - name: mongodb-storage
48
+ mountPath: /data/db
49
+ env:
50
+ - name: MONGO_REPLICA_SET_NAME
51
+ value: rs0
52
+ readinessProbe:
53
+ tcpSocket:
54
+ port: 27017
55
+ initialDelaySeconds: 15
56
+ periodSeconds: 10
57
+ timeoutSeconds: 5
58
+ livenessProbe:
59
+ tcpSocket:
60
+ port: 27017
61
+ initialDelaySeconds: 30
62
+ periodSeconds: 20
63
+ timeoutSeconds: 5
64
+ resources:
65
+ requests:
66
+ cpu: '100m'
67
+ memory: '256Mi'
68
+ limits:
69
+ cpu: '500m'
70
+ memory: '512Mi'
71
+ volumeClaimTemplates:
72
+ - metadata:
73
+ name: mongodb-storage
74
+ spec:
75
+ accessModes: ['ReadWriteOnce']
76
+ storageClassName: mongodb-storage-class
77
+ resources:
78
+ requests:
79
+ storage: 5Gi
@@ -0,0 +1,9 @@
1
+ apiVersion: storage.k8s.io/v1
2
+ kind: StorageClass
3
+ metadata:
4
+ name: mongodb-storage-class
5
+ annotations:
6
+ storageclass.kubernetes.io/is-default-class: 'false'
7
+ provisioner: rancher.io/local-path
8
+ reclaimPolicy: Retain
9
+ volumeBindingMode: WaitForFirstConsumer
@@ -19,7 +19,7 @@ spec:
19
19
  image: docker.io/valkey/valkey:latest
20
20
  imagePullPolicy: IfNotPresent
21
21
  command: ['valkey-server']
22
- args: ['--port', '6379']
22
+ args: ['--port', '6379', '--bind', '0.0.0.0', '--protected-mode', 'no']
23
23
  ports:
24
24
  - containerPort: 6379
25
25
  startupProbe:
@@ -0,0 +1,17 @@
1
+ apiVersion: v1
2
+ kind: Service
3
+ metadata:
4
+ name: valkey-nodeport
5
+ labels:
6
+ app: valkey-service
7
+ spec:
8
+ type: NodePort
9
+ externalTrafficPolicy: Cluster
10
+ selector:
11
+ app: valkey-service
12
+ ports:
13
+ - name: valkey
14
+ protocol: TCP
15
+ port: 6379
16
+ targetPort: 6379
17
+ nodePort: 32079
package/package.json CHANGED
@@ -2,8 +2,8 @@
2
2
  "type": "module",
3
3
  "main": "src/index.js",
4
4
  "name": "underpost",
5
- "version": "3.2.9",
6
- "description": "pwa api rest template",
5
+ "version": "3.2.11",
6
+ "description": "Underpost Platform end-to-end CI/CD and application-delivery toolchain CLI. Covers bare metal, Kubernetes, K3s, kubeadm, LXD, container/image orchestration, secrets, databases, cron jobs, monitoring, SSH, runners, PWA + Workbox delivery, and release orchestration. Extensible via downstream CLIs.",
7
7
  "scripts": {
8
8
  "start": "node --max-old-space-size=8192 src/server",
9
9
  "build": "node bin client",
@@ -35,7 +35,21 @@
35
35
  "url": "git+https://github.com/underpostnet/pwa-microservices-template.git"
36
36
  },
37
37
  "keywords": [
38
+ "underpost",
39
+ "underpost-platform",
40
+ "cli",
41
+ "toolchain",
42
+ "ci-cd",
43
+ "devops",
44
+ "kubernetes",
45
+ "k3s",
46
+ "kubeadm",
47
+ "lxd",
48
+ "bare-metal",
49
+ "container-orchestration",
50
+ "image-management",
38
51
  "pwa",
52
+ "workbox",
39
53
  "microservices",
40
54
  "template",
41
55
  "builder",
@@ -53,12 +67,13 @@
53
67
  "dependencies": {
54
68
  "@fortawesome/fontawesome-free": "^7.2.0",
55
69
  "@fullcalendar/rrule": "^6.1.20",
56
- "@grpc/grpc-js": "^1.12.5",
57
- "@grpc/proto-loader": "^0.8.0",
70
+ "@grpc/grpc-js": "^1.14.4",
71
+ "@grpc/proto-loader": "^0.8.1",
58
72
  "@neodrag/vanilla": "^2.3.1",
59
73
  "adm-zip": "^0.5.17",
60
- "ag-grid-community": "^35.2.1",
61
- "axios": "^1.16.0",
74
+ "ag-grid-community": "^35.3.0",
75
+ "axios": "^1.16.1",
76
+ "bumpp": "^11.1.0",
62
77
  "chai": "^6.2.2",
63
78
  "clipboardy": "^5.3.1",
64
79
  "cloudinary": "^2.10.0",
@@ -75,13 +90,13 @@
75
90
  "escape-string-regexp": "^5.0.0",
76
91
  "express": "^5.2.1",
77
92
  "express-fileupload": "^1.4.3",
78
- "express-rate-limit": "^8.4.1",
93
+ "express-rate-limit": "^8.5.2",
79
94
  "express-slow-down": "^3.1.0",
80
95
  "fast-json-stable-stringify": "^2.1.0",
81
96
  "favicons": "^7.2.0",
82
97
  "fs-extra": "^11.3.5",
83
98
  "fullcalendar": "^6.1.15",
84
- "helmet": "^8.1.0",
99
+ "helmet": "^8.2.0",
85
100
  "html-minifier-terser": "^7.2.0",
86
101
  "http-proxy-middleware": "^4.0.0",
87
102
  "ignore-walk": "^9.0.0",
@@ -89,16 +104,16 @@
89
104
  "json-colorizer": "^3.0.1",
90
105
  "jsonwebtoken": "^9.0.3",
91
106
  "mariadb": "^3.2.2",
92
- "marked": "^18.0.3",
93
- "mocha": "^11.3.0",
107
+ "mocha": "^11.7.6",
108
+ "marked": "^18.0.4",
94
109
  "mongoose": "^9.6.2",
95
110
  "morgan": "^1.10.0",
96
- "nodemailer": "^8.0.7",
111
+ "nodemailer": "^8.0.9",
97
112
  "nodemon": "^3.0.1",
98
113
  "peer": "^1.0.2",
99
114
  "peerjs": "^1.5.5",
100
115
  "prom-client": "^15.1.2",
101
- "read": "^5.0.1",
116
+ "read": "^6.0.0",
102
117
  "rrule": "^2.8.1",
103
118
  "shelljs": "^0.10.0",
104
119
  "sitemap": "^9.0.1",
@@ -14,39 +14,39 @@ REBUILD=false
14
14
  EMBED_SCRIPT=""
15
15
 
16
16
  while [[ $# -gt 0 ]]; do
17
- case $1 in
18
- --rebuild)
19
- REBUILD=true
20
- shift # past argument
21
- ;;
22
- --target-arch)
23
- case "$2" in
24
- arm64)
25
- TARGET_ARCH="aarch64"
26
- ;;
27
- amd64)
28
- TARGET_ARCH="x86_64"
29
- ;;
17
+ case $1 in
18
+ --rebuild)
19
+ REBUILD=true
20
+ shift # past argument
21
+ ;;
22
+ --target-arch)
23
+ case "$2" in
24
+ arm64)
25
+ TARGET_ARCH="aarch64"
26
+ ;;
27
+ amd64)
28
+ TARGET_ARCH="x86_64"
29
+ ;;
30
+ *)
31
+ echo "Error: Unsupported architecture '$2'. Use 'arm64' or 'amd64'."
32
+ exit 1
33
+ ;;
34
+ esac
35
+ shift # past argument
36
+ shift # past value
37
+ ;;
38
+ --embed-script)
39
+ EMBED_SCRIPT="$2"
40
+ shift # past argument
41
+ shift # past value
42
+ ;;
30
43
  *)
31
- echo "Error: Unsupported architecture '$2'. Use 'arm64' or 'amd64'."
32
- exit 1
33
- ;;
34
- esac
35
- shift # past argument
36
- shift # past value
37
- ;;
38
- --embed-script)
39
- EMBED_SCRIPT="$2"
40
- shift # past argument
41
- shift # past value
42
- ;;
43
- *)
44
- if [ -z "$TARGET_DIR_ARG" ]; then
45
- TARGET_DIR_ARG="$1"
46
- fi
47
- shift # past argument
48
- ;;
49
- esac
44
+ if [ -z "$TARGET_DIR_ARG" ]; then
45
+ TARGET_DIR_ARG="$1"
46
+ fi
47
+ shift # past argument
48
+ ;;
49
+ esac
50
50
  done
51
51
 
52
52
  # Use argument if provided, otherwise env var, otherwise current dir
@@ -64,7 +64,7 @@ echo "Embed Script: ${EMBED_SCRIPT:-none}"
64
64
  # Determine iPXE build target based on requested architecture
65
65
  if [ "$TARGET_ARCH" = "aarch64" ]; then
66
66
  BUILD_TARGET="bin-arm64-efi/ipxe.efi"
67
- elif [ "$TARGET_ARCH" = "x86_64" ]; then
67
+ elif [ "$TARGET_ARCH" = "x86_64" ]; then
68
68
  BUILD_TARGET="bin-x86_64-efi/ipxe.efi"
69
69
  else
70
70
  echo "Error: Unsupported target architecture '$TARGET_ARCH'"
@@ -79,49 +79,50 @@ DO_BUILD=false
79
79
 
80
80
  if [ "$REBUILD" = true ]; then
81
81
  DO_BUILD=true
82
- elif [ ! -f "$COMPILED_SRC_PATH" ]; then
82
+ elif [ ! -f "$COMPILED_SRC_PATH" ]; then
83
83
  echo "Binary not found at $COMPILED_SRC_PATH. Initiating build..."
84
84
  DO_BUILD=true
85
+
85
86
  else
86
- echo "Binary found at $COMPILED_SRC_PATH. Skipping build."
87
+ echo "Binary found at $COMPILED_SRC_PATH with matching embedded script. Skipping build."
87
88
  fi
88
89
 
89
90
  if [ "$DO_BUILD" = true ]; then
90
-
91
+
91
92
  # Helper function for package manager
92
93
  if command -v dnf &> /dev/null; then
93
94
  PKG_MGR="dnf"
94
95
  else
95
96
  PKG_MGR="yum"
96
97
  fi
97
-
98
+
98
99
  # --- 2. Install Dependencies (RHEL/CentOS/Fedora) ---
99
100
  echo ""
100
101
  echo "--- Installing Build Dependencies ---"
101
102
  echo "Requesting sudo permissions..."
102
-
103
+
103
104
  COMMON_PKGS="git make binutils-devel xz-devel perl"
104
-
105
+
105
106
  # Logic to determine if we need native or cross-compilers
106
107
  if [ "$HOST_ARCH" = "$TARGET_ARCH" ]; then
107
108
  # Native compilation
108
109
  echo "Architecture match ($HOST_ARCH). Installing native GCC..."
109
110
  sudo $PKG_MGR install -y $COMMON_PKGS gcc
110
111
  CROSS_COMPILE_PREFIX=""
111
-
112
- elif [ "$HOST_ARCH" = "x86_64" ] && [ "$TARGET_ARCH" = "aarch64" ]; then
112
+
113
+ elif [ "$HOST_ARCH" = "x86_64" ] && [ "$TARGET_ARCH" = "aarch64" ]; then
113
114
  # Cross-compilation: x86_64 host -> aarch64 target
114
115
  echo "Cross-compiling for $TARGET_ARCH on $HOST_ARCH..."
115
116
  # Note: Ensure EPEL repo is enabled on RHEL/CentOS for this package
116
117
  sudo $PKG_MGR install -y $COMMON_PKGS gcc-aarch64-linux-gnu
117
118
  CROSS_COMPILE_PREFIX="aarch64-linux-gnu-"
118
-
119
+
119
120
  else
120
121
  echo "Error: No automated path defined for Host: $HOST_ARCH -> Target: $TARGET_ARCH"
121
122
  echo "You may need to install specific cross-compilers manually."
122
123
  exit 1
123
124
  fi
124
-
125
+
125
126
  # --- 3. Clone iPXE Source ---
126
127
  echo ""
127
128
  echo "--- Downloading iPXE Source Code ---"
@@ -133,15 +134,15 @@ if [ "$DO_BUILD" = true ]; then
133
134
  git clone https://github.com/ipxe/ipxe.git $IPXE_SRC_DIR
134
135
  cd $IPXE_SRC_DIR
135
136
  fi
136
-
137
+
137
138
  # --- 4. Compile the Binary ---
138
139
  echo ""
139
140
  echo "--- Compiling $EFI_FILENAME for $TARGET_ARCH ---"
140
141
  cd src
141
-
142
+
142
143
  # Clean previous builds to ensure no arch mismatch
143
144
  make clean
144
-
145
+
145
146
  # Build with embedded script if provided
146
147
  if [ -n "$EMBED_SCRIPT" ]; then
147
148
  echo "Embedding script into iPXE binary..."
@@ -155,7 +156,7 @@ if [ "$DO_BUILD" = true ]; then
155
156
  echo "Running make for target: $BUILD_TARGET..."
156
157
  make CROSS_COMPILE=$CROSS_COMPILE_PREFIX $BUILD_TARGET
157
158
  fi
158
-
159
+
159
160
  if [ $? -ne 0 ]; then
160
161
  echo "Error: Compilation failed."
161
162
  if [ -n "$CROSS_COMPILE_PREFIX" ]; then
@@ -163,6 +164,8 @@ if [ "$DO_BUILD" = true ]; then
163
164
  fi
164
165
  exit 1
165
166
  fi
167
+
168
+
166
169
  fi
167
170
 
168
171
  # --- 5. Deploy Binary ---
@@ -176,10 +179,10 @@ if [ -f "$COMPILED_SRC_PATH" ]; then
176
179
  echo "Creating target directory: $TARGET_DIR"
177
180
  mkdir -p "$TARGET_DIR"
178
181
  fi
179
-
182
+
180
183
  echo "Copying $COMPILED_SRC_PATH to $TARGET_DIR/$EFI_FILENAME..."
181
184
  cp "$COMPILED_SRC_PATH" "$TARGET_DIR/$EFI_FILENAME"
182
-
185
+
183
186
  if [ $? -eq 0 ]; then
184
187
  echo "✓ Success!"
185
188
  echo "---------------------------------------------------"