Repository navigation
Expand file tree
/
Copy pathprocess_packages.sh
More file actions
80 lines (61 loc) · 1.8 KB
/
Copy pathprocess_packages.sh
File metadata and controls
80 lines (61 loc) · 1.8 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
73
74
75
76
77
78
79
80
#!/bin/bash
# List of package names
packages=(
'advanced-cluster-management'
'multicluster-engine'
'topology-aware-lifecycle-manager'
'openshift-gitops-operator'
'odf-operator'
'ocs-operator'
'odf-csi-addons-operator'
'local-storage-operator'
'mcg-operator'
'cluster-logging'
'odf-prometheus-operator'
'recipe'
'rook-ceph-operator'
)
#!/bin/bash
# Set variables
DOWNLOAD_URL="https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.16.0/oc-mirror.tar.gz"
FILE_NAME="oc-mirror.tar.gz"
TARGET_DIR="oc-mirror"
# Download the file
echo "Downloading oc-mirror from $DOWNLOAD_URL..."
curl -LO "$DOWNLOAD_URL"
# Verify the download
if [[ $? -ne 0 ]]; then
echo "Error: Failed to download the file."
exit 1
fi
echo "Download completed: $FILE_NAME"
# Create target directory and extract the tar.gz file
echo "Extracting $FILE_NAME..."
mkdir -p "$TARGET_DIR"
tar -xzf "$FILE_NAME" -C "$TARGET_DIR"
if [[ $? -ne 0 ]]; then
echo "Error: Failed to extract $FILE_NAME."
exit 1
fi
echo "Extraction completed."
# Make binaries executable
echo "Making binaries executable..."
chmod +x "$TARGET_DIR"/*
# Check if chmod was successful
if [[ $? -ne 0 ]]; then
echo "Error: Failed to make files executable."
exit 1
fi
echo "All binaries are now executable."
# Cleanup
echo "Cleaning up the downloaded archive..."
rm -f "$FILE_NAME"
echo "Script completed successfully. The binaries are located in $TARGET_DIR."
# Loop through each package
for package in "${packages[@]}"; do
echo "Processing package: $package"
# Example command (replace with actual logic)
./${TARGET_DIR}/oc-mirror list operators --catalog registry.redhat.io/redhat/redhat-operator-index:v4.16 --package="$package"
# Add additional logic here for processing the output if needed
done
echo "All packages processed."