github.com/pachyderm/pachyderm@v1.13.4/etc/testing/travis_cache.sh (about)

     1  #!/bin/bash
     2  
     3  # Create all of our Travis cached dirs, or, if they exist, loosen their
     4  # permissions enough that our build process is guaranteed to be able to write
     5  # to them and Travis's caching process is guaranteed to be able to read them.
     6  # (Travis caching requires that all cached files be readable, and, I surmise,
     7  # that cached directories be executable, to be traversed).
     8  
     9  set -ex
    10  
    11  # If any directories are added or changed here, they must also be added to
    12  # .travis.yml
    13  dirs=(
    14    "${HOME}/.cache"
    15    "${HOME}/cached-deps"
    16    "${GOPATH}/pkg"
    17    "$(python3 -c 'import site; print(site.USER_BASE)')" # $HOME/.local
    18  )
    19  
    20  for dir in "${dirs[@]}"; do
    21    if [[ -d "${dir}" ]]; then
    22      # change ownership on directory, in case it's owned by root
    23      sudo chown -R "${USER}:${USER}" "${dir}"
    24    else
    25      # create directory
    26      mkdir -p "${dir}"
    27    fi
    28    # Loosen permissions so build processes can write and Travis can cache
    29    chmod 777 -R "${dir}"
    30  done
    31  
    32  # Handle docker cache separately, as that should not be owned by $USER
    33  sudo mkdir -p "/var/lib/docker"
    34  sudo chmod 777 -R "/var/lib/docker"