diff --git a/hack/build-image b/hack/build-image index 38b3953..2388184 100755 --- a/hack/build-image +++ b/hack/build-image @@ -106,7 +106,7 @@ PACKAGES_FROM = { DEFAULT: "", NIGHTLY: "samba-nightly", DEVBUILDS: "devbuilds", - CUSTOM: "custom-repo" + CUSTOM: "custom-repos" } # SOURCE_DIRS - image source paths diff --git a/images/server/Containerfile.centos b/images/server/Containerfile.centos index f494c44..7892bc0 100644 --- a/images/server/Containerfile.centos +++ b/images/server/Containerfile.centos @@ -3,9 +3,8 @@ ARG INSTALL_PACKAGES_FROM=default ARG SAMBA_VERSION_SUFFIX="" ARG SAMBACC_VERSION_SUFFIX="" ARG SAMBA_SPECIFICS=daemon_cli_debug_output,ctdb_leader_admin_command -ARG INSTALL_CUSTOM_REPO= +ARG INSTALL_CUSTOM_REPOS= ARG PACKAGE_SELECTION= -ARG CUSTOM_REPOS= MAINTAINER John Mulligan @@ -20,8 +19,7 @@ COPY install-packages.sh /usr/local/bin/install-packages.sh RUN /usr/local/bin/install-packages.sh \ "--install-packages-from=${INSTALL_PACKAGES_FROM}" \ "--samba-version-suffix=${SAMBA_VERSION_SUFFIX}" \ - "--install-custom-repo=${INSTALL_CUSTOM_REPO}" \ - "--custom-repos=${CUSTOM_REPOS}" \ + "--install-custom-repos=${INSTALL_CUSTOM_REPOS}" \ "--package-selection=${PACKAGE_SELECTION}" # If you want to install a custom version of sambacc into this image mount diff --git a/images/server/install-packages.sh b/images/server/install-packages.sh index 0d6aba0..1ca92a8 100755 --- a/images/server/install-packages.sh +++ b/images/server/install-packages.sh @@ -10,20 +10,30 @@ need_curl() { dnf install --setopt=install_weak_deps=False -y /usr/bin/curl } -get_custom_repo() { - url="$1" - fname="$(basename "$url")" - dest="/etc/yum.repos.d/${fname}" - while [ -e "$dest" ]; do - u="$(echo "${url}" | sha256sum | head -c12)" - if [ -z "$u" ]; then - echo "failed to uniquify repo file name" - exit 2 +get_custom_repos() { + if [[ -n $1 ]]; then + urls=$1 + need_curl + if [[ $ceph_from_custom -ne 1 ]]; then + get_distro_ceph_repo fi - dest="/etc/yum.repos.d/${u}-${fname}" - done - need_curl - curl -L "$url" -o "$dest" + for url in $urls; do + fname="$(basename "$url")" + dest="/etc/yum.repos.d/${fname}" + if [ -e "$dest" ]; then + u="$(echo "${url}" | sha256sum | head -c12)" + if [ -z "$u" ]; then + echo "failed to uniquify repo file name" + exit 2 + fi + dest="/etc/yum.repos.d/${u}-${fname}" + if [ -e "$dest" ]; then + continue + fi + fi + curl -L "$url" -o "$dest" + done + fi } generate_repo_from_shaman() { @@ -49,7 +59,7 @@ EOF } get_samba_nightly_repo() { - get_custom_repo "https://artifacts.ci.centos.org/samba/pkgs/master/${OS_BASE}/samba-nightly-master.repo" + get_custom_repos "https://artifacts.ci.centos.org/samba/pkgs/master/${OS_BASE}/samba-nightly-master.repo" } get_sig_samba_repo() { @@ -72,6 +82,12 @@ get_epel_repo_if_needed() { fi } +get_glusterfs_repo_if_needed() { + if [[ "${OS_BASE}" = centos ]]; then + dnf install --setopt=install_weak_deps=False -y centos-release-gluster + fi +} + get_ceph_shaman_repo() { ceph_ref="${CEPH_REPO_REF:-main}" ceph_sha="${CEPH_REPO_SHA:-latest}" @@ -87,12 +103,9 @@ if [[ "$1" =~ ^--.+$ ]]; then case "$arg" in --install-packages-from=*) install_packages_from="${arg/*=/}" ;; --samba-version-suffix=*) samba_version_suffix="${arg/*=/}" ;; - --install-custom-repo=*) install_custom_repo="${arg/*=/}" ;; + --install-custom-repos=*) install_custom_repos="${arg/*=/}" ;; --package-selection=*) package_selection="${arg/*=/}" ;; - --custom-repos=*) - IFS=' ' read -ra custom_repos <<< "${arg/*=/}" - for x in "${custom_repos[@]}"; do echo custom repo: "$x"; done - ;; + --ceph-from-custom) ceph_from_custom=1 ;; *) echo "error: unexpected argument: ${arg}" exit 2 @@ -103,7 +116,7 @@ else # legacy positional only install_packages_from="$1" samba_version_suffix="$2" - install_custom_repo="$3" + install_custom_repos="$3" package_selection="$4" fi @@ -111,6 +124,7 @@ fi OS_BASE="$(. /etc/os-release && echo "${ID}")" get_epel_repo_if_needed +get_glusterfs_repo_if_needed case "${install_packages_from}" in samba-nightly) @@ -124,20 +138,12 @@ case "${install_packages_from}" in get_ceph_shaman_repo package_selection=${package_selection:-devbuilds} ;; - custom-repo) - get_custom_repo "${install_custom_repo}" - customized=0 - for crepo in "${custom_repos[@]}" ; do - get_custom_repo "${crepo}" - customized=1 - done - if [ $customized != 1 ]; then - get_distro_ceph_repo - fi - package_selection=${package_selection:-custom} + custom-repos) + get_custom_repos "${install_custom_repos}" + package_selection=${package_selection:-custom-repos-devbuilds} ;; custom-devbuilds) - get_custom_repo "${install_custom_repo}" + get_custom_repos "${install_custom_repos}" get_ceph_shaman_repo package_selection=${package_selection:-custom-devbuilds} ;; @@ -182,8 +188,7 @@ case "${package_selection}-${OS_BASE}" in # Fall through to next case ;& nightly-centos|default-centos) - dnf_cmd+=(--enablerepo=epel) - samba_packages+=(samba-vfs-cephfs ctdb-ceph-mutex) + samba_packages+=(samba-vfs-cephfs samba-vfs-glusterfs ctdb-ceph-mutex) # these packages should be installed as deps. of sambacc extras # however, the sambacc builds do not enable the extras on centos atm. # Once this is fixed this line ought to be removed.