refactoring

This commit is contained in:
2022-12-13 00:53:15 +00:00
parent 7d2beca0ca
commit 20ff1390dd

View File

@@ -1,20 +1,22 @@
#!/bin/bash
#start container
echo "container name: $1"
echo "profile: $2"
LXC_CONTAINER_NAME=$1
LXC_PROFILE=$2
echo "container name: $LXC_CONTAINER_NAME"
echo "profile: $LXC_PROFILE"
echo "starting container"
lxc launch ubuntu $1 -p $2
lxc launch ubuntu $LXC_CONTAINER_NAME -p $LXC_PROFILE
echo "setting lxc docker requirements"
curl -s "https://git.limbosolutions.com/kb/lxc/raw/branch/main/scripts/lxc-config-docker-requirements.sh" | bash -s $1
lxc restart $1
curl -s "https://git.limbosolutions.com/kb/lxc/raw/branch/main/scripts/lxc-config-docker-requirements.sh" | bash -s $LXC_CONTAINER_NAME
lxc restart $LXC_CONTAINER_NAME
echo "updating apt"
lxc exec $1 -- sh -c "apt-get update -qq >/dev/null"
lxc exec $LXC_CONTAINER_NAME -- sh -c "apt-get update -qq >/dev/null"
echo "upgrading apt"
lxc exec $1 -- sh -c "apt-get upgrade -qq >/dev/null"
echo "install fuse & docker"
lxc exec $1 -- bash -c "curl -s \"https://git.limbosolutions.com/kb/docker/raw/branch/main/scripts/ubuntu-fuse-setup.sh\" | bash"
#portainer
lxc exec $1 -- bash -c "curl -s \"https://git.limbosolutions.com/kb/portainer/raw/branch/main/scripts/setup.sh\" | bash"
lxc exec $LXC_CONTAINER_NAME -- sh -c "apt-get upgrade -qq >/dev/null"
echo "installing fuse & docker"
lxc exec $LXC_CONTAINER_NAME -- bash -c "curl -s \"https://git.limbosolutions.com/kb/docker/raw/branch/main/scripts/ubuntu-fuse-setup.sh\" | bash"
echo "installing portainer"
lxc exec $LXC_CONTAINER_NAME -- bash -c "curl -s \"https://git.limbosolutions.com/kb/portainer/raw/branch/main/scripts/setup.sh\" | bash"