-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfonts.sh
executable file
·38 lines (29 loc) · 918 Bytes
/
fonts.sh
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
#!/bin/bash
set -e
font_dir=~/.local/share/fonts/
mkdir -p $font_dir
# Check if the fonts already exist. Hey, we might be lucky!
if [ -n "$(ls -A /fonts 2>/dev/null)" ]; then
echo "Fonts seem to exist. If they do not, ensure /fonts dir is empty and try again."
cp -R /fonts $font_dir
exit 0
fi
# Read env for the script
if [ -f .env ]; then
source .env
fi
# Find Azure credentials from secrets if not found from env
if [ -z "$AZURE_FONTS_SAS_URL" ]; then
# Path to the Azure credentials supplied by Docker secrets
sas_url=/run/secrets/AZURE_FONTS_SAS_URL
# Check if the secrets exits, otherwise use just default fonts
if [ ! -f "$sas_url" ]; then
echo "Azure sas url not set. Fonts not downloaded."
exit 0
fi
# Read the credentials to envs
AZURE_FONTS_SAS_URL=$(<$sas_url)
fi
sas_url=${AZURE_FONTS_SAS_URL}
azcopy copy $sas_url $font_dir --recursive=true
echo "Fonts downloaded."