-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathstartup-script.sh
More file actions
41 lines (30 loc) · 2.1 KB
/
Copy pathstartup-script.sh
File metadata and controls
41 lines (30 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
curl -L -O https://github.com/GoogleCloudPlatform/gcsfuse/releases/download/v3.2.0/gcsfuse_3.2.0_amd64.deb
dpkg --install gcsfuse_3.2.0_amd64.deb
rm gcsfuse_3.2.0_amd64.deb
apt install -y gnupg ca-certificates
gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
apt install -y mono-complete libtesseract-dev libgpac-dev tesseract-ocr-eng fonts-noto-core
mkdir repository
cd repository
# Use gcsfuse and import required files
# TempFiles is used by the tester (--tempfolder) and must exist
mkdir temp TestFiles TestResults TempFiles vm_data reports
gcs_bucket=$(curl http://metadata/computeMetadata/v1/instance/attributes/bucket -H "Metadata-Flavor: Google")
vm_name=$(curl http://metadata.google.internal/computeMetadata/v1/instance/hostname -H "Metadata-Flavor: Google")
vm_name=(${vm_name//./ })
echo "${gcs_bucket} /repository/temp gcsfuse rw,noatime,async,_netdev,noexec,user,implicit_dirs,allow_other,only_dir=TestData/ci-linux 0 0" | sudo tee -a /etc/fstab
echo "${gcs_bucket} /repository/vm_data gcsfuse rw,noatime,async,_netdev,noexec,user,implicit_dirs,allow_other,only_dir=vm_data/${vm_name} 0 0" | sudo tee -a /etc/fstab
echo "${gcs_bucket} /repository/TestFiles gcsfuse rw,noatime,async,_netdev,noexec,user,implicit_dirs,allow_other,only_dir=TestFiles,cache_dir=/tmp,file_cache_max_size_mb=3000,file_cache_cache_file_for_range_read=true,metadata_cache_ttl_secs=-1 0 0" | sudo tee -a /etc/fstab
echo "${gcs_bucket} /repository/TestResults gcsfuse rw,noatime,async,_netdev,noexec,user,implicit_dirs,allow_other,only_dir=TestResults 0 0" | sudo tee -a /etc/fstab
mount temp
mount vm_data
mount TestFiles
mount TestResults
# Give gcsfuse mounts time to become ready
sleep 10
cp temp/* ./
chmod +x bootstrap
./bootstrap