diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..2f16dcf --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,40 @@ + + +### Additional Information + +#### Version of s3fs being used (`s3fs --version`) + + +#### Version of fuse being used (`pkg-config --modversion fuse`, `rpm -qi fuse` or `dpkg -s fuse`) + + +#### Kernel information (`uname -r`) + + +#### GNU/Linux Distribution, if applicable (`cat /etc/os-release`) + + +#### How to run s3fs, if applicable + +[] command line +[] /etc/fstab + + +``` +``` + +#### s3fs syslog messages (`grep s3fs /var/log/syslog`, `journalctl | grep s3fs`, or `s3fs outputs`) + +``` +``` + +### Details about issue + + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..5de593c --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,11 @@ + + +### Relevant Issue (if applicable) + + +### Details + + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..463d0db --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,297 @@ +# +# s3fs - FUSE-based file system backed by Amazon S3 +# +# Copyright(C) 2007 Takeshi Nakatani +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + +name: s3fs-fuse CI + +on: + push: + pull_request: + # + # CRON event is fire on every sunday(UTC). + # + schedule: + - cron: '0 0 * * 0' + +# +# Jobs +# +jobs: + Linux: + runs-on: ubuntu-latest + + # + # build matrix for containers + # + strategy: + # + # do not stop jobs automatically if any of the jobs fail + # + fail-fast: false + + # + # matrix for containers + # + matrix: + container: + - ubuntu:23.10 + - ubuntu:22.04 + - ubuntu:20.04 + - debian:bookworm + - debian:bullseye + - debian:buster + - rockylinux:9 + - rockylinux:8 + - centos:centos7 + - fedora:39 + - fedora:38 + - opensuse/leap:15 + - alpine:3.19 + + container: + image: ${{ matrix.container }} + + options: "--privileged --cap-add SYS_ADMIN --device /dev/fuse" + + env: + # [NOTE] + # Installation special environment variables for debian and ubuntu. + # + DEBIAN_FRONTEND: noninteractive + + steps: + # [NOTE] + # On openSUSE, tar and gzip must be installed before action/checkout. + # + - name: Install packages before checkout + run: | + if [ "${{ matrix.container }}" = "opensuse/leap:15" ]; then zypper install -y tar gzip; fi + + # [NOTE] + # actions/checkout@v3 uses nodejs v16 and will be deprecated. + # However, @v4 does not work on centos7 depending on the glibc version, + # so we will continue to use @v3. + # + - name: Checkout source code(other than centos7) + if: matrix.container != 'centos:centos7' + uses: actions/checkout@v4 + + - name: Checkout source code(only centos7) + if: matrix.container == 'centos:centos7' + uses: actions/checkout@v3 + + # [NOTE] + # Matters that depend on OS:VERSION are determined and executed in the following script. + # Please note that the option to configure (CONFIGURE_OPTIONS) is set in the environment variable. + # + - name: Install packages + run: | + .github/workflows/linux-ci-helper.sh ${{ matrix.container }} + + - name: Build + run: | + ./autogen.sh + /bin/sh -c "./configure ${CONFIGURE_OPTIONS}" + make --jobs=$(nproc) + + - name: clang-tidy + run: | + # skip if clang-tidy does not exist, e.g., CentOS 7 + if command -v clang-tidy; then + make -C src/ clang-tidy + make -C test/ clang-tidy + fi + + - name: Cppcheck + run: | + # specify the version range to run cppcheck (cppcheck version number is x.y or x.y.z) + if cppcheck --version | sed -e 's/\./ /g' | awk '{if (($2 * 1000 + $3) <= 2004) { exit(1) } }'; then + make cppcheck + fi + + - name: Shellcheck + run: | + if shellcheck --version | awk -F '[ .]' '/version:/ && ($2 * 1000 + $3 <= 7) { exit(1) }'; then + make shellcheck + fi + + - name: Test suite + run: | + make check -C src + make ALL_TESTS=1 check -C test || (test/filter-suite-log.sh test/test-suite.log; exit 1) + + # [NOTE] + # Using macos-fuse-t + # This product(package) is a workaround for osxfuse which required an OS reboot(macos 11 and later). + # see. https://github.com/macos-fuse-t/fuse-t + # About osxfuse + # This job doesn't work with Github Actions using macOS 11+ because "load_osxfuse" returns + # "exit code = 1".(requires OS reboot) + # + macos12: + runs-on: macos-12 + + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Brew tap + run: | + TAPS="$(brew --repository)/Library/Taps"; + if [ -e "$TAPS/caskroom/homebrew-cask" ]; then rm -rf "$TAPS/caskroom/homebrew-cask"; fi; + HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/homebrew-cask + HOMEBREW_NO_AUTO_UPDATE=1 brew tap macos-fuse-t/homebrew-cask + + - name: Install fuse-t + run: | + HOMEBREW_NO_AUTO_UPDATE=1 brew install fuse-t + + - name: Install brew other packages + run: | + S3FS_BREW_PACKAGES='automake cppcheck python3 coreutils gnu-sed shellcheck jq'; + for s3fs_brew_pkg in ${S3FS_BREW_PACKAGES}; do if brew list | grep -q ${s3fs_brew_pkg}; then if brew outdated | grep -q ${s3fs_brew_pkg}; then HOMEBREW_NO_AUTO_UPDATE=1 brew upgrade ${s3fs_brew_pkg}; fi; else HOMEBREW_NO_AUTO_UPDATE=1 brew install ${s3fs_brew_pkg}; fi; done; + + - name: Install awscli2 + run: | + cd /tmp + curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" + sudo installer -pkg AWSCLIV2.pkg -target / + + - name: Build + run: | + ./autogen.sh + PKG_CONFIG_PATH=/usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig ./configure CXXFLAGS='-std=c++11 -DS3FS_PTHREAD_ERRORCHECK=1' + make --jobs=$(sysctl -n hw.ncpu) + + - name: Cppcheck + run: | + # specify the version range to run cppcheck (cppcheck version number is x.y or x.y.z) + if cppcheck --version | sed -e 's/\./ /g' | awk '{if (($2 * 1000 + $3) <= 2004) { exit(1) } }'; then + make cppcheck + fi + + - name: Shellcheck + run: | + if shellcheck --version | awk -F '[ .]' '/version:/ && ($2 * 1000 + $3 <= 7) { exit(1) }'; then + make shellcheck + fi + + - name: Test suite + run: | + make check -C src + make ALL_TESTS=1 check -C test || (test/filter-suite-log.sh test/test-suite.log; exit 1) + + MemoryTest: + runs-on: ubuntu-latest + + # + # build matrix for containers + # + strategy: + # + # do not stop jobs automatically if any of the jobs fail + # + fail-fast: false + + # + # matrix for type of checking + # + # [NOTE] + # Currently following test is not supported: + # - sanitize_memory : Future support planned + # + matrix: + checktype: + - glibc_debug + - sanitize_address + - sanitize_others + - sanitize_thread + - valgrind + + container: + image: fedora:39 + + options: "--privileged --cap-add SYS_ADMIN --device /dev/fuse" + + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Install packages + run: | + .github/workflows/linux-ci-helper.sh fedora:39 + + - name: Install clang + run: | + dnf install -y clang + if [ "${{ matrix.checktype }}" = "valgrind" ]; then + dnf install -y valgrind + fi + + # + # Set CXX/CXXFLAGS and Variables for test + # + - name: Set variables + run: | + COMMON_CXXFLAGS='-g -Wno-cpp -DS3FS_PTHREAD_ERRORCHECK=1' + if [ "${{ matrix.checktype }}" = "glibc_debug" ]; then + echo "CXXFLAGS=${COMMON_CXXFLAGS} -O0 -D_GLIBCXX_DEBUG" >> $GITHUB_ENV + elif [ "${{ matrix.checktype }}" = "sanitize_address" ]; then + echo 'CXX=clang++' >> $GITHUB_ENV + echo "CXXFLAGS=${COMMON_CXXFLAGS} -O0 -fsanitize=address -fsanitize-address-use-after-scope" >> $GITHUB_ENV + echo 'ASAN_OPTIONS=detect_leaks=1,detect_stack_use_after_return=1' >> $GITHUB_ENV + elif [ "${{ matrix.checktype }}" = "sanitize_memory" ]; then + echo 'CXX=clang++' >> $GITHUB_ENV + echo "CXXFLAGS=${COMMON_CXXFLAGS} -O0 -fsanitize=memory" >> $GITHUB_ENV + elif [ "${{ matrix.checktype }}" = "sanitize_thread" ]; then + echo 'CXX=clang++' >> $GITHUB_ENV + echo "CXXFLAGS=${COMMON_CXXFLAGS} -O0 -fsanitize=thread" >> $GITHUB_ENV + echo 'TSAN_OPTIONS=halt_on_error=1' >> $GITHUB_ENV + # [NOTE] + # Set this to avoid following error when running configure. + # "FATAL: ThreadSanitizer: unexpected memory mapping" + sysctl vm.mmap_rnd_bits=28 + elif [ "${{ matrix.checktype }}" = "sanitize_others" ]; then + echo 'CXX=clang++' >> $GITHUB_ENV + echo "CXXFLAGS=${COMMON_CXXFLAGS} -O1 -fsanitize=undefined,implicit-conversion,local-bounds,unsigned-integer-overflow" >> $GITHUB_ENV + elif [ "${{ matrix.checktype }}" = "valgrind" ]; then + echo "CXXFLAGS=${COMMON_CXXFLAGS} -O1" >> $GITHUB_ENV + echo 'VALGRIND=--leak-check=full' >> $GITHUB_ENV + echo 'RETRIES=100' >> $GITHUB_ENV + echo 'S3_URL=http://127.0.0.1:8081' >> $GITHUB_ENV + fi + + - name: Build + run: | + ./autogen.sh + /bin/sh -c "CXX=${CXX} CXXFLAGS=\"${CXXFLAGS}\" ./configure --prefix=/usr --with-openssl" + make + + - name: Test suite + run: | + /bin/sh -c "ALL_TESTS=1 ASAN_OPTIONS=${ASAN_OPTIONS} TSAN_OPTIONS=${TSAN_OPTIONS} VALGRIND=${VALGRIND} RETRIES=${RETRIES} make check -C test || (test/filter-suite-log.sh test/test-suite.log; exit 1)" + +# +# Local variables: +# tab-width: 4 +# c-basic-offset: 4 +# End: +# vim600: expandtab sw=4 ts=4 fdm=marker +# vim<600: expandtab sw=4 ts=4 +# diff --git a/.github/workflows/linux-ci-helper.sh b/.github/workflows/linux-ci-helper.sh new file mode 100755 index 0000000..28eb1ab --- /dev/null +++ b/.github/workflows/linux-ci-helper.sh @@ -0,0 +1,307 @@ +#!/bin/sh +# +# s3fs - FUSE-based file system backed by Amazon S3 +# +# Copyright(C) 2007 Takeshi Nakatani +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + +# [NOTE] +# Since bash is not present in some Runner containers, this script +# runs in sh. +# pipefail etc. are not native variables of sh. It exists in bash's +# sh compatibility mode, but doesn't work in sh compatibility mode +# of ash such as alpine. +# However, it's not fatal that pipefail doesn't work for this script. +# +set -o errexit +set -o nounset +#set -o pipefail + +#----------------------------------------------------------- +# Common variables +#----------------------------------------------------------- +PRGNAME=$(basename "$0") + +echo "${PRGNAME} [INFO] Start Linux helper for installing packages." + +#----------------------------------------------------------- +# Parameter check +#----------------------------------------------------------- +# +# Usage: ${PRGNAME} "OS:VERSION" +# +if [ $# -ne 1 ]; then + echo "${PRGNAME} [ERROR] No container name options specified." +fi + +#----------------------------------------------------------- +# Container OS variables +#----------------------------------------------------------- +CONTAINER_FULLNAME=$1 +# shellcheck disable=SC2034 +CONTAINER_OSNAME=$(echo "${CONTAINER_FULLNAME}" | sed 's/:/ /g' | awk '{print $1}') +# shellcheck disable=SC2034 +CONTAINER_OSVERSION=$(echo "${CONTAINER_FULLNAME}" | sed 's/:/ /g' | awk '{print $2}') + +#----------------------------------------------------------- +# Common variables for awscli2 +#----------------------------------------------------------- +AWSCLI_URI="https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" +AWSCLI_ZIP_FILE="awscliv2.zip" + +#----------------------------------------------------------- +# Parameters for configure(set environments) +#----------------------------------------------------------- +CXXFLAGS="-O -DS3FS_PTHREAD_ERRORCHECK=1" +CONFIGURE_OPTIONS="--prefix=/usr --with-openssl" + +#----------------------------------------------------------- +# OS dependent variables +#----------------------------------------------------------- +# +# Default values +# +PACKAGE_ENABLE_REPO_OPTIONS="" +PACKAGE_INSTALL_ADDITIONAL_OPTIONS="" +SHELLCHECK_DIRECT_INSTALL=0 +AWSCLI_DIRECT_INSTALL=1 + +if [ "${CONTAINER_FULLNAME}" = "ubuntu:23.10" ]; then + PACKAGE_MANAGER_BIN="apt-get" + PACKAGE_UPDATE_OPTIONS="update -y -qq" + PACKAGE_INSTALL_OPTIONS="install -y" + + INSTALL_PACKAGES="autoconf autotools-dev clang-tidy openjdk-21-jre-headless fuse jq libfuse-dev libcurl4-openssl-dev libxml2-dev locales-all mime-support libtool pkg-config libssl-dev attr curl python3-pip unzip" + INSTALL_CHECKER_PKGS="cppcheck shellcheck" + INSTALL_CHECKER_PKG_OPTIONS="" + +elif [ "${CONTAINER_FULLNAME}" = "ubuntu:22.04" ]; then + PACKAGE_MANAGER_BIN="apt-get" + PACKAGE_UPDATE_OPTIONS="update -y -qq" + PACKAGE_INSTALL_OPTIONS="install -y" + + INSTALL_PACKAGES="autoconf autotools-dev clang-tidy openjdk-17-jre-headless fuse jq libfuse-dev libcurl4-openssl-dev libxml2-dev locales-all mime-support libtool pkg-config libssl-dev attr curl python3-pip unzip" + INSTALL_CHECKER_PKGS="cppcheck shellcheck" + INSTALL_CHECKER_PKG_OPTIONS="" + +elif [ "${CONTAINER_FULLNAME}" = "ubuntu:20.04" ]; then + PACKAGE_MANAGER_BIN="apt-get" + PACKAGE_UPDATE_OPTIONS="update -y -qq" + PACKAGE_INSTALL_OPTIONS="install -y" + + INSTALL_PACKAGES="autoconf autotools-dev clang-tidy openjdk-17-jre-headless fuse jq libfuse-dev libcurl4-openssl-dev libxml2-dev locales-all mime-support libtool pkg-config libssl-dev attr curl python3-pip unzip" + INSTALL_CHECKER_PKGS="cppcheck shellcheck" + INSTALL_CHECKER_PKG_OPTIONS="" + +elif [ "${CONTAINER_FULLNAME}" = "debian:bookworm" ]; then + PACKAGE_MANAGER_BIN="apt-get" + PACKAGE_UPDATE_OPTIONS="update -y -qq" + PACKAGE_INSTALL_OPTIONS="install -y" + + INSTALL_PACKAGES="autoconf autotools-dev clang-tidy openjdk-17-jre-headless fuse jq libfuse-dev libcurl4-openssl-dev libxml2-dev locales-all mime-support libtool pkg-config libssl-dev attr curl procps python3-pip unzip" + INSTALL_CHECKER_PKGS="cppcheck shellcheck" + INSTALL_CHECKER_PKG_OPTIONS="" + +elif [ "${CONTAINER_FULLNAME}" = "debian:bullseye" ]; then + PACKAGE_MANAGER_BIN="apt-get" + PACKAGE_UPDATE_OPTIONS="update -y -qq" + PACKAGE_INSTALL_OPTIONS="install -y" + + INSTALL_PACKAGES="autoconf autotools-dev clang-tidy openjdk-17-jre-headless fuse jq libfuse-dev libcurl4-openssl-dev libxml2-dev locales-all mime-support libtool pkg-config libssl-dev attr curl procps python3-pip unzip" + INSTALL_CHECKER_PKGS="cppcheck shellcheck" + INSTALL_CHECKER_PKG_OPTIONS="" + +elif [ "${CONTAINER_FULLNAME}" = "debian:buster" ]; then + PACKAGE_MANAGER_BIN="apt-get" + PACKAGE_UPDATE_OPTIONS="update -y -qq" + PACKAGE_INSTALL_OPTIONS="install -y" + + INSTALL_PACKAGES="autoconf autotools-dev clang-tidy default-jre-headless fuse jq libfuse-dev libcurl4-openssl-dev libxml2-dev locales-all mime-support libtool pkg-config libssl-dev attr curl procps python3-pip unzip" + INSTALL_CHECKER_PKGS="cppcheck shellcheck" + INSTALL_CHECKER_PKG_OPTIONS="" + +elif [ "${CONTAINER_FULLNAME}" = "rockylinux:9" ]; then + PACKAGE_MANAGER_BIN="dnf" + PACKAGE_UPDATE_OPTIONS="update -y -qq" + PACKAGE_INSTALL_OPTIONS="install -y" + PACKAGE_ENABLE_REPO_OPTIONS="--enablerepo=crb" + + # [NOTE] + # Rocky Linux 9 (or CentOS Stream 9) images may have curl installation issues that + # conflict with the curl-minimal package. + # + PACKAGE_INSTALL_ADDITIONAL_OPTIONS="--allowerasing" + + INSTALL_PACKAGES="clang-tools-extra curl-devel fuse fuse-devel gcc libstdc++-devel gcc-c++ glibc-langpack-en java-17-openjdk-headless jq libxml2-devel mailcap git automake make openssl openssl-devel attr diffutils curl python3 procps unzip xz https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm" + INSTALL_CHECKER_PKGS="cppcheck" + INSTALL_CHECKER_PKG_OPTIONS="--enablerepo=epel" + + # [NOTE] + # For RockyLinux, ShellCheck is downloaded from the github archive and installed. + # + SHELLCHECK_DIRECT_INSTALL=1 + +elif [ "${CONTAINER_FULLNAME}" = "rockylinux:8" ]; then + PACKAGE_MANAGER_BIN="dnf" + PACKAGE_UPDATE_OPTIONS="update -y -qq" + PACKAGE_INSTALL_OPTIONS="install -y" + + INSTALL_PACKAGES="clang-tools-extra curl-devel fuse fuse-devel gcc libstdc++-devel gcc-c++ glibc-langpack-en java-17-openjdk-headless jq libxml2-devel mailcap git automake make openssl openssl-devel attr diffutils curl python3 unzip" + INSTALL_CHECKER_PKGS="cppcheck" + INSTALL_CHECKER_PKG_OPTIONS="--enablerepo=powertools" + + # [NOTE] + # For RockyLinux, ShellCheck is downloaded from the github archive and installed. + # + SHELLCHECK_DIRECT_INSTALL=1 + +elif [ "${CONTAINER_FULLNAME}" = "centos:centos7" ]; then + PACKAGE_MANAGER_BIN="yum" + PACKAGE_UPDATE_OPTIONS="update -y" + PACKAGE_INSTALL_OPTIONS="install -y" + + # [NOTE] + # ShellCheck version(0.3.8) is too low to check. + # And in this version, it cannot be passed due to following error. + # "shellcheck: ./test/integration-test-main.sh: hGetContents: invalid argument (invalid byte sequence)" + # + INSTALL_PACKAGES="curl-devel fuse fuse-devel gcc libstdc++-devel llvm-toolset-7-clang-tools-extra gcc-c++ glibc-langpack-en java-11-openjdk-headless libxml2-devel mailcap git automake make openssl openssl-devel attr curl python3 epel-release unzip" + INSTALL_CHECKER_PKGS="cppcheck jq" + INSTALL_CHECKER_PKG_OPTIONS="--enablerepo=epel" + +elif [ "${CONTAINER_FULLNAME}" = "fedora:39" ]; then + PACKAGE_MANAGER_BIN="dnf" + PACKAGE_UPDATE_OPTIONS="update -y -qq" + PACKAGE_INSTALL_OPTIONS="install -y" + + INSTALL_PACKAGES="clang-tools-extra curl-devel fuse fuse-devel gcc libstdc++-devel gcc-c++ glibc-langpack-en java-latest-openjdk-headless jq libxml2-devel mailcap git automake make openssl openssl-devel curl attr diffutils procps python3-pip unzip" + INSTALL_CHECKER_PKGS="cppcheck ShellCheck" + INSTALL_CHECKER_PKG_OPTIONS="" + +elif [ "${CONTAINER_FULLNAME}" = "fedora:38" ]; then + PACKAGE_MANAGER_BIN="dnf" + PACKAGE_UPDATE_OPTIONS="update -y -qq" + PACKAGE_INSTALL_OPTIONS="install -y" + + INSTALL_PACKAGES="clang-tools-extra curl-devel fuse fuse-devel gcc libstdc++-devel gcc-c++ glibc-langpack-en java-latest-openjdk-headless jq libxml2-devel mailcap git automake make openssl openssl-devel curl attr diffutils procps python3-pip unzip" + INSTALL_CHECKER_PKGS="cppcheck ShellCheck" + INSTALL_CHECKER_PKG_OPTIONS="" + +elif [ "${CONTAINER_FULLNAME}" = "opensuse/leap:15" ]; then + PACKAGE_MANAGER_BIN="zypper" + PACKAGE_UPDATE_OPTIONS="refresh" + PACKAGE_INSTALL_OPTIONS="install -y" + + INSTALL_PACKAGES="automake clang-tools curl-devel fuse fuse-devel gcc-c++ java-17-openjdk-headless jq libxml2-devel make openssl openssl-devel python3-pip curl attr ShellCheck unzip" + INSTALL_CHECKER_PKGS="cppcheck ShellCheck" + INSTALL_CHECKER_PKG_OPTIONS="" + +elif [ "${CONTAINER_FULLNAME}" = "alpine:3.19" ]; then + PACKAGE_MANAGER_BIN="apk" + PACKAGE_UPDATE_OPTIONS="update --no-progress" + PACKAGE_INSTALL_OPTIONS="add --no-progress --no-cache" + + INSTALL_PACKAGES="bash clang-extra-tools curl g++ make automake autoconf libtool git curl-dev fuse-dev jq libxml2-dev openssl coreutils procps attr sed mailcap openjdk17 aws-cli" + INSTALL_CHECKER_PKGS="cppcheck shellcheck" + INSTALL_CHECKER_PKG_OPTIONS="" + + AWSCLI_DIRECT_INSTALL=0 + +else + echo "No container configured for: ${CONTAINER_FULLNAME}" + exit 1 +fi + +#----------------------------------------------------------- +# Install +#----------------------------------------------------------- +# +# Update packages (ex. apt-get update -y -qq) +# +echo "${PRGNAME} [INFO] Updates." +/bin/sh -c "${PACKAGE_MANAGER_BIN} ${PACKAGE_UPDATE_OPTIONS}" + +# +# Install packages ( with cppcheck ) +# +echo "${PRGNAME} [INFO] Install packages." +/bin/sh -c "${PACKAGE_MANAGER_BIN} ${PACKAGE_ENABLE_REPO_OPTIONS} ${PACKAGE_INSTALL_OPTIONS} ${PACKAGE_INSTALL_ADDITIONAL_OPTIONS} ${INSTALL_PACKAGES}" + +echo "${PRGNAME} [INFO] Install cppcheck package." +/bin/sh -c "${PACKAGE_MANAGER_BIN} ${INSTALL_CHECKER_PKG_OPTIONS} ${PACKAGE_INSTALL_OPTIONS} ${INSTALL_CHECKER_PKGS}" + +# +# Install ShellCheck manually +# +if [ "${SHELLCHECK_DIRECT_INSTALL}" -eq 1 ]; then + echo "${PRGNAME} [INFO] Install shellcheck package from github archive." + + if ! LATEST_SHELLCHECK_DOWNLOAD_URL=$(curl --silent --show-error https://api.github.com/repos/koalaman/shellcheck/releases/latest | jq -r '.assets[].browser_download_url | select(contains("linux.x86_64"))'); then + echo "Could not get shellcheck package url" + exit 1 + fi + if ! curl -s -S -L -o /tmp/shellcheck.tar.xz "${LATEST_SHELLCHECK_DOWNLOAD_URL}"; then + echo "Failed to download shellcheck package from ${LATEST_SHELLCHECK_DOWNLOAD_URL}" + exit 1 + fi + if ! tar -C /usr/bin/ -xf /tmp/shellcheck.tar.xz --no-anchored 'shellcheck' --strip=1; then + echo "Failed to extract and install shellcheck." + rm -f /tmp/shellcheck.tar.xz + exit 1 + fi + rm -f /tmp/shellcheck.tar.xz +fi + +# Check Java version +java -version + +# +# Install awscli +# +if [ "${AWSCLI_DIRECT_INSTALL}" -eq 1 ]; then + echo "${PRGNAME} [INFO] Install awscli2 package." + + CURRENT_DIR=$(pwd) + cd /tmp || exit 1 + + curl "${AWSCLI_URI}" -o "${AWSCLI_ZIP_FILE}" + unzip "${AWSCLI_ZIP_FILE}" + ./aws/install + + cd "${CURRENT_DIR}" || exit 1 +fi + +#----------------------------------------------------------- +# Set environment for configure +#----------------------------------------------------------- +echo "${PRGNAME} [INFO] Set environment for configure options" + +echo "CXXFLAGS=${CXXFLAGS}" >> "${GITHUB_ENV}" +echo "CONFIGURE_OPTIONS=${CONFIGURE_OPTIONS}" >> "${GITHUB_ENV}" + +echo "${PRGNAME} [INFO] Finish Linux helper for installing packages." + +exit 0 + +# +# Local variables: +# tab-width: 4 +# c-basic-offset: 4 +# End: +# vim600: expandtab sw=4 ts=4 fdm=marker +# vim<600: expandtab sw=4 ts=4 +#