From 20ff1390dd508c3bc0ff901bde9855dca2174c6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rcio=20Fernandes?= Date: Tue, 13 Dec 2022 00:53:15 +0000 Subject: [PATCH] refactoring --- templates/lxc-portainer.sh | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/templates/lxc-portainer.sh b/templates/lxc-portainer.sh index 04d8090..4ebd4c4 100644 --- a/templates/lxc-portainer.sh +++ b/templates/lxc-portainer.sh @@ -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" \ No newline at end of file +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" \ No newline at end of file