vm: Initial commit

This commit is contained in:
PorridgePi
2022-09-26 12:40:38 +01:00
commit 10531c39ef
3 changed files with 64 additions and 0 deletions

15
vm/docker-compose.yml Normal file
View File

@@ -0,0 +1,15 @@
version: "3.9"
services:
ubuntu:
image: ubuntu
container_name: ubuntu
stdin_open: true
tty: true
environment:
HOST_IP: 192.168.2.200
volumes:
- "./src:/src"
# volumes:
# ubuntu-data:

2
vm/enter.sh Executable file
View File

@@ -0,0 +1,2 @@
docker-compose up -d
docker exec -it ubuntu bash /src/install.sh

47
vm/src/install.sh Normal file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
USERNAME=porridge
PASSWORD=pass
echo "SETUP IS DONE"
echo "Skipping..."
SETUP_DONE=true
else
SETUP_DONE=false
fi
if [ ! -f '/SETUP_DONE' ]; then
echo "SETUP NOT DONE"
echo "STARTING SETUP..."
echo "APT UPDATE AND UPGRADE"
apt update
apt upgrade -y
echo "APT INSTALL"
apt install -y sudo nano
echo "ADD USER"
useradd -m -p $(perl -e "print crypt($PASSWORD, 'password')") -g sudo $USERNAME
# usermod -aG sudo $USERNAME
# echo "$USERNAME:$PASSWORD" | chpasswd
# echo -e "$PASSWORD\n$PASSWORD" | passwd "$USERNAME"
touch /SETUP_DONE
fi
echo '####################'
echo '#### ALL DONE ####'
echo '####################'
# mkdir /home/$USERNAME/
# chown $USERNAME:$USERNAME /home/$USERNAME/
# set -m
# Set bash as default shell
su - $USERNAME -c "echo $PASSWORD | chsh -s \$(which bash) \$USER"
# Login as user
su --login $USERNAME