#!/bin/bash
#
# Install S3FS on Ubuntu 16.04
#

sudo su -

apt-get install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config

git clone https://github.com/s3fs-fuse/s3fs-fuse.git
cd s3fs-fuse
./autogen.sh
./configure
make
make install

mkdir /mnt/test_s3

# Credentials (AWS API keys)
echo "AKIA...:xxxx" > /etc/passwd_s3fs
chmod 640 /etc/passwd_s3fs

S3_ID='test-s3fs'

# Mount command, running in foreground -f, with -d debug output
s3fs -f -d -o allow_other -o endpoint=eu-west-1 -o passwd_file=/etc/passwd-s3fs \
    $S3_ID -o url="https://s3-eu-west-1.amazonaws.com" /mnt/test_s3

