From 65babc530d01c98d213dc940b9172acda5354e07 Mon Sep 17 00:00:00 2001 From: Jackson Delahunt Date: Fri, 15 Feb 2019 13:54:18 +1100 Subject: [PATCH 1/4] volume --- scripts/start.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/start.sh b/scripts/start.sh index 951a893..d6d571f 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -27,6 +27,7 @@ docker run \ --volume /etc/localtime:/etc/localtime:ro \ --volume /run/systemd:/run/systemd \ --volume /tmp/.X11-unix:/tmp/.X11-unix \ + --volume /var/lib/docker:/var/lib/docker \ --volume /var/run/dbus:/var/run/dbus \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume $DESKTOP_ENVIRONMENT_HOME/.config/alacritty:$DESKTOP_ENVIRONMENT_HOME/.config/alacritty \ From b3f4609b1a98539936d0b9e8615151cd5d3eb12d Mon Sep 17 00:00:00 2001 From: Jackson Delahunt Date: Fri, 15 Feb 2019 14:07:20 +1100 Subject: [PATCH 2/4] early-exit --- scripts/bootstrap-host.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/bootstrap-host.sh b/scripts/bootstrap-host.sh index da2f1a4..0639836 100755 --- a/scripts/bootstrap-host.sh +++ b/scripts/bootstrap-host.sh @@ -9,6 +9,15 @@ REPO_ROOT=$(dirname $(realpath $0))/.. # Export desktop environment shell configuration export $(sh $REPO_ROOT/scripts/environment.sh) +# Clone the desktop environment to the host +git clone https://github.com/$DESKTOP_ENVIRONMENT_REGISTRY/$DESKTOP_ENVIRONMENT_CONTAINER $DESKTOP_ENVIRONMENT_REPOSITORY + +# Fork setup to desktop environment configured location immediately +if [ "$REPO_ROOT" != "$DESKTOP_ENVIRONMENT_REPOSITORY" ]; then + sh $DESKTOP_ENVIRONMENT_REPOSITORY/scripts/bootstrap-host.sh + exit 0 +fi + # Install utilities apt-get update -qq && apt-get install -qq \ curl \ @@ -34,9 +43,6 @@ echo '* hard nofile 1000000' >> /etc/security/limits.conf sh -c "$(curl -fsSL get.docker.com)" && \ usermod -aG docker $DESKTOP_ENVIRONMENT_USER -# Allow connections from docker containers to the host's X server -xhost local:docker - # Install alacritty wget -O alacritty.deb https://github.com/jwilm/alacritty/releases/download/v0.2.8/Alacritty-v0.2.8_amd64.deb && \ dpkg -i alacritty.deb && \ @@ -46,6 +52,9 @@ wget -O alacritty.deb https://github.com/jwilm/alacritty/releases/download/v0.2. chown :users /usr/sbin/gosu && \ chmod +s /usr/sbin/gosu +# Allow docker containers to access the host's X server +xhost local:docker + # Host user configuration HOST_USER=$DESKTOP_ENVIRONMENT_USER HOST_USER_ID=1000 @@ -53,7 +62,7 @@ HOST_HOME=/$HOST_USER/home HOST_REPOSITORY=/$DESKTOP_ENVIRONMENT_CONTAINER # Make the host user directory -mkdir /$HOST_USER +mkdir -p /$HOST_USER # Create the host user group groupadd \ @@ -74,9 +83,6 @@ usermod \ --groups docker,sudo \ $HOST_USER -# Clone the desktop environment to the host -git clone https://github.com/$DESKTOP_ENVIRONMENT_REGISTRY/$DESKTOP_ENVIRONMENT_CONTAINER $DESKTOP_ENVIRONMENT_REPOSITORY - # Avoid committing user credentials to the repository git update-index --assume-unchanged $DESKTOP_ENVIRONMENT_REPOSITORY/scripts/credentials.sh From ba0355e2d18d870a5fde02dfbdb85e543928acbb Mon Sep 17 00:00:00 2001 From: Jackson Delahunt Date: Fri, 15 Feb 2019 14:19:53 +1100 Subject: [PATCH 3/4] registry --- scripts/bootstrap-host.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/bootstrap-host.sh b/scripts/bootstrap-host.sh index 0639836..bf5f069 100755 --- a/scripts/bootstrap-host.sh +++ b/scripts/bootstrap-host.sh @@ -13,7 +13,7 @@ export $(sh $REPO_ROOT/scripts/environment.sh) git clone https://github.com/$DESKTOP_ENVIRONMENT_REGISTRY/$DESKTOP_ENVIRONMENT_CONTAINER $DESKTOP_ENVIRONMENT_REPOSITORY # Fork setup to desktop environment configured location immediately -if [ "$REPO_ROOT" != "$DESKTOP_ENVIRONMENT_REPOSITORY" ]; then +if [ "$REPO_ROOT" -ef "$DESKTOP_ENVIRONMENT_REPOSITORY" ]; then sh $DESKTOP_ENVIRONMENT_REPOSITORY/scripts/bootstrap-host.sh exit 0 fi @@ -96,7 +96,7 @@ chown -R $HOST_USER:$HOST_USER /$HOST_USER gosu $HOST_USER vcsh clone https://github.com/sabrehagen/dotfiles-alacritty.git gosu $HOST_USER vcsh clone https://github.com/sabrehagen/dotfiles-autostart.git gosu $HOST_USER vcsh clone https://github.com/sabrehagen/dotfiles-kwin.git -gosu $HOST_USER vcsh clone https://${DESKTOP_ENVIRONMENT_GITHUB_TOKEN}@github.com/sabrehagen/dotfiles-ssh.git +gosu $HOST_USER vcsh clone https://${DESKTOP_ENVIRONMENT_GITHUB_TOKEN-$DESKTOP_ENVIRONMENT_REGISTRY}@github.com/sabrehagen/dotfiles-ssh.git gosu $HOST_USER vcsh clone https://github.com/sabrehagen/dotfiles-scripts.git # Manually execute startup script to simulate host startup From c8dc2cea6c7c418005b64f44ccf4dcc92c06b233 Mon Sep 17 00:00:00 2001 From: Jackson Delahunt Date: Fri, 15 Feb 2019 14:25:35 +1100 Subject: [PATCH 4/4] env-fix --- scripts/bootstrap-host.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bootstrap-host.sh b/scripts/bootstrap-host.sh index bf5f069..7ec614d 100755 --- a/scripts/bootstrap-host.sh +++ b/scripts/bootstrap-host.sh @@ -96,7 +96,7 @@ chown -R $HOST_USER:$HOST_USER /$HOST_USER gosu $HOST_USER vcsh clone https://github.com/sabrehagen/dotfiles-alacritty.git gosu $HOST_USER vcsh clone https://github.com/sabrehagen/dotfiles-autostart.git gosu $HOST_USER vcsh clone https://github.com/sabrehagen/dotfiles-kwin.git -gosu $HOST_USER vcsh clone https://${DESKTOP_ENVIRONMENT_GITHUB_TOKEN-$DESKTOP_ENVIRONMENT_REGISTRY}@github.com/sabrehagen/dotfiles-ssh.git +gosu $HOST_USER vcsh clone https://${DESKTOP_ENVIRONMENT_GITHUB_TOKEN:-$DESKTOP_ENVIRONMENT_REGISTRY}@github.com/sabrehagen/dotfiles-ssh.git gosu $HOST_USER vcsh clone https://github.com/sabrehagen/dotfiles-scripts.git # Manually execute startup script to simulate host startup