2018-09-29 23:12:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-09-29 23:29:03 +00:00
|
|
|
# Check to make sure script is not initially run as root
|
|
|
|
if [ "$EUID" == 0 ]
|
|
|
|
then echo "Please do not run as root. Script will prompt for sudo password."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2018-10-01 02:09:39 +00:00
|
|
|
# Get username for regular user.
|
2018-10-03 08:38:13 +00:00
|
|
|
username=$(whoami)
|
2018-10-01 02:09:39 +00:00
|
|
|
|
2018-09-29 23:26:22 +00:00
|
|
|
# Start root section
|
|
|
|
sudo su root <<'EOF'
|
2018-09-29 23:16:27 +00:00
|
|
|
|
2018-09-29 23:12:44 +00:00
|
|
|
# Apt update and installs
|
|
|
|
apt update
|
|
|
|
apt install python-pip curl -y
|
|
|
|
|
|
|
|
# Install Docker
|
|
|
|
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
|
|
|
|
|
|
|
|
if [ -f /etc/apt/sources.list.d/docker.list ]; then
|
|
|
|
echo "Apt source entry exists, skipping."
|
|
|
|
else
|
|
|
|
echo 'deb https://download.docker.com/linux/debian stretch stable' > /etc/apt/sources.list.d/docker.list
|
|
|
|
fi
|
|
|
|
|
|
|
|
apt update
|
|
|
|
apt-get install docker-ce -y
|
|
|
|
systemctl start docker
|
|
|
|
systemctl enable docker
|
|
|
|
|
2018-10-01 02:09:39 +00:00
|
|
|
# Add user to docker group
|
2018-10-03 08:38:13 +00:00
|
|
|
usermod -aG docker $username
|
2018-10-01 02:09:39 +00:00
|
|
|
|
2018-09-29 23:26:22 +00:00
|
|
|
# End of root section
|
|
|
|
EOF
|
|
|
|
|
2020-06-01 18:30:56 +00:00
|
|
|
PYTHON=python
|
2018-09-29 23:12:44 +00:00
|
|
|
|
2020-06-01 18:30:56 +00:00
|
|
|
$PYTHON --help >/dev/null
|
|
|
|
if [ ! $? -eq 0 ]; then
|
|
|
|
PYTHON=python3
|
|
|
|
fi
|
2018-09-29 23:12:44 +00:00
|
|
|
|
2020-06-01 18:30:56 +00:00
|
|
|
# Create workspace at ~/pupyws
|
|
|
|
${PYTHON} create-workspace.py -E docker -P $HOME/pupyws
|