-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·50 lines (38 loc) · 1.33 KB
/
setup.sh
File metadata and controls
executable file
·50 lines (38 loc) · 1.33 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
42
43
44
45
46
47
48
49
#! /usr/bin/zsh -e
export needed_packages=(rsync containerd runc which)
export APP_DIR=./data/app
export CACHE_DIR=./data/cache/umec
export PKG_CACHE=./data/cache/pacman/pkg
setopt extendedglob
sudo modprobe tun
sudo systemctl start libvirtd.service
mkdir -p ./data/cache/umec
# Some compressed Archlinux packages have extension zst, some xz
# (#qN) makes the expression return empty if there are no matches
for i in $needed_packages; do
if [[ -n $PKG_CACHE/$i*.pkg.tar.*(#qN) ]]; then
print "Already have $i"
else
print "Downloading $i"
sudo pacman --noconfirm -Sw $i --cachedir $PKG_CACHE
fi
done
# sudo pacman -Sw rsync containerd runc which--cachedir data/cache/pacman/pkg
if [[ -n $CACHE_DIR/namespaces.yml ]]; then
curl https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml -o $CACHE_DIR/namespaces.yml
fi
mkdir --parents --verbose $CACHE_DIR
mkdir --parents --verbose $APP_DIR
fetch_command() {
local command=$1
local url=$2
if ! [[ -n $CACHE_DIR/install_$command(#qN) ]] ; then
echo "Fetching $command installation script"
curl -L $2 -o $CACHE_DIR/install_$command
else
print "Already have $command"
fi
chmod u+x $CACHE_DIR/install_$command
}
fetch_command k3s "https://get.k3s.io"
fetch_command helm https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get