From 65b8a3f4386bde663b81f2f39eb1295c3a3381c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Cruz?= Date: Fri, 23 Feb 2024 22:06:39 -0300 Subject: [PATCH] fix 1 --- devcontainers/scripts/cmake.sh | 3 +++ devcontainers/scripts/ninja.sh | 2 +- devcontainers/scripts/protoc.sh | 25 +++++++++++++------ devcontainers/ssl-core-cpp-base.Dockerfile | 18 ++++++------- devcontainers/ssl-core-python-base.Dockerfile | 2 +- 5 files changed, 32 insertions(+), 18 deletions(-) diff --git a/devcontainers/scripts/cmake.sh b/devcontainers/scripts/cmake.sh index 4fceb64..7455ac6 100644 --- a/devcontainers/scripts/cmake.sh +++ b/devcontainers/scripts/cmake.sh @@ -20,6 +20,9 @@ echo -e "\x1B[01;93mInstalling or updating cmake...\n\u001b[0m" TMP_DIR="/tmp/cmake" +rm -rf "${TMP_DIR}" +mkdir -p "${TMP_DIR}" + wget "https://github.com/Kitware/CMake/releases/download/v${VERSION}/cmake-${VERSION}.tar.gz" -O "${TMP_DIR}/cmake.tar.gz" tar -xvf "${TMP_DIR}/cmake.tar.gz" -C "${TMP_DIR}" diff --git a/devcontainers/scripts/ninja.sh b/devcontainers/scripts/ninja.sh index d741345..e458977 100644 --- a/devcontainers/scripts/ninja.sh +++ b/devcontainers/scripts/ninja.sh @@ -17,7 +17,7 @@ if [ -z "${VERSION}" ]; then exit 1 fi -DEST_DIR="." # "/usr/local/bin" +DEST_DIR="/usr/local/bin" TMP_DIR="/tmp/ninja" echo -e "\x1B[01;93mInstalling or updating ninja...\n\u001b[0m" diff --git a/devcontainers/scripts/protoc.sh b/devcontainers/scripts/protoc.sh index d188070..3902f57 100644 --- a/devcontainers/scripts/protoc.sh +++ b/devcontainers/scripts/protoc.sh @@ -9,10 +9,17 @@ if ! is_root; then exit 1 fi -INSTALL_DIR="${1}" +VERSION="${1}" +PARENT_DIR="${2}" +CURRENT_USER=$(who | awk 'NR==1{print $1}') -if [ -z "${INSTALL_DIR}" ]; then - INSTALL_DIR="/usr" +if [ -z "${VERSION}" ]; then + echo -e "\x1B[31m[ERROR] No version specified." + exit 1 +fi + +if [ -z "${PARENT_DIR}" ]; then + PARENT_DIR="/usr/local" fi TMP_DIR="/tmp/protoc" @@ -20,9 +27,13 @@ TMP_DIR="/tmp/protoc" rm -rf "${TMP_DIR}" mkdir -p "${TMP_DIR}" -pushd "${TMP_DIR}" || exit 1 +curl -sSL "https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-linux-x86_64.zip" -o "${TMP_DIR}/protoc-${VERSION}.zip" +unzip -qo "${TMP_DIR}/protoc-${VERSION}.zip" -d "${TMP_DIR}/protoc-${VERSION}" + +rsync -a --include="*/***" --exclude="*" "${TMP_DIR}/protoc-${VERSION}/" "${PARENT_DIR}/" + +rm -rf "${TMP_DIR}" -curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip -unzip -o protoc-23.3-linux-x86_64.zip -d "${INSTALL_DIR}" +chmod +x "${PARENT_DIR}/bin/protoc" -popd || exit 1 \ No newline at end of file +chown "${CURRENT_USER}":"${CURRENT_USER}" "${PARENT_DIR}" -R # changes the owner of the directory to the current user diff --git a/devcontainers/ssl-core-cpp-base.Dockerfile b/devcontainers/ssl-core-cpp-base.Dockerfile index 82aed25..954ce64 100644 --- a/devcontainers/ssl-core-cpp-base.Dockerfile +++ b/devcontainers/ssl-core-cpp-base.Dockerfile @@ -1,6 +1,6 @@ -FROM mcr.microsoft.com/vscode/devcontainers/base:latest +FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu -ARG GCC_VERSION='12' +ARG GCC_VERSION='13' ARG LLVM_VERSION='18' ARG CMAKE_VERSION='3.29.0-rc2' ARG NINJA_VERSION='1.11.1' @@ -13,19 +13,19 @@ WORKDIR /tmp/scripts RUN apt update && apt upgrade -y && \ \ - bash gcc.sh '${GCC_VERSION}' && \ - bash llvm.sh '${LLVM_VERSION}' && \ - bash cmake.sh '${CMAKE_VERSION}' && \ - bash ninja.sh '${NINJA_VERSION}' && \ + bash gcc.sh ${GCC_VERSION} && \ + bash llvm.sh ${LLVM_VERSION} && \ + bash cmake.sh ${CMAKE_VERSION} && \ + bash ninja.sh ${NINJA_VERSION} && \ \ bash googletest.sh '/usr/local' && \ bash benchmark.sh '/usr/local' && \ \ bash protobuf.sh '/usr/local' && \ \ - bash libzmq.sh '${LIBZMQ_VERSION}' '/usr/local' && \ - bash cppzmq.sh '${CPPZMQ_VERSION}' '/usr/local' && \ + bash libzmq.sh ${LIBZMQ_VERSION} '/usr/local' && \ + bash cppzmq.sh ${CPPZMQ_VERSION} '/usr/local' && \ \ - bash buf.sh '${BUF_VERSION}' '/usr/local/bin' + bash buf.sh ${BUF_VERSION} '/usr/local/bin' RUN rm -rf /tmp/scripts diff --git a/devcontainers/ssl-core-python-base.Dockerfile b/devcontainers/ssl-core-python-base.Dockerfile index 9e85e3b..8d7a134 100644 --- a/devcontainers/ssl-core-python-base.Dockerfile +++ b/devcontainers/ssl-core-python-base.Dockerfile @@ -6,6 +6,6 @@ COPY devcontainers/scripts /tmp/scripts WORKDIR /tmp/scripts RUN apt update && apt upgrade -y && \ - bash protoc.sh '${PROTOC_VERSION}' '/usr/local/bin' + bash protoc.sh ${PROTOC_VERSION} '/usr/local/bin' RUN rm -rf /tmp/scripts