diff --git a/README.md b/README.md index 875048c..9ba3bc4 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,17 @@ My [daily driver](https://cloud.docker.com/repository/docker/sabrehagen/desktop- Use a new GitHub [Personal Access Token](https://github.com/settings/tokens/new) for [`DESKTOP_ENVIRONMENT_GITHUB_TOKEN`](scripts/credentials.sh#L2) on each device running the desktop environmment. +On a clean install of Ubuntu 18.10+ run as `root`: + ```sh -# Clone docker environment. -git clone https://github.com/sabrehagen/desktop-environment && cd desktop-environment +# Clone desktop environment +git clone https://github.com/sabrehagen/desktop-environment -# Bootstrap docker host. -./scripts/bootstrap-host.sh +# Provide repository with github access +echo DESKTOP_ENVIRONMENT_GITHUB_TOKEN=... > desktop-environment/scripts/credentials.sh -# Become non-root user. -su jackson - -# Start the environment. -./scripts/refresh.sh +# Start desktop environment +desktop-environment/scripts/bootstrap-host.sh ``` ## Forking diff --git a/scripts/alacritty.sh b/scripts/alacritty.sh index dc958a9..87500bb 100755 --- a/scripts/alacritty.sh +++ b/scripts/alacritty.sh @@ -1,2 +1,7 @@ -# Start a desktop environment terminal detached from this shell -nohup alacritty /dev/null 2>&1 & +REPO_ROOT=$(dirname $(realpath $0))/.. + +# Export desktop environment shell configuration +export $(sh $REPO_ROOT/scripts/environment.sh) + +# Start a desktop environment detached from this shell +gosu $DESKTOP_ENVIRONMENT_USER nohup alacritty /dev/null 2>&1 & diff --git a/scripts/bootstrap-host.sh b/scripts/bootstrap-host.sh index 4861e6e..893ac9b 100755 --- a/scripts/bootstrap-host.sh +++ b/scripts/bootstrap-host.sh @@ -85,14 +85,14 @@ cp $REPO_ROOT/scripts/credentials.sh $HOST_REGISTRY/scripts/credentials.sh chown -R $HOST_USER:$HOST_USER /$HOST_USER $HOST_REPOSITORY # Install dotfiles configuration for host user -su -c "vcsh clone https://github.com/sabrehagen/dotfiles-alacritty.git" $HOST_USER -su -c "vcsh clone https://github.com/sabrehagen/dotfiles-autostart.git" $HOST_USER -su -c "vcsh clone https://github.com/sabrehagen/dotfiles-kwin.git" $HOST_USER -su -c "vcsh clone https://${DESKTOP_ENVIRONMENT_GITHUB_TOKEN}@github.com/sabrehagen/dotfiles-ssh.git" $HOST_USER -su -c "vcsh clone https://github.com/sabrehagen/dotfiles-scripts.git" $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://github.com/sabrehagen/dotfiles-scripts.git -# Manually execute startup script to prepare host machine +# Manually execute startup script to simulate host startup $HOST_HOME/.config/scripts/startup.sh -# Start the desktop environment as the host user -su -c "$HOST_REPOSITORY/scripts/refresh.sh" $HOST_USER +# Recycle the desktop environment +$HOST_REPOSITORY/scripts/recycle.sh diff --git a/scripts/refresh.sh b/scripts/recycle.sh similarity index 100% rename from scripts/refresh.sh rename to scripts/recycle.sh diff --git a/scripts/start.sh b/scripts/start.sh index 30ab9fe..548afe9 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -22,6 +22,7 @@ docker run \ --rm \ --security-opt seccomp:$REPO_ROOT/config/chrome/chrome.json \ --tty \ + --user $DESKTOP_ENVIRONMENT_USER \ --volume /dev/shm:/dev/shm \ --volume /etc/localtime:/etc/localtime:ro \ --volume /run/systemd:/run/systemd \