Update 5 files

- /home/.chezmoiscripts/universal/run_onchange_after_51-samba.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_53-tabby.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_59-connect-tailscale.sh.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_81-k8s-digitalocean.sh.tmpl
- /home/.chezmoi.yaml.tmpl
This commit is contained in:
Brian Zalewski 2023-04-18 04:57:54 +00:00
parent 51ade9064a
commit 187a33a410
5 changed files with 27 additions and 13 deletions

View file

@ -171,6 +171,7 @@ data:
r2: "{{ $cloudflareR2AccountId }}"
username: "{{ $cloudflareUsername }}"
defaultBrowser: firefox
digitalOceanClusterId: b7fc4e37-ffe7-4ea1-887a-0e19ee077f32
# `domain` is kept here for backwards compatibility, but the .host.domain is the preferred selector
domain: "{{ $domain }}"
email: "{{ $email }}"

View file

@ -58,19 +58,19 @@ if command -v smbd > /dev/null; then
if [ -d /mnt/s3-private ] && [ ! -d /mnt/samba-private ]; then
sudo ln -s /mnt/s3-private /mnt/samba-private
else
sudo mkdir /mnt/samba-private
sudo mkdir -p /mnt/samba-private
fi
### Ensure public Samba directory / symlink exists
if [ -d /mnt/s3-public ] && [ ! -d /mnt/samba-public ]; then
sudo ln -s /mnt/s3-public /mnt/samba-public
else
sudo mkdir /mnt/samba-public
sudo mkdir -p /mnt/samba-public
fi
### Copy the Samba server configuration file
logg info "Copying Samba server configuration to /etc/samba/smb.conf"
sudo cp -f "${XDG_DATA_HOME:-$HOME/.config}/samba/config" "/etc/samba/smb.conf"
sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/samba/config" "/etc/samba/smb.conf"
### Reload configuration file changes
smbcontrol smbd reload-config

View file

@ -47,7 +47,7 @@
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/tabby/plugins/package-lock.json" ]; then
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/tabby/plugins/package.json" ]; then
if [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/tabby/plugins/node_modules" ]; then
logg info 'Skipping Tabby plugin installation because it looks like the plugins were already installed since `node_modules` is present in ~/.config/tabby/plugins'
else

View file

@ -6,6 +6,9 @@
# This script ensures the `tailscaled` system daemon is installed on macOS. Then, on both macOS and Linux, it connects to the Tailscale
# network if the `TAILSCALE_AUTH_KEY` variable is provided.
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Install the Tailscale system daemon
if [ -d /Applications ] && [ -d System ]; then
# macOS

View file

@ -6,16 +6,26 @@
# This script runs when `DIGITALOCEAN_ACCESS_TOKEN` is defined as an environment variable or as an encrypted key (see
# [Secrets documentation](https://install.doctor/docs/customization/secrets#encrypted-secrets)). If the check passes,
# then the script ensures the DigitalOcean CLI is installed (i.e. `doctl`). Then, it uses `doctl` to connect to the Kubernetes
# cluster defined by the `DIGITALOCEAN_K8S_ID` secret.
# This script detects the presence of various executables with Bash completions available and then
# conditionally adds the completions to the Bash completions folder.
# cluster defined by the the configuration stored under `.user.digitalOceanClusterId` in `home/.chezmoi.yaml.tmpl`.
### Ensure DigitalOcean CLI is instaled
if ! command -v doctl > /dev/null; then
logg info '`doctl` is missing - installing via Homebrew'
brew install doctl
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Ensure `DIGITALOCEAN_ACCESS_TOKEN` is defined (used for headlessly connecting to the k8s cluster)
export DIGITALOCEAN_ACCESS_TOKEN="{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "DIGITALOCEAN_ACCESS_TOKEN")) }}{{ includeTemplate "secrets/DIGITALOCEAN_ACCESS_TOKEN" | decrypt }}{{ else }}{{ env "DIGITALOCEAN_ACCESS_TOKEN" }}{{ end }}"
if [ -n "$DIGITALOCEAN_ACCESS_TOKEN" ] && [ -n '{{ .user.digitalOceanClusterId }}' ]; then
### Ensure DigitalOcean CLI is instaled
if ! command -v doctl > /dev/null; then
logg info '`doctl` is missing - installing via Homebrew'
brew install doctl
fi
### Connect to the k8s cluster with `doctl`
logg info 'Connecting to the DigitalOcean k8s cluster with `doctl`'
doctl kubernetes cluster kubeconfig save {{ .user.digitalOceanClusterId }}
else
logg info 'Skipping connecting to the DigitalOcean k8s cluster because either the `DIGITALOCEAN_ACCESS_TOKEN` or the `.user.digitalOceanClusterId` is not defined'
fi
doctl kubernetes cluster kubeconfig save b7fc4e37-ffe7-4ea1-887a-0e19ee077f32
{{ end -}}