Update 3 files

- /docs/partials/guide.md
- /local/provision.sh
- /home/dot_local/bin/executable_provision.tmpl
This commit is contained in:
Brian Zalewski 2023-01-12 05:44:24 +00:00
parent b6860aab29
commit 3dc63bbca3
3 changed files with 98 additions and 52 deletions

View file

@ -15,6 +15,18 @@ To provision your workstation, you can run the following which will install some
bash <(curl -sSL https://install.doctor/start)
```
If you fork this repository and would like to use your fork as the source, you can still use the command shown above by setting the `START_REPO` environment variable. If it is located on GitHub, you can do this by running:
```
START_REPO=my-gh-user/my-fork-name bash <(curl -sSL https://install.doctor/start)
```
Alternatively, if you want to host your project on GitLab or another git provider, then just specify the git remote's URL:
```
START_REPO=git@gitlab.com:megabyte-labs/sexy-start.git bash <(curl -sSL https://install.doctor/start)
```
### Quick Start Notes
* The quick start script is tested on the latest versions of Archlinux, CentOS, Debian, Fedora, macOS, and Ubuntu
@ -53,3 +65,17 @@ Qubes support is on its way.
## Gas Station
This project began as something to supplement our provisioning system that uses Ansible. The system is called [Gas Station](https://gitlab.com/megabyte-labs/gas-station). It includes hundreds of Ansible roles. If you look at the [`software.yml`](/sexy-start) file, you will notice that some of the Ansible roles that Gas Station provides are inside of it. By default, this project will try to install software / dependencies using other, lighter methods before resorting to using Ansible. This is because of the software installer order that is defined at the top of the software.yml file. Gas Station is also still used to house some of the variables / data that this project uses.
## Chezmoi
This project uses Chezmoi to orchestrate the provisioning. After calling the quick start script shown above, the quick start script will ensure some dependencies are installed (including Chezmoi) and then initiate Chezmoi. In order to customize this project, you should head over to the Chezmoi documentation to get a better understanding of why some of the files in this repository start with `dot_`, `run_`, etc.
### Resetting Chezmoi
This script is designed to run only the code that is necessary to improve performance. This is accomplished by using [`.chezmoiscripts`](home/.chezmoiscripts), Chezmoi's `onchange_` identifier, and a custom installer written in ZX that is powered by the software definitions in [`software.yml`](software.yml).
If there is an error during the provision process or you make changes that are not being run during the provision process then you might want to clear Chezmoi's cache and configuration. This can be done on macOS/Linux by running:
```
rm -rf ~/.config/chezmoi && rm -rf ~/.cache/chezmoi
```

View file

@ -191,42 +191,53 @@ if command -v brew > /dev/null; then
installBrewPackage gum
installBrewPackage node
installBrewPackage zx
else
logg error 'Homebrew is not available in the PATH' && exit 1
fi
### Clones the source repository
cloneStart() {
logg info "Cloning ${START_REPO:-https://gitlab.com/megabyte-labs/sexy-start.git} to /usr/local/src/sexy-start"
rm -rf /usr/local/src/sexy-start
sudo git clone ${START_REPO:-https://gitlab.com/megabyte-labs/sexy-start.git} /usr/local/src/sexy-start
chown -Rf "$USER":"$(id -g -n)" /usr/local/src/sexy-start
}
### Ensure source files are present
logg 'Ensuring /usr/local/src/hiawatha is owned by the user'
if [ -d /usr/local/src/hiawatha ] && [ ! -w /usr/local/src/hiawatha ]; then
sudo chown -Rf "$USER":"$(id -g -n)" /usr/local/src/hiawatha
logg 'Ensuring /usr/local/src/sexy-start is owned by the user'
if [ -d /usr/local/src/sexy-start ] && [ ! -w /usr/local/src/sexy-start ]; then
sudo chown -Rf "$USER":"$(id -g -n)" /usr/local/src/sexy-start
fi
if [ -d /usr/local/src/hiawatha/.git ]; then
logg info 'Pulling the latest changes from https://gitlab.com/megabyte-labs/hiawatha-dotfiles.git to /usr/local/src/hiawatha'
cd /usr/local/src/hiawatha || exit 1
if [ -d /usr/local/src/sexy-start/.git ]; then
cd /usr/local/src/sexy-start || exit 1
if [ "$(git remote get-url origin)" == 'https://gitlab.com/megabyte-labs/sexy-start.git' ]; then
logg info "Pulling the latest changes from ${START_REPO:-https://gitlab.com/megabyte-labs/sexy-start.git} to /usr/local/src/sexy-start"
git config pull.rebase false
git reset --hard HEAD
git clean -fxd
git pull origin master
else
logg info "The repository's origin URL has changed so /usr/local/src/sexy-start will be removed and re-cloned using the origin specified by the START_REPO variable"
cloneStart
fi
else
logg info 'Cloning https://gitlab.com/megabyte-labs/hiawatha-dotfiles.git to /usr/local/src/hiawatha'
rm -rf /usr/local/src/hiawatha
sudo git clone https://gitlab.com/megabyte-labs/hiawatha-dotfiles.git /usr/local/src/hiawatha
chown -Rf "$USER":"$(id -g -n)" /usr/local/src/hiawatha
cloneStart
fi
### Copy files to HOME folder with rsync
logg info 'Copying files from /usr/local/src/hiawatha to the HOME directory via rsync'
mkdir -p "$HOME/.local/share/chezmoi"
rsync -rtvu --delete /usr/local/src/hiawatha/docs/ "$HOME/.local/share/chezmoi/docs/" &
rsync -rtvu --delete /usr/local/src/hiawatha/home/ "$HOME/.local/share/chezmoi/home/" &
rsync -rtvu --delete /usr/local/src/hiawatha/system/ "$HOME/.local/share/chezmoi/system/" &
rsync -rtvu /usr/local/src/hiawatha/.chezmoiignore "$HOME/.local/share/chezmoi/.chezmoiignore" &
rsync -rtvu /usr/local/src/hiawatha/.chezmoiroot "$HOME/.local/share/chezmoi/.chezmoiroot" &
rsync -rtvu /usr/local/src/hiawatha/software.yml "$HOME/.local/share/chezmoi/software.yml" &
logg info 'Waiting for rsync jobs to finish'
wait
logg success 'Successfully updated the ~/.local/share/chezmoi folder with changes from the upstream repository'
### Copy new files from src git repository to dotfiles with rsync
rsyncChezmoiFiles() {
rsync -rtvu --delete /usr/local/src/sexy-start/docs/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/docs/" &
rsync -rtvu --delete /usr/local/src/sexy-start/home/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/home/" &
rsync -rtvu --delete /usr/local/src/sexy-start/system/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/system/" &
rsync -rtvu /usr/local/src/sexy-start/.chezmoiignore "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/.chezmoiignore" &
rsync -rtvu /usr/local/src/sexy-start/.chezmoiroot "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/.chezmoiroot" &
rsync -rtvu /usr/local/src/sexy-start/software.yml "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/software.yml" &
wait
logg success 'Successfully updated the ~/.local/share/chezmoi folder with changes from the upstream repository'
}
### Copy files to HOME folder with rsync
logg info 'Copying files from /usr/local/src/sexy-start to the HOME directory via rsync'
mkdir -p "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi"
rsyncChezmoiFiles
### Ensure ~/.local/bin files are executable
logg info 'Ensuring scripts in ~/.local/bin are executable'
find "$HOME/.local/bin" -maxdepth 1 -mindepth 1 -type f | while read -r BINFILE; do

View file

@ -1,10 +1,10 @@
#!/usr/bin/env bash
# @file local/provision.sh
# @brief Installs dependencies, clones the Hiawatha Dotfiles repository, and then starts Chezmoi
# @brief Installs dependencies, clones the Sexy Start repository, and then starts Chezmoi
# @description
# This script ensures Chezmoi, Glow, and Gum are installed. It also includes logging functions for styled logging.
# After dependencies are installed, it adds the necessary files from https://gitlab.com/megabyte-labs/hiawatha-dotfiles.git into
# After dependencies are installed, it adds the necessary files from https://gitlab.com/megabyte-labs/sexy-start.git into
# ~/.local/share/chezmoi. Finally, it begins the TUI experience by displaying styled documentation, prompts, and finishes
# by calling the appropriate Chezmoi commands.
@ -180,7 +180,6 @@ logg() {
fi
}
### Qubes dom0
if command -v qubesctl > /dev/null; then
# The VM name that will manage the Ansible provisioning (for Qubes dom0)
@ -359,39 +358,49 @@ if command -v brew > /dev/null; then
installBrewPackage zx
fi
### Clones the source repository
cloneStart() {
logg info "Cloning ${START_REPO:-https://gitlab.com/megabyte-labs/sexy-start.git} to /usr/local/src/sexy-start"
rm -rf /usr/local/src/sexy-start
sudo git clone ${START_REPO:-https://gitlab.com/megabyte-labs/sexy-start.git} /usr/local/src/sexy-start
chown -Rf "$USER":"$(id -g -n)" /usr/local/src/sexy-start
}
### Ensure source files are present
logg 'Ensuring /usr/local/src/hiawatha is owned by the user'
if [ -d /usr/local/src/hiawatha ] && [ ! -w /usr/local/src/hiawatha ]; then
sudo chown -Rf "$USER":"$(id -g -n)" /usr/local/src/hiawatha
logg 'Ensuring /usr/local/src/sexy-start is owned by the user'
if [ -d /usr/local/src/sexy-start ] && [ ! -w /usr/local/src/sexy-start ]; then
sudo chown -Rf "$USER":"$(id -g -n)" /usr/local/src/sexy-start
fi
if [ -d /usr/local/src/hiawatha/.git ]; then
logg info 'Pulling the latest changes from https://gitlab.com/megabyte-labs/hiawatha-dotfiles.git to /usr/local/src/hiawatha'
cd /usr/local/src/hiawatha || exit 1
if [ -d /usr/local/src/sexy-start/.git ]; then
cd /usr/local/src/sexy-start || exit 1
if [ "$(git remote get-url origin)" == 'https://gitlab.com/megabyte-labs/sexy-start.git' ]; then
logg info "Pulling the latest changes from ${START_REPO:-https://gitlab.com/megabyte-labs/sexy-start.git} to /usr/local/src/sexy-start"
git config pull.rebase false
git reset --hard HEAD
git clean -fxd
git pull origin master
else
logg info "The repository's origin URL has changed so /usr/local/src/sexy-start will be removed and re-cloned using the origin specified by the START_REPO variable"
cloneStart
fi
else
logg info 'Cloning https://gitlab.com/megabyte-labs/hiawatha-dotfiles.git to /usr/local/src/hiawatha'
rm -rf /usr/local/src/hiawatha
sudo git clone https://gitlab.com/megabyte-labs/hiawatha-dotfiles.git /usr/local/src/hiawatha
chown -Rf "$USER":"$(id -g -n)" /usr/local/src/hiawatha
cloneStart
fi
### Copy new files from src git repository to dotfiles with rsync
rsyncChezmoiFiles() {
rsync -rtvu --delete /usr/local/src/hiawatha/docs/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/docs/" &
rsync -rtvu --delete /usr/local/src/hiawatha/home/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/home/" &
rsync -rtvu --delete /usr/local/src/hiawatha/system/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/system/" &
rsync -rtvu /usr/local/src/hiawatha/.chezmoiignore "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/.chezmoiignore" &
rsync -rtvu /usr/local/src/hiawatha/.chezmoiroot "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/.chezmoiroot" &
rsync -rtvu /usr/local/src/hiawatha/software.yml "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/software.yml" &
rsync -rtvu --delete /usr/local/src/sexy-start/docs/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/docs/" &
rsync -rtvu --delete /usr/local/src/sexy-start/home/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/home/" &
rsync -rtvu --delete /usr/local/src/sexy-start/system/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/system/" &
rsync -rtvu /usr/local/src/sexy-start/.chezmoiignore "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/.chezmoiignore" &
rsync -rtvu /usr/local/src/sexy-start/.chezmoiroot "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/.chezmoiroot" &
rsync -rtvu /usr/local/src/sexy-start/software.yml "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/software.yml" &
wait
logg success 'Successfully updated the ~/.local/share/chezmoi folder with changes from the upstream repository'
}
### Copy files to HOME folder with rsync
logg info 'Copying files from /usr/local/src/hiawatha to the HOME directory via rsync'
logg info 'Copying files from /usr/local/src/sexy-start to the HOME directory via rsync'
mkdir -p "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi"
rsyncChezmoiFiles
### Ensure ~/.local/bin files are executable