@@ -13,15 +13,27 @@ QUAY_CONFIG_DIR="${MIRROR_REGISTRY_DIR}/config"
13
13
PULL_SECRET=${PULL_SECRET:- ${HOME} / .pull-secret.json}
14
14
QUAY_PULL_SECRET=" ${QUAY_CONFIG_DIR} /pull_secret.json"
15
15
16
+ reset_storage_permissions () {
17
+ # Ensure that permissions are open for the current user on the mirror registry
18
+ # directories and files
19
+ if [ -d " ${MIRROR_REGISTRY_DIR} " ] ; then
20
+ sudo chgrp -R " $( id -gn) " " ${MIRROR_REGISTRY_DIR} "
21
+ sudo find " ${MIRROR_REGISTRY_DIR} " -type d -exec chmod a+rx ' {}' +
22
+ sudo find " ${MIRROR_REGISTRY_DIR} " -type f -exec chmod a+r ' {}' +
23
+ fi
24
+ }
25
+
16
26
setup_prereqs () {
17
27
# Install packages if not yet available locally
18
28
if ! rpm -q podman skopeo jq & > /dev/null ; then
19
29
" ${SCRIPTDIR} /../../scripts/dnf_retry.sh" " install" " podman skopeo jq"
20
30
fi
21
31
22
- # Create registry repository base directory structure
32
+ # Create registry repository base directory structure and reset permissions
33
+ # if downloaded from cache
23
34
mkdir -p " ${MIRROR_REGISTRY_DIR} "
24
35
mkdir -p " ${QUAY_CONFIG_DIR} "
36
+ reset_storage_permissions
25
37
26
38
# Create a new pull secret file containing authentication information for both
27
39
# remote (from PULL_SECRET environment) and local registries
268
280
}
269
281
270
282
finalize_registry () {
271
- # Ensure that permissions are open for the current user on the mirror registry
272
- # directories and files. This is necessary to avoid 'find' command errors.
273
- sudo chgrp -R " $( id -gn) " " ${MIRROR_REGISTRY_DIR} "
274
- sudo find " ${MIRROR_REGISTRY_DIR} " -type d -exec chmod a+rx ' {}' +
275
- sudo find " ${MIRROR_REGISTRY_DIR} " -type f -exec chmod a+r ' {}' +
283
+ reset_storage_permissions
276
284
# Delete the combined pull secret file
277
285
rm -f " ${QUAY_PULL_SECRET} "
278
286
}
0 commit comments