Skip to content

Instantly share code, notes, and snippets.

@mcnilz
Created March 25, 2020 08:52
Show Gist options
  • Save mcnilz/7f19dbfb13d2b69d6ee6c67be2ad2e79 to your computer and use it in GitHub Desktop.
Save mcnilz/7f19dbfb13d2b69d6ee6c67be2ad2e79 to your computer and use it in GitHub Desktop.
install-dev-system
#!/bin/bash
apt-get update
apt-get -y upgrade
apt-get install -y \
git \
git-lfs \
mc \
zsh \
haveged
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
if [ ! -e "/usr/bin/dockerd" ]; then
apt-get update
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
FINGERPRINT=$(apt-key fingerprint 0EBFCD88 | grep 9DC8 | tr -d '[:space:]')
if [ "$FINGERPRINT" != "Keyfingerprint=9DC858229FC7DD38854AE2D88D81803C0EBFCD88" ]; then
echo "FINGERPRINT ERROR" 1>&2
apt-key fingerprint 0EBFCD88
exit 1
fi
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update
apt-get -y install docker-ce
usermod -aG docker ubuntu
usermod -aG docker vagrant
fi
if [ ! -e "/usr/bin/code" ]; then
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
FINGERPRINT=$(apt-key fingerprint EB3E94ADBE1229CF | grep BC52 | tr -d '[:space:]')
if [ "$FINGERPRINT" != "Keyfingerprint=BC528686B50D79E339D3721CEB3E94ADBE1229CF" ]; then
echo "FINGERPRINT ERROR" 1>&2
apt-key fingerprint EB3E94ADBE1229CF
exit 1
fi
add-apt-repository \
"deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
apt-get update
apt-get -y install code
fi
if [ ! -e "/usr/bin/google-chrome" ]; then
curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add -
FINGERPRINT=$(apt-key fingerprint 7FAC5991 | grep 4CCA | tr -d '[:space:]')
if [ "$FINGERPRINT" != "Keyfingerprint=4CCA1EAF950CEE4AB83976DCA040830F7FAC5991" ]; then
echo "FINGERPRINT ERROR" 1>&2
apt-key fingerprint 7FAC5991
exit 1
fi
FINGERPRINT=$(apt-key fingerprint D38B4796 | grep EB4C | tr -d '[:space:]')
if [ "$FINGERPRINT" != "Keyfingerprint=EB4C1BFD4F042F6DDDCCEC917721F63BD38B4796" ]; then
echo "FINGERPRINT ERROR" 1>&2
apt-key fingerprint D38B4796
exit 1
fi
add-apt-repository \
"deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main"
apt-get update
apt-get -y install google-chrome-stable
fi
function asuser { X="$@"; sudo -i -u "#1000" $X ; }
function asuserd { X="${@:2}"; sudo -i -u "#1000" bash -c "cd $1; $X " ; }
USERHOME=$(asuser pwd)
if [ "$USERHOME" = "/root" ]; then
echo "USERHOME can not be /root" >&2
exit 1
fi
# USERNAME=$(sudo -i -u "#1000" id -un)
if [ ! -d "$USERHOME/projects" ]; then asuser mkdir -p "$USERHOME/projects"; fi
if [ ! -d "$USERHOME/bin" ]; then asuser mkdir -p "$USERHOME/bin"; fi
if [ ! -d "$USERHOME/projects/dockerfiles-develop" ]; then
apt-get install -y libnss3-tools
asuser git clone https://github.com/mcnilz/dockerfiles-develop.git "$USERHOME/projects/dockerfiles-develop"
fi
if [ ! -f "$USERHOME/bin/docker-compose" ]; then
asuserd "$USERHOME/bin" ln -s "$USERHOME/projects/dockerfiles-develop/bin/docker-compose" .
fi
if [ ! -f "$USERHOME/projects/dockerfiles-develop/dev/.env" ]; then
asuserd "$USERHOME/projects/dockerfiles-develop/dev" ./init
fi
if [ -f "$USERHOME/projects/dockerfiles-develop/dev/.env" ]; then
asuserd "$USERHOME/projects/dockerfiles-develop/dev" "$USERHOME/bin/docker-compose" up -d
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment