File tree Expand file tree Collapse file tree
parts/linux/cloud-init/artifacts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -566,32 +566,6 @@ semverCompare() {
566566 return 1
567567}
568568
569-
570-
571- apt_get_download () {
572- retries=$1 ; wait_sleep=$2 ; shift && shift ;
573- local ret=0
574- pushd $APT_CACHE_DIR || return 1
575- for i in $( seq 1 " $retries " ) ; do
576- dpkg --configure -a --force-confdef
577- wait_for_apt_locks
578-
579- # Pull the first quoted URL from --print-uris
580- url=" $( apt-get --print-uris -o Dpkg::Options::=--force-confold download -y -- " $@ " \
581- | awk -F" '" ' NR==1 && $2 {print $2}' ) "
582- if [ -n " $url " ]; then
583- # This avoids issues with the naming in the package. `apt-get download`
584- # encodes the package names with special characters and does not decode
585- # them when saving to disk, but `curl -J` handles the names correctly.
586- if curl -fLJO -- " $url " ; then ret=0; break ; fi
587- fi
588-
589- if [ " $i " -eq " $retries " ]; then ret=1; else sleep " $wait_sleep " ; fi
590- done
591- popd || return 1
592- return " $ret "
593- }
594-
595569getCPUArch () {
596570 arch=$( uname -m)
597571 # shellcheck disable=SC3010
Original file line number Diff line number Diff line change @@ -178,4 +178,28 @@ apt_get_install_from_local_repo() {
178178
179179 return 0
180180}
181+
182+ apt_get_download () {
183+ retries=$1 ; wait_sleep=$2 ; shift && shift ;
184+ local ret=0
185+ pushd $APT_CACHE_DIR || return 1
186+ for i in $( seq 1 " $retries " ) ; do
187+ dpkg --configure -a --force-confdef
188+ wait_for_apt_locks
189+
190+ # Pull the first quoted URL from --print-uris
191+ url=" $( apt-get --print-uris -o Dpkg::Options::=--force-confold download -y -- " $@ " \
192+ | awk -F" '" ' NR==1 && $2 {print $2}' ) "
193+ if [ -n " $url " ]; then
194+ # This avoids issues with the naming in the package. `apt-get download`
195+ # encodes the package names with special characters and does not decode
196+ # them when saving to disk, but `curl -J` handles the names correctly.
197+ if curl -fLJO -- " $url " ; then ret=0; break ; fi
198+ fi
199+
200+ if [ " $i " -eq " $retries " ]; then ret=1; else sleep " $wait_sleep " ; fi
201+ done
202+ popd || return 1
203+ return " $ret "
204+ }
181205# EOF
You can’t perform that action at this time.
0 commit comments