2019-01-01 08:23:01 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2019-01-09 16:54:15 +00:00
|
|
|
cd $(dirname $0)/..
|
2019-01-01 08:23:01 +00:00
|
|
|
|
2019-03-07 16:32:33 +00:00
|
|
|
. ./scripts/setup-rancher-path.sh
|
|
|
|
|
2020-03-25 19:35:07 +00:00
|
|
|
GO=${GO-go}
|
|
|
|
|
2019-01-01 08:23:01 +00:00
|
|
|
# Prime sudo
|
2019-01-09 16:54:15 +00:00
|
|
|
sudo echo Compiling
|
2019-01-01 08:23:01 +00:00
|
|
|
|
2019-01-09 16:54:15 +00:00
|
|
|
if [ ! -e bin/containerd ]; then
|
|
|
|
./scripts/build
|
|
|
|
./scripts/package
|
|
|
|
else
|
|
|
|
rm -f ./bin/k3s-agent
|
2020-03-25 19:35:07 +00:00
|
|
|
"${GO}" build -tags "apparmor seccomp" -o ./bin/k3s-agent ./cmd/agent/main.go
|
2019-01-09 16:54:15 +00:00
|
|
|
fi
|
2019-01-01 08:23:01 +00:00
|
|
|
|
2019-01-09 16:54:15 +00:00
|
|
|
echo Starting agent
|
2019-03-06 00:03:27 +00:00
|
|
|
sudo env "PATH=$(pwd)/bin:$PATH" ./bin/k3s-agent --debug agent -s https://localhost:6443 -t $(<${RANCHER_PATH}/k3s/server/node-token) "$@"
|