@@ -100,6 +100,16 @@ if [ -n "$PT_version" ]; then
100100 version=$PT_version
101101fi
102102
103+ if [ -n " $PT_username " ]; then
104+ username=$PT_username
105+ else
106+ username=' forge-key'
107+ fi
108+
109+ if [ -n " $PT_password " ]; then
110+ password=$PT_password
111+ fi
112+
103113if [ -n " $PT_collection " ]; then
104114 # Check whether collection is nightly
105115 if [[ " $PT_collection " == * " nightly" * ]]; then
116126if [ -n " $PT_yum_source " ]; then
117127 yum_source=$PT_yum_source
118128else
119- if [ " $nightly " = true ]; then
120- yum_source=' http://nightlies.puppet.com/yum'
129+ if [[ " $collection " == " puppetcore" * ]]; then
130+ yum_source=' https://yum-puppetcore.puppet.com/public'
131+ if [ -z " $password " ]; then
132+ echo " A password parameter is required to install from ${yum_source} "
133+ exit 1
134+ fi
121135 else
122- yum_source=' http://yum.puppet.com'
136+ if [ " $nightly " = true ]; then
137+ yum_source=' http://nightlies.puppet.com/yum'
138+ else
139+ yum_source=' http://yum.puppet.com'
140+ fi
123141 fi
124142fi
125143
@@ -582,7 +600,14 @@ install_file() {
582600 fi
583601 fi
584602
603+ repo=" /etc/yum.repos.d/${collection/ core/ } -release.repo"
585604 rpm -Uvh --oldpackage --replacepkgs " $2 "
605+ if [[ -n $username ]]; then
606+ sed -i " s/^#\?username=.*/username=${username} /" " ${repo} "
607+ fi
608+ if [[ -n $password ]]; then
609+ sed -i " s/^#\?password=.*/password=${password} /" " ${repo} "
610+ fi
586611 exists dnf && PKGCMD=dnf || PKGCMD=yum
587612 if test " $version " = ' latest' ; then
588613 run_cmd " ${PKGCMD} install -y puppet-agent && ${PKGCMD} upgrade -y puppet-agent"
@@ -607,6 +632,12 @@ install_file() {
607632 fi
608633
609634 run_cmd " zypper install --no-confirm '$2 '"
635+ if [[ -n $username ]]; then
636+ sed -i " s/^username=.*/username=${username} /" " /etc/zypp/credentials.d/PuppetcoreCreds"
637+ fi
638+ if [[ -n $password ]]; then
639+ sed -i " s/^password=.*/password=${password} /" " /etc/zypp/credentials.d/PuppetcoreCreds"
640+ fi
610641 if test " $version " = " latest" ; then
611642 run_cmd " zypper install --no-confirm 'puppet-agent'"
612643 else
@@ -669,22 +700,31 @@ case $platform in
669700 info " SLES platform! Lets get you an RPM..."
670701
671702 if [[ $PT__noop != true ]]; then
672- for key in " puppet" " puppet-20250406" ; do
673- gpg_key=" ${tmp_dir} /RPM-GPG-KEY-${key} "
674- do_download " https://yum.puppet.com/RPM-GPG-KEY-${key} " " $gpg_key "
675- rpm --import " $gpg_key "
676- rm -f " $gpg_key "
677- done
703+ if [[ " $PT_collection " =~ core ]]; then
704+ for key in " puppet" ; do
705+ gpg_key=" ${tmp_dir} /RPM-GPG-KEY-${key} "
706+ do_download " https://yum-puppetcore.puppet.com/public/RPM-GPG-KEY-${key} " " $gpg_key "
707+ rpm --import " $gpg_key "
708+ rm -f " $gpg_key "
709+ done
710+ else
711+ for key in " puppet" " puppet-20250406" ; do
712+ gpg_key=" ${tmp_dir} /RPM-GPG-KEY-${key} "
713+ do_download " https://yum.puppet.com/public/RPM-GPG-KEY-${key} " " $gpg_key "
714+ rpm --import " $gpg_key "
715+ rm -f " $gpg_key "
716+ done
717+ fi
678718 fi
679719
680720 filetype=" noarch.rpm"
681- filename=" ${collection} -release-sles-${platform_version} .noarch.rpm"
721+ filename=" ${collection/ core / } -release-sles-${platform_version} .noarch.rpm"
682722 download_url=" ${yum_source} /${filename} "
683723 ;;
684724 " el" )
685725 info " Red hat like platform! Lets get you an RPM..."
686726 filetype=" rpm"
687- filename=" ${collection} -release-el-${platform_version} .noarch.rpm"
727+ filename=" ${collection/ core / } -release-el-${platform_version} .noarch.rpm"
688728 download_url=" ${yum_source} /${filename} "
689729 ;;
690730 " Amzn" |" Amazon Linux" )
@@ -698,13 +738,13 @@ case $platform in
698738 elif (( platform_version == 2 || platform_version >= 2023 )) ; then
699739 platform_package=" amazon"
700740 fi
701- filename=" ${collection} -release-${platform_package} -${platform_version} .noarch.rpm"
741+ filename=" ${collection/ core / } -release-${platform_package} -${platform_version} .noarch.rpm"
702742 download_url=" ${yum_source} /${filename} "
703743 ;;
704744 " Fedora" )
705745 info " Fedora platform! Lets get the RPM..."
706746 filetype=" rpm"
707- filename=" ${collection} -release-fedora-${platform_version} .noarch.rpm"
747+ filename=" ${collection/ core / } -release-fedora-${platform_version} .noarch.rpm"
708748 download_url=" ${yum_source} /${filename} "
709749 ;;
710750 " Debian" )
0 commit comments