[Why] Not all sources of one repo file are enabled, sometimes we need to enable all sources to install the specified pkg.
Signed-off-by: Yu Chuan 13186087857@163.com --- jobs/iso2rootfs.yaml | 1 + tests/iso2rootfs | 12 ++++++++++++ 2 files changed, 13 insertions(+)
diff --git a/jobs/iso2rootfs.yaml b/jobs/iso2rootfs.yaml index 2a6455245584..55c4345fad94 100644 --- a/jobs/iso2rootfs.yaml +++ b/jobs/iso2rootfs.yaml @@ -32,6 +32,7 @@ iso2rootfs: # - dns: will config /etc/resolv.conf. # - no_selinux: will disable selinux in /etc/selinux/config. # - no_fstab: will comment all line in /etc/fstab. + # - enable_repos: will enable all repo file of result rootfs. config_rootfs:
## install pkgs for result rootfs diff --git a/tests/iso2rootfs b/tests/iso2rootfs index 65a1935b7f49..06c8565110ab 100755 --- a/tests/iso2rootfs +++ b/tests/iso2rootfs @@ -393,11 +393,23 @@ install_pkgs_for_rootfs() fi }
+enable_repos() +{ + echo "${config_rootfs}" | grep -qw 'enable_repos' || return 0 + + ls ${ROOTFS_DES_DIR}/etc/yum.repos.d/*.repo > /dev/null 2>&1 && { + sed -i 's/^enabled=0$/enabled=1/g' ${ROOTFS_DES_DIR}/etc/yum.repos.d/*.repo + } + + return 0 +} + config_rootfs() { config_dns_resolver disable_selinux disable_fstab + enable_repos
install_pkgs_for_rootfs }
On Tue, Feb 02, 2021 at 09:57:21AM +0800, Yu Chuan wrote:
[Why] Not all sources of one repo file are enabled, sometimes we need to enable all sources to install the specified pkg.
Signed-off-by: Yu Chuan 13186087857@163.com
jobs/iso2rootfs.yaml | 1 + tests/iso2rootfs | 12 ++++++++++++ 2 files changed, 13 insertions(+)
diff --git a/jobs/iso2rootfs.yaml b/jobs/iso2rootfs.yaml index 2a6455245584..55c4345fad94 100644 --- a/jobs/iso2rootfs.yaml +++ b/jobs/iso2rootfs.yaml @@ -32,6 +32,7 @@ iso2rootfs: # - dns: will config /etc/resolv.conf. # - no_selinux: will disable selinux in /etc/selinux/config. # - no_fstab: will comment all line in /etc/fstab.
# - enable_repos: will enable all repo file of result rootfs. config_rootfs:
## install pkgs for result rootfs
diff --git a/tests/iso2rootfs b/tests/iso2rootfs index 65a1935b7f49..06c8565110ab 100755 --- a/tests/iso2rootfs +++ b/tests/iso2rootfs @@ -393,11 +393,23 @@ install_pkgs_for_rootfs() fi }
+enable_repos() +{
- echo "${config_rootfs}" | grep -qw 'enable_repos' || return 0
Why not get 'enable_repos' from env vars?
- ls ${ROOTFS_DES_DIR}/etc/yum.repos.d/*.repo > /dev/null 2>&1 && {
Is this line needed?
Thanks, Xueliang
sed -i 's/^enabled=0$/enabled=1/g' ${ROOTFS_DES_DIR}/etc/yum.repos.d/*.repo
- }
- return 0
+}
config_rootfs() { config_dns_resolver disable_selinux disable_fstab
enable_repos
install_pkgs_for_rootfs
}
2.23.0
+++ b/jobs/iso2rootfs.yaml @@ -32,6 +32,7 @@ iso2rootfs: # - dns: will config /etc/resolv.conf. # - no_selinux: will disable selinux in /etc/selinux/config. # - no_fstab: will comment all line in /etc/fstab.
# - enable_repos: will enable all repo file of result rootfs. config_rootfs:
## install pkgs for result rootfs
+enable_repos() +{
- echo "${config_rootfs}" | grep -qw 'enable_repos' || return 0
Why not get 'enable_repos' from env vars?
just follow the above code part, ${conifg_rootfs} is a env var, and a list of optional config items, such as dns, no_selinux, no_fstab, enable_repos.
- ls ${ROOTFS_DES_DIR}/etc/yum.repos.d/*.repo > /dev/null 2>&1 && {
Is this line needed?
I think so, because in some os, /etc/yum.repos.d/ is empty, and on the other hand, os like debian, ubuntu, do not have /etc/yum.repos.d/.
so if we have os like debian, ubuntu, we can add another 'if' code.
-------- Thanks Yu Chuan
Thanks, Xueliang
sed -i 's/^enabled=0$/enabled=1/g' ${ROOTFS_DES_DIR}/etc/yum.repos.d/*.repo
- }
- return 0
+}
config_rootfs() { config_dns_resolver disable_selinux disable_fstab
enable_repos
install_pkgs_for_rootfs
}
2.23.0