diff --git a/docker_installers/ubuntu_docker_installer.sh b/docker_installers/ubuntu_docker_installer.sh old mode 100644 new mode 100755 diff --git a/webtop_installers/docker-compose.yml b/webtop_installers/docker-compose.yml new file mode 100644 index 0000000..59e7b27 --- /dev/null +++ b/webtop_installers/docker-compose.yml @@ -0,0 +1,18 @@ +--- +version: "2.1" +services: + webtop: + image: ghcr.io/linuxserver/webtop:ubuntu-mate + container_name: webtop + restart: unless-stopped + environment: + - TZ=America/Chicago # Your local timezone + - PUID=1000 # Application user ID + - PGID=1000 # Application group ID + volumes: + # - /host/path/to/var/run/docker.sock:/var/run/docker.sock # Docker Socket on the system, if you want to use Docker in the container + - ./config:/config # Application home directory + ports: + - 3000:3000 # Web Desktop GUI + shm_size: "2gb" + privileged: true diff --git a/webtop_installers/full_setup.sh b/webtop_installers/full_setup.sh new file mode 100755 index 0000000..948f3d7 --- /dev/null +++ b/webtop_installers/full_setup.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +docker_installer="$(dirname "$0")/../docker_installers/ubuntu_docker_installer.sh" +webtop_compose="$(dirname "$0")/docker-compose.yml" + +# Ask for the username +read -p "Enter the username: " username + +# Ask for the password +read -sp "Enter the password: " password +echo + +# Create the user with the given password +sudo useradd -m "$username" -p "$(openssl passwd -1 "$password")" + +echo "User $username created." + +# Add user to sudo group +sudo usermod -aG sudo "$username" + +echo "User $username added to sudo group." + +# Copy necessary files +sudo mkdir -p /home/"$username"/webtop +sudo cp "$webtop_compose" /home/"$username"/webtop +sudo chown -R "$username":"$username" /home/"$username"/webtop + +# Create a secondary script +secondary_script=/home/"$username"/setup_webtop.sh +cat << EOF | sudo tee "$secondary_script" +#!/bin/bash +sudo chmod +x "$docker_installer" +sudo bash "$docker_installer" +cd /home/$username/webtop +sudo docker compose up -d +EOF + +sudo chmod +x "$secondary_script" +sudo chown "$username":"$username" "$secondary_script" + +# Execute the secondary script as the new user +sudo -u "$username" bash "$secondary_script" + +echo "Webtop container running..."