Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117753905
prepare-yum-repositories
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
prepare-yum-repositories
View Options
#!/bin/bash
# This script is used to prepare yum repositories, that are given as arguments.
set
-e
# DEFAULT_REPOS and SKIP_REPOS_{ENABLE,DISABLE} are intentionally undocumented,
# but might be used if we need to change this behaviour.
# Once we realize there are real use cases for using those variables, we should
# document them properly.
DEFAULT_REPOS
=
${
DEFAULT_REPOS
:-
"rhel-7-server-rpms rhel-7-server-optional-rpms"
}
SKIP_REPOS_ENABLE
=
${
SKIP_REPOS_ENABLE
:-
false
}
SKIP_REPOS_DISABLE
=
${
SKIP_REPOS_DISABLE
:-
false
}
function
is_subscribed
()
{
for
f
in
/run/secrets/etc-pki-entitlement/*.pem
;
do
[
-e
"
$f
"
]
&&
return
0
break
done
return
1
}
# repo files might be mounted in (read-only), better not try any write ops
ls -1 /etc/yum.repos.d/
|
grep -v redhat.repo >/dev/null
&&
SKIP_REPOS_ENABLE
=
true
# install yum-utils for yum-config-manager
yum install -y yum-utils
if
[
"
$SKIP_REPOS_DISABLE
"
=
false
]
&&
is_subscribed
;
then
# Disable only repos that might come from subscribed host, because there
# might be other repos provided by user or build system
echo
"Running: yum-config-manager --disable rhel-\*"
yum-config-manager --disable rhel-
\*
&
> /dev/null
||
:
fi
if
[
${
SKIP_REPOS_ENABLE
}
=
false
]
&&
[
-n
"
${
DEFAULT_REPOS
}
"
-o
$#
-gt
0
]
;
then
echo
"Running: yum-config-manager --enable
${
DEFAULT_REPOS
}
$@
"
yum-config-manager --enable
${
DEFAULT_REPOS
}
"
$@
"
fi
File Metadata
Details
Attached
Mime Type
text/x-shellscript
Expires
Sat, Apr 4, 6:20 AM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18822826
Default Alt Text
prepare-yum-repositories (1 KB)
Attached To
Mode
rKOLABSTWOICORE kolab-s2i-core
Attached
Detach File
Event Timeline