sovereign-stack/install.sh

56 lines
2.1 KiB
Bash
Raw Normal View History

2021-12-25 18:43:01 +00:00
#!/bin/bash
set -e
cd "$(dirname "$0")"
cat ./certs/docker.gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
2021-12-25 18:43:01 +00:00
sudo apt-get update
sudo apt-get install -y wait-for-it dnsutils rsync sshfs \
apt-transport-https ca-certificates \
curl gnupg lsb-release docker-ce-cli \
docker-ce python3-pip libusb-1.0-0-dev \
pinentry-curses containerd.io docker-compose-plugin
#libudev-dev
2021-12-25 18:43:01 +00:00
# install lxd as a snap if it's not installed. We only really use the LXC part of this package.
if ! snap list | grep -q lxd; then
2021-12-25 18:43:01 +00:00
sudo snap install lxd
fi
# let's ensure docker-machine is available. This is only temporary though.
curl -L https://github.com/docker/machine/releases/download/v0.16.2/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&
chmod +x /tmp/docker-machine &&
sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
# base="https://github.com/docker/machine/releases/download/v0.16.2"
# curl -s -L "$base/docker-machine-$(uname -s)-$(uname -m)" >/tmp/docker-machine
# sudo mv /tmp/docker-machine /usr/local/bin/docker-machine
# chmod +x /usr/local/bin/docker-machine
2021-12-25 18:43:01 +00:00
pip3 install trezor_agent
sudo cp ./51-trezor.rules /etc/udev/rules.d/51-trezor.rules
# if there's a ./env file here, let's execute it. Admins can put various deployment-specific things there.
if [ ! -f "$(pwd)/env" ]; then
echo "#!/bin/bash" >> "$(pwd)/env"
chmod 0744 "$(pwd)/env"
echo "We stubbed out a '$(pwd)/env' file for you. Put any LXD-remote specific information in there."
echo "Check out 'https://www.sovereign-stack.org/env' for an example."
exit 1
fi
# make ss-deploy available to the user
sudo groupadd docker
sudo usermod -aG docker "$USER"
# TODO CHECK IF EXISTS
echo "alias ss-deploy='/home/$USER/sovereign-stack/deploy.sh \$@'" >> "$HOME/.bashrc"