kind: ConfigMap
apiVersion: v1
metadata:
  name: boathouse-scripts
  labels:
    app.kubernetes.io/name: boathouse
    app.kubernetes.io/instance: boathouse
data:
  install_deps.sh: |-
    #!/usr/bin/env sh

    # See https://get.docker.com.
    get_distro() {
        distro=""
      # Every system that we officially support has /etc/os-release
      if [ -r /etc/os-release ]; then
        distro="$(. /etc/os-release && echo "$ID")"
      fi
      # Returning an empty string here should be alright since the
      # case statements don't act unless you provide an actual value
      echo "$distro" | tr '[:upper:]' '[:lower:]'
    }

    run_ubuntu() {
        apt-get update
        apt-get install -y fuse
        rm -f /usr/bin/goofys
        curl -L -o /usr/bin/goofys https://github.com/StatCan/goofys/releases/download/v0.24.0-statcan-3/goofys
        chmod +x /usr/bin/goofys
    }

    distro=$(get_distro)
    case $distro in
        ubuntu)
            run_ubuntu
        ;;
        *)
            echo "Unsupported distro"
            exit 1
        ;;
    esac
    exit 0
