162
162
if [ -n " $PT_mac_source " ]; then
163
163
mac_source=$PT_mac_source
164
164
else
165
- if [ " $nightly " = true ]; then
166
- mac_source=' http://nightlies.puppet.com/downloads'
167
- else
168
- mac_source=' http://downloads.puppet.com'
165
+ if [[ " $PT_collection " =~ core ]]; then
166
+ if [ -z " $password " ]; then
167
+ echo " A password parameter is required to install with puppetcore"
168
+ exit 1
169
+ fi
170
+ mac_source=' https://artifacts-puppetcore.puppet.com/v1/download'
171
+ else
172
+ if [ " $nightly " = true ]; then
173
+ mac_source=' http://nightlies.puppet.com/downloads'
174
+ else
175
+ mac_source=' http://downloads.puppet.com'
176
+ fi
169
177
fi
170
178
fi
171
179
@@ -421,7 +429,11 @@ do_wget() {
421
429
# do_curl URL FILENAME
422
430
do_curl () {
423
431
info " Trying curl..."
424
- run_cmd " curl -1 -sL -D $tmp_stderr '$1 ' > '$2 '"
432
+ if [[ -n " $3 " && -n " $4 " ]]; then
433
+ run_cmd " curl -1 -sL -u '$3 :$4 ' -D $tmp_stderr '$1 ' > '$2 '"
434
+ else
435
+ run_cmd " curl -1 -sL -D $tmp_stderr '$1 ' > '$2 '"
436
+ fi
425
437
rc=$?
426
438
427
439
# check for 404
@@ -431,6 +443,12 @@ do_curl() {
431
443
unable_to_retrieve_package
432
444
fi
433
445
446
+ grep " HTTP/2 401" $tmp_stderr 2>&1 > /dev/null
447
+ if test $? -eq 0; then
448
+ critical " ERROR 401: Unauthorized access"
449
+ unable_to_retrieve_package
450
+ fi
451
+
434
452
# check for bad return status or empty output
435
453
if test $rc -ne 0 || test ! -s " $2 " ; then
436
454
capture_tmp_stderr " curl"
@@ -557,7 +575,11 @@ do_download() {
557
575
fi
558
576
559
577
if exists curl; then
560
- do_curl $1 $2 && return 0
578
+ if [[ " $collection " =~ core ]]; then
579
+ do_curl $1 $2 " $username " " $password " && return 0
580
+ else
581
+ do_curl $1 $2 && return 0
582
+ fi
561
583
fi
562
584
563
585
if exists fetch; then
@@ -810,19 +832,31 @@ case $platform in
810
832
download_url=" ${apt_source} /${filename} "
811
833
;;
812
834
" mac_os_x" )
813
- info " Mac platform! Lets get you a DMG..."
814
- filetype=" dmg"
835
+ arch=" x86_64"
836
+ if [[ $( uname -p) == " arm" ]]; then
837
+ arch=" arm64"
838
+ fi
815
839
if test " $version " = " latest" ; then
816
840
filename=" puppet-agent-latest.dmg"
817
841
else
818
842
filename=" puppet-agent-${version} -1.osx${platform_version} .dmg"
819
843
fi
820
-
821
- arch=" x86_64"
822
- if [[ $( uname -p) == " arm" ]]; then
823
- arch=" arm64"
844
+ info " Mac platform! Lets get you a DMG...!!"
845
+ if [[ " $collection " =~ core ]]; then
846
+ if [ -z " $password " ]; then
847
+ echo " A password parameter is required to install"
848
+ exit 1
849
+ fi
850
+ if [[ " $version " =~ ^([0-9]+)\. ([0-9]+)\. ([0-9]+)\. ([0-9]+)\. g([a-f0-9]+)$ ]]; then
851
+ download_url=" ${mac_source} /?version=${version} &os_name=osx&os_version=${platform_version} &os_arch=${arch} &fips=false&dev=true"
852
+ else
853
+ download_url=" ${mac_source} /?version=${version} &os_name=osx&os_version=${platform_version} &os_arch=${arch} &fips=false"
854
+ fi
855
+ else
856
+ download_url=" ${mac_source} /mac/${collection} /${platform_version} /${arch} /${filename} "
824
857
fi
825
- download_url=" ${mac_source} /mac/${collection} /${platform_version} /${arch} /${filename} "
858
+ filetype=" dmg"
859
+
826
860
;;
827
861
* )
828
862
critical " Sorry $platform is not supported yet!"
0 commit comments