Skip to content

Instantly share code, notes, and snippets.

@the-real-neil
Created November 22, 2019 14:59
Show Gist options
  • Save the-real-neil/0a9e2ad9f08a22acd23ac95ee3f2648e to your computer and use it in GitHub Desktop.
Save the-real-neil/0a9e2ad9f08a22acd23ac95ee3f2648e to your computer and use it in GitHub Desktop.
FROM ros
ENV ROSDEP_DEFAULT_LIST="/etc/ros/rosdep/sources.list.d/20-default.list"
ENV DEFAULT_INDEX_URL="https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml"
ENV ROSDISTRO_INDEX_URL="file:///var/lib/rosdep/https_raw.githubusercontent.com_ros_rosdistro_master_index-v4.yaml"
RUN set -eu \
&& apt-get -y update \
&& apt-get -y install curl \
&& http_uris="$(mktemp -t http_uris.XXXXXX)" \
&& sed -nr 's/^(gbpdistro|yaml) (http[[:graph:]]+)(.*)$/\2/gp' \
<"${ROSDEP_DEFAULT_LIST}" \
>"${http_uris}" \
&& while read http_uri; do \
file_uri="file:///var/lib/rosdep/$(printf '%s' "${http_uri}" | tr -sc '[:alnum:]._-' '_')" \
&& curl --create-dirs -fsSLo "${file_uri#file://}" "${http_uri}" \
&& sed -i "s|${http_uri}|${file_uri}|g" "${ROSDEP_DEFAULT_LIST}" \
; done <"${http_uris}" \
&& curl --create-dirs -fsSLo "${ROSDISTRO_INDEX_URL#file://}" "${DEFAULT_INDEX_URL}" \
&& rosdep update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment