-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathairgapme.sh
executable file
·473 lines (389 loc) · 19 KB
/
airgapme.sh
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
#!/bin/bash
tap_secrets_file="$HOME/.tap/tap-secrets"
# Check if the file exists
if [[ -f "$tap_secrets_file" ]]; then
while IFS='=' read -r key value; do
# Ignore lines starting with # and empty lines
if [[ $key != \#* ]] && [ -n "$key" ]; then
# Export the key-value pair as environment variables
export "$key"="$value"
fi
done < "$tap_secrets_file"
else
echo "~/.tap/tap-secrets file does not exist."
exit 1
fi
echo ""
echo "-------------------------------"
echo "Removing old directories if any"
echo "-------------------------------"
rm -Rf -- */
echo ""
echo "------------------"
echo "Downloading PIVNET"
echo "------------------"
docker login registry.tanzu.vmware.com -u $IMGPKG_REGISTRY_USERNAME -p $IMGPKG_REGISTRY_PASSWORD
mkdir -p pivnet
# Check if the OS is Mac or Linux
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "Running on macOS"
# Check CPU architecture on macOS
cpu_arch=$(uname -m)
if [[ "$cpu_arch" == "arm64" ]]; then
echo "Apple Silicon (M1)"
wget -P pivnet "https://github.com/pivotal-cf/pivnet-cli/releases/download/v$PIVNET_VERSION/pivnet-darwin-arm64-4.1.1"
export PIVNET="$PWD/pivnet/pivnet-darwin-arm64-4.1.1"
else
echo "Intel"
# Commands specific to Intel CPUs
wget -P pivnet "https://github.com/pivotal-cf/pivnet-cli/releases/download/v$PIVNET_VERSION/pivnet-darwin-amd64-4.1.1"
export PIVNET=$PWD/pivnet/pivnet-darwin-amd64-4.1.1
fi
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo "Running on Linux"
# Linux specific commands
wget -P pivnet "https://github.com/pivotal-cf/pivnet-cli/releases/download/v$PIVNET_VERSION/pivnet-linux-amd64-4.1.1"
export PIVNET=$PWD/pivnet/pivnet-linux-amd64-4.1.1
else
echo "Unsupported OS"
exit 1
fi
chmod +x pivnet/*
echo ""
echo "--------------"
echo "Downloading jq"
echo "--------------"
mkdir -p jq
wget -P jq https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-amd64
wget -P jq https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-windows-amd64.exe
wget -P jq https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-macos-amd64
wget -P jq https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-macos-arm64
chmod +x jq/*
echo ""
echo "---------------------------"
echo "Logging in to Tanzu Network"
echo "---------------------------"
$PIVNET login --api-token $PIVNET_TOKEN
$PIVNET accept-eula -p 'tanzu-application-platform' -r $TAP_VERSION
echo ""
echo "----------------------"
echo "Downloading Tanzu CLIs"
echo "----------------------"
mkdir -p all-tanzu-clis
$PIVNET product-files -p 'tanzu-application-platform' -r $TAP_VERSION > slugs.txt
# Check if the OS is Mac or Linux
if [[ "$OSTYPE" == "darwin"* ]]; then
# Check CPU architecture on macOS
cpu_arch=$(uname -m)
if [[ "$cpu_arch" == "arm64" ]]; then
export TANZU_CLI_SLUG=$(grep 'tanzu-framework-bundle-mac-arm64' slugs.txt | awk -F'|' '{print $2}' | awk '{$1=$1};1')
export JQ_CLI="jq/jq-macos-arm64"
else
# Commands specific to Intel CPUs
export TANZU_CLI_SLUG=$(grep 'tanzu-core-cli-mac' slugs.txt | awk -F'|' '{print $2}' | awk '{$1=$1};1')
export JQ_CLI="jq/jq-macos-amd64"
fi
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux specific commands
export TANZU_CLI_SLUG=$(grep 'tanzu-core-cli-linux' slugs.txt | awk -F'|' '{print $2}' | awk '{$1=$1};1')
export JQ_CLI="jq/jq-linux-amd64"
else
echo "Unsupported OS"
exit 1
fi
$PIVNET download-product-files -p 'tanzu-application-platform' -r $TAP_VERSION -d all-tanzu-clis --product-file-id $(grep 'tanzu-framework-bundle-mac-arm64' slugs.txt | awk -F'|' '{print $2}' | awk '{$1=$1};1')
$PIVNET download-product-files -p 'tanzu-application-platform' -r $TAP_VERSION -d all-tanzu-clis --product-file-id $(grep 'tanzu-core-cli-mac' slugs.txt | awk -F'|' '{print $2}' | awk '{$1=$1};1')
$PIVNET download-product-files -p 'tanzu-application-platform' -r $TAP_VERSION -d all-tanzu-clis --product-file-id $(grep 'tanzu-core-cli-linux' slugs.txt | awk -F'|' '{print $2}' | awk '{$1=$1};1')
$PIVNET download-product-files -p 'tanzu-application-platform' -r $TAP_VERSION -d all-tanzu-clis --product-file-id $(grep 'tanzu-core-cli-windows' slugs.txt | awk -F'|' '{print $2}' | awk '{$1=$1};1')
echo ""
echo "--------------------------------------"
echo "Downloading Tanzu CLI for this machine"
echo "--------------------------------------"
mkdir -p /tmp/tanzu-cli
$PIVNET download-product-files -p 'tanzu-application-platform' -r $TAP_VERSION -d /tmp/tanzu-cli --product-file-id $TANZU_CLI_SLUG
tar xvf /tmp/tanzu-cli/*.tar.gz -C /tmp/tanzu-cli
rm -f /tmp/tanzu-cli/*.tar.gz
mkdir -p /tmp/tanzu-cli-tmp
find /tmp/tanzu-cli -type f -name "tanzu-cli*" -exec mv {} /tmp/tanzu-cli-tmp/ \;
rm -rf /tmp/tanzu-cli/*
mv /tmp/tanzu-cli-tmp/* /tmp/tanzu-cli/
rm -rf /tmp/tanzu-cli-tmp
mv /tmp/tanzu-cli/* /tmp/tanzu-cli/tanzu
chmod +x /tmp/tancu-cli/*
echo ""
echo "-----------------------------"
echo "Downloading Tanzu CLI Plugins"
echo "-----------------------------"
export TANZU_CLI="/tmp/tanzu-cli/tanzu"
$TANZU_CLI plugin download-bundle --group vmware-tap/default --to-tar all-tanzu-clis/plugins.tar
echo ""
echo "----------------------------------"
echo "Downloading all cluster-essentials"
echo "----------------------------------"
mkdir -p all-cluster-essentials
$PIVNET accept-eula -p 'tanzu-cluster-essentials' -r $CLUSTER_ESSENTIALS_VERSION
$PIVNET product-files -p 'tanzu-cluster-essentials' -r $CLUSTER_ESSENTIALS_VERSION > slugs.txt
# Check if the OS is Mac or Linux
if [[ "$OSTYPE" == "darwin"* ]]; then
# Check CPU architecture on macOS
cpu_arch=$(uname -m)
if [[ "$cpu_arch" == "arm64" ]]; then
export CLUSTER_ESSENTIALS_SLUG=$(grep 'tanzu-cluster-essentials-darwin' slugs.txt | awk -F'|' '{print $2}' | awk '{$1=$1};1')
else
# Commands specific to Intel CPUs
export CLUSTER_ESSENTIALS_SLUG=$(grep 'tanzu-cluster-essentials-darwin' slugs.txt | awk -F'|' '{print $2}' | awk '{$1=$1};1')
fi
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux specific commands
export CLUSTER_ESSENTIALS_SLUG=$(grep 'tanzu-cluster-essentials-linux' slugs.txt | awk -F'|' '{print $2}' | awk '{$1=$1};1')
else
echo "Unsupported OS"
exit 1
fi
export CLUSTER_ESSENTIALS_YAML_SLUG=$(grep 'tanzu-cluster-essentials-bundle' slugs.txt | awk -F'|' '{print $2}' | awk '{$1=$1};1')
$PIVNET download-product-files -p 'tanzu-cluster-essentials' -r $TAP_VERSION -d all-cluster-essentials --product-file-id $(grep 'tanzu-cluster-essentials-darwin' slugs.txt | awk -F'|' '{print $2}' | awk '{$1=$1};1')
$PIVNET download-product-files -p 'tanzu-cluster-essentials' -r $TAP_VERSION -d all-cluster-essentials --product-file-id $(grep 'tanzu-cluster-essentials-darwin' slugs.txt | awk -F'|' '{print $2}' | awk '{$1=$1};1')
$PIVNET download-product-files -p 'tanzu-cluster-essentials' -r $TAP_VERSION -d all-cluster-essentials --product-file-id $(grep 'tanzu-cluster-essentials-linux' slugs.txt | awk -F'|' '{print $2}' | awk '{$1=$1};1')
$PIVNET download-product-files -p 'tanzu-cluster-essentials' -r $TAP_VERSION -d all-cluster-essentials --product-file-id $(grep 'tanzu-cluster-essentials-windows' slugs.txt | awk -F'|' '{print $2}' | awk '{$1=$1};1')
echo ""
echo "-----------------------------------------------"
echo "Downloading cluster-essentials for this machine"
echo "-----------------------------------------------"
mkdir -p /tmp/cluster-essentials
$PIVNET download-product-files -p 'tanzu-cluster-essentials' -r $TAP_VERSION -d /tmp/cluster-essentials --product-file-id $CLUSTER_ESSENTIALS_SLUG
$PIVNET download-product-files -p 'tanzu-cluster-essentials' -r $TAP_VERSION -d /tmp/cluster-essentials --product-file-id $CLUSTER_ESSENTIALS_YAML_SLUG
tar xvf /tmp/cluster-essentials/*.tgz -C /tmp/cluster-essentials
chmod +x /tmp/cluster-essentials/*
rm /tmp/cluster-essentials/*.tgz
export CLUSTER_ESSENTIALS_IMAGE_SHA=$(grep "image:" /tmp/cluster-essentials/tanzu-cluster-essentials-bundle-$CLUSTER_ESSENTIALS_VERSION.yml | awk '{print $2}')
echo ""
echo "------------------------------"
echo "Taking note of the sha256 hash"
echo "------------------------------"
export sha256_hash=$(echo "$CLUSTER_ESSENTIALS_IMAGE_SHA" | grep -oE "sha256:[0-9a-fA-F]{64}")
/tmp/cluster-essentials/imgpkg copy -b $CLUSTER_ESSENTIALS_IMAGE_SHA --to-tar all-cluster-essentials/cluster-essentials-bundle.tar --include-non-distributable-layers
echo $sha256_hash > all-cluster-essentials/sha256_hash.txt
echo ""
echo "----------------------------"
echo "Downloading TAP dependencies"
echo "----------------------------"
mkdir -p tap-dependencies
/tmp/cluster-essentials/imgpkg copy \
-b registry.tanzu.vmware.com/tanzu-application-platform/tap-packages:$TAP_VERSION \
--to-tar tap-dependencies/tap-packages-$TAP_VERSION.tar \
--include-non-distributable-layers
cat <<EOT >> tap-dependencies/sample-tap-values.yaml
shared:
ingress_domain: "INGRESS-DOMAIN"
image_registry:
project_path: "SERVER-NAME/REPO-NAME"
secret:
name: "KP-DEFAULT-REPO-SECRET"
namespace: "KP-DEFAULT-REPO-SECRET-NAMESPACE"
ca_cert_data: |
-----BEGIN CERTIFICATE-----
MIIFXzCCA0egAwIBAgIJAJYm37SFocjlMA0GCSqGSIb3DQEBDQUAMEY...
-----END CERTIFICATE-----
profile: full
ceip_policy_disclosed: true
buildservice:
kp_default_repository: "KP-DEFAULT-REPO"
kp_default_repository_secret: # Takes the value from the shared section by default, but can be overridden by setting a different value.
name: "KP-DEFAULT-REPO-SECRET"
namespace: "KP-DEFAULT-REPO-SECRET-NAMESPACE"
exclude_dependencies: true
supply_chain: basic
contour:
infrastructure_provider: aws
envoy:
service:
type: LoadBalancer
annotations:
# This annotation is for air-gapped AWS only.
service.kubernetes.io/aws-load-balancer-internal: "true"
ootb_supply_chain_basic:
registry:
server: "SERVER-NAME" # Takes the value from the shared section by default, but can be overridden by setting a different value.
repository: "REPO-NAME" # Takes the value from the shared section by default, but can be overridden by setting a different value.
gitops:
ssh_secret: "SSH-SECRET"
maven:
repository:
url: https://MAVEN-URL
secret_name: "MAVEN-CREDENTIALS"
accelerator:
ingress:
include: true
enable_tls: false
git_credentials:
secret_name: git-credentials
username: GITLAB-USER
password: GITLAB-PASSWORD
appliveview:
ingressEnabled: true
appliveview_connector:
backend:
ingressEnabled: true
sslDeactivated: false
host: appliveview.INGRESS-DOMAIN
caCertData: |-
-----BEGIN CERTIFICATE-----
MIIGMzCCBBugAwIBAgIJALHHzQjxM6wMMA0GCSqGSIb3DQEBDQUAMGcxCzAJBgNV
BAgMAk1OMRQwEgYDVQQHDAtNaW5uZWFwb2xpczEPMA0GA1UECgwGVk13YXJlMRMw
-----END CERTIFICATE-----
local_source_proxy:
# Takes the value from the project_path under the image_registry section of shared by default, but can be overridden by setting a different value.
repository: "EXTERNAL-REGISTRY-FOR-LOCAL-SOURCE"
push_secret:
# When set to true, the secret mentioned in this section is automatically exported to Local Source Proxy's namespace.
name: "EXTERNAL-REGISTRY-FOR-LOCAL-SOURCE-SECRET"
namespace: "EXTERNAL-REGISTRY-FOR-LOCAL-SOURCE-SECRET-NAMESPACE"
# When set to true, the secret mentioned in this section is automatically exported to Local Source Proxy's namespace.
create_export: true
tap_gui:
app_config:
auth:
allowGuestAccess: true # This allows unauthenticated users to log in to your portal. If you want to deactivate it, make sure you configure an alternative auth provider.
kubernetes:
serviceLocatorMethod:
type: multiTenant
clusterLocatorMethods:
- type: config
clusters:
- url: https://{KUBERNETES_SERVICE_HOST}:{KUBERNETES_SERVICE_PORT}
name: host
authProvider: serviceAccount
serviceAccountToken: {KUBERNETES_SERVICE_ACCOUNT_TOKEN}
skipTLSVerify: false
caData: B64_ENCODED_CA
catalog:
locations:
- type: url
target: https://GIT-CATALOG-URL/catalog-info.yaml
#Example Integration for custom GitLab:
integrations:
gitlab:
- host: GITLAB-URL
token: GITLAB-TOKEN
apiBaseUrl: https://GITLABURL/api/v4/
backend:
reading:
allow:
- host: GITLAB-URL # Example URL: gitlab.example.com
metadata_store:
ns_for_export_app_cert: "MY-DEV-NAMESPACE"
app_service_type: ClusterIP # Defaults to LoadBalancer. If shared.ingress_domain is set earlier, this must be set to ClusterIP.
EOT
echo ""
echo "--------------------------------------"
echo "Downloading Build Service dependencies"
echo "--------------------------------------"
/tmp/cluster-essentials/imgpkg copy -b registry.tanzu.vmware.com/tanzu-application-platform/full-deps-package-repo:$TAP_VERSION \
--to-tar=tap-dependencies/full-deps-package-repo.tar
echo ""
echo "--------------------"
echo "Making Grype with DB"
echo "--------------------"
mkdir -p grype-with-db
cd grype-with-db
ESCAPED_1=$(sed 's/[\*\/]/\\&/g' <<<"$GRYPE_FQDN")
rm vulnerability-db*.tar.gz
rm listing.json
wget https://toolbox-data.anchore.io/grype/databases/listing.json
jq --arg v1 "$v1" '{ "available": { "1" : [.available."1"[0]] , "2" : [.available."2"[0]] , "3" : [.available."3"[0]] , "4" : [.available."4"[0]] , "5" : [.available."5"[0]] } }' listing.json > listing.json.tmp
mv listing.json.tmp listing.json
wget $(cat listing.json | ../$JQ_CLI -r '.available."1"[0].url')
wget $(cat listing.json | ../$JQ_CLI -r '.available."2"[0].url')
wget $(cat listing.json | ../$JQ_CLI -r '.available."3"[0].url')
wget $(cat listing.json | ../$JQ_CLI -r '.available."4"[0].url')
wget $(cat listing.json | ../$JQ_CLI -r '.available."5"[0].url')
sed -i '' -e "s/https:\/\/toolbox-data.anchore.io\/grype\/databases/$ESCAPED_1/g" listing.json
echo "FROM nginx:stable" > Dockerfile
echo "EXPOSE 443" >> Dockerfile
# Source directory containing the vulnerability-db files
source_dir="$PWD"
# Destination directory in the Docker container
dest_dir="/usr/share/nginx/html/"
# Loop through each file and generate COPY commands
for file in "$source_dir"/vulnerability-db*.tar.gz; do
# Get the filename without the path
filename=$(basename -- "$file")
# Generate the COPY command
echo "COPY ./$filename $dest_dir$filename" >> Dockerfile
done
echo "STOPSIGNAL SIGQUIT" >> Dockerfile
echo 'CMD ["nginx", "-g", "daemon off;"]' >> Dockerfile
docker login $PUSH_REGISTRY_FQDN -u $PUSH_REGISTRY_USERNAME -p $PUSH_REGISTRY_PASSWORD
docker buildx build --push --platform linux/amd64 -t "$PUSH_REGISTRY_WITH_PROJECT/grype:latest" .
docker pull "$PUSH_REGISTRY_WITH_PROJECT/grype:latest"
docker save -o grype-with-db.tar "$PUSH_REGISTRY_WITH_PROJECT/grype:latest"
cd ..
echo ""
echo "-----------------------"
echo "Downloading IDE Plugins"
echo "-----------------------"
mkdir -p ide-plugins
$PIVNET product-files -p 'tanzu-application-platform' -r $TAP_VERSION --format json > slugs.json
$PIVNET download-product-files -p 'tanzu-application-platform' -r $TAP_VERSION -d ide-plugins --product-file-id $($JQ_CLI '.[] | select(.name == "Tanzu Developer Tools for Visual Studio") | .id' slugs.json)
$PIVNET download-product-files -p 'tanzu-application-platform' -r $TAP_VERSION -d ide-plugins --product-file-id $($JQ_CLI '.[] | select(.name == "Tanzu GitOps Reference Implementation") | .id' slugs.json)
$PIVNET download-product-files -p 'tanzu-application-platform' -r $TAP_VERSION -d ide-plugins --product-file-id $($JQ_CLI '.[] | select(.name == "Tanzu App Accelerator Extension for Intellij") | .id' slugs.json)
$PIVNET download-product-files -p 'tanzu-application-platform' -r $TAP_VERSION -d ide-plugins --product-file-id $($JQ_CLI '.[] | select(.name == "Tanzu App Accelerator Extension for Visual Studio Code") | .id' slugs.json)
$PIVNET download-product-files -p 'tanzu-application-platform' -r $TAP_VERSION -d ide-plugins --product-file-id $($JQ_CLI '.[] | select(.name == "Tanzu Developer Tools for Visual Studio Code") | .id' slugs.json)
$PIVNET download-product-files -p 'tanzu-application-platform' -r $TAP_VERSION -d ide-plugins --product-file-id $($JQ_CLI '.[] | select(.name == "Tanzu Developer Tools for Intellij") | .id' slugs.json)
$PIVNET download-product-files -p 'tanzu-application-platform' -r $TAP_VERSION -d ide-plugins --product-file-id $($JQ_CLI '.[] | select(.name == "Tanzu Application Platform Developer Portal Blank Catalog") | .id' slugs.json)
$PIVNET download-product-files -p 'tanzu-application-platform' -r $TAP_VERSION -d ide-plugins --product-file-id $($JQ_CLI '.[] | select(.name == "Tanzu Application Platform Developer Portal Yelb Catalog") | .id' slugs.json)
rm slugs.txt
rm slugs.json
echo ""
echo "-------------------------"
echo "Downloading documentation"
echo "-------------------------"
mkdir -p docs
export TAP_MAJOR_VERSION=${TAP_VERSION%.*}
export CLUSTER_ESSENTIALS_MAJOR_VERSION=${CLUSTER_ESSENTIALS_VERSION%.*}
wget -O "docs/tap.pdf" -U "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" "https://docs.vmware.com/en/VMware-Tanzu-Application-Platform/$TAP_MAJOR_VERSION/tap.pdf"
wget -O "docs/cluster-essentials-docs.html" -U "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" "https://docs.vmware.com/en/Cluster-Essentials-for-VMware-Tanzu/$CLUSTER_ESSENTIALS_MAJOR_VERSION/cluster-essentials/deploy.html"
echo ""
echo "----------------"
echo "Downloading TILT"
echo "----------------"
mkdir -p tilt
wget -P tilt "https://github.com/tilt-dev/tilt/releases/download/v$TILT_VERSION/tilt.$TILT_VERSION.linux.x86_64.tar.gz"
wget -P tilt "https://github.com/tilt-dev/tilt/releases/download/v$TILT_VERSION/tilt.$TILT_VERSION.mac.arm64.tar.gz"
wget -P tilt "https://github.com/tilt-dev/tilt/releases/download/v$TILT_VERSION/tilt.$TILT_VERSION.mac.x86_64.tar.gz"
wget -P tilt "https://github.com/tilt-dev/tilt/releases/download/v$TILT_VERSION/tilt.$TILT_VERSION.windows.x86_64.zip"
echo ""
echo "-----------------------------------"
echo "Folder is created! Creating tarball"
echo "-----------------------------------"
# Function to display spinning animation
spinner() {
local pid=$1
local delay=0.1
local spin='-\|/'
while ps -p $pid &>/dev/null; do
printf "[%c] " "$spin"
spin=${spin#?}${spin%???}
sleep $delay
printf "\b\b\b\b\b"
done
printf " \b\b\b\b"
}
# Run tar command in the background and capture its PID
tar -cf ~/tap-airgapped-install-$TAP_VERSION.tar.gz --exclude=.git . &>/dev/null &
tar_pid=$!
# Start spinning indicator in the background
spinner $tar_pid &
# Wait for the tar command to finish
wait $tar_pid
# Stop spinning indicator
wait
echo ""
echo "------------------------------------------------------"
echo "Tarball is available at ~/tap-airgapped-install-$TAP_VERSION.tar.gz"
echo "------------------------------------------------------"
echo ""
echo "--------------------------"
echo "All done! Happy airgapping"
echo "Contact my at @odedia"
echo "--------------------------"