mirror of
https://github.com/Xevion/dotfiles.git
synced 2025-12-06 03:14:52 -06:00
Migrate hardcoded encrypted files to centralized secret management: - Replace encrypted domain file with Doppler variable PRIVATE_DOMAIN - Remove encrypted R2 FUSE script and s3fs password files - Update hishtory server configuration in commonrc.sh and install script - Clean up .chezmoiignore for removed encrypted files This consolidates secret management into Doppler, reducing the number of encrypted files in the repository while maintaining security.
82 lines
2.4 KiB
Bash
82 lines
2.4 KiB
Bash
{{ if eq .chezmoi.os "linux" -}}
|
|
#!/bin/bash
|
|
set -xeu
|
|
|
|
{{/* This script is intended to be idempotent and should be safe to run multiple times. */ -}}
|
|
{{/* No custom packages should be expected to be installed by default. */ -}}
|
|
|
|
{{ if .wsl }}
|
|
# WSL-specific commands
|
|
sudo apt install -y keychain
|
|
{{ else }}
|
|
# Non-WSL commands
|
|
sudo apt install -y xclip xsel
|
|
{{ end }}
|
|
|
|
{{/* TODO: Add basic yes/no prompts before installing packages */ -}}
|
|
if ! type -P zsh; then
|
|
echo "chezmoi: Installing zsh"
|
|
sudo apt install zsh
|
|
fi
|
|
|
|
# Install micro (+ register as text editor)
|
|
if ! type -P micro; then
|
|
echo "chezmoi: Installing micro"
|
|
sudo apt remove -y micro
|
|
curl https://getmic.ro/r | sudo sh
|
|
sudo mv ./micro /usr/bin/micro
|
|
fi
|
|
|
|
{{/* libpq-dev libssh-dev libsqlite3-dev */ -}}
|
|
echo "chezmoi: Installing apt packages"
|
|
PACKAGES='git fzf zsh fish sqlite curl ripgrep jq' # Install and/or update
|
|
sudo apt install -y $PACKAGES
|
|
|
|
INSTALL_ONLY_PACKAGES='iperf3 unzip p7zip-full nmap reptyr btop' # Install only if missing
|
|
MISSING_PACKAGES=""
|
|
for pkg in $INSTALL_ONLY_PACKAGES; do
|
|
if ! dpkg -l $pkg >/dev/null 2>&1; then
|
|
MISSING_PACKAGES="$MISSING_PACKAGES $pkg"
|
|
fi
|
|
done
|
|
|
|
if [ -n "$MISSING_PACKAGES" ]; then
|
|
echo "chezmoi: The following packages are missing and will be installed: $MISSING_PACKAGES"
|
|
sudo apt install -y $MISSING_PACKAGES
|
|
fi
|
|
|
|
# Install hishtory
|
|
if ! type -P hishtory; then
|
|
echo "chezmoi: Installing hishtory"
|
|
export HISHTORY_SERVER="https://hsh.{{ dopplerProjectJson.PRIVATE_DOMAIN }}"
|
|
export HISHTORY_SKIP_INIT_IMPORT='true'
|
|
curl https://hishtory.dev/install.py | python3 - --offline --skip-config-modification
|
|
fi
|
|
|
|
# Hishtory initialization
|
|
if type -P hishtory; then
|
|
|
|
|
|
if ! hishtory status | grep -q "$(doppler secrets get HISHTORY_USER_SECRET --plain)"; then
|
|
echo "chezmoi: expected user secret not found, initializing hishtory"
|
|
|
|
hishtory init "$(doppler secrets get HISHTORY_USER_SECRET --plain)" --force
|
|
hishtory syncing enable
|
|
fi
|
|
else
|
|
echo "chezmoi: hishtory not found, skipping initialization"
|
|
fi
|
|
|
|
# Install chatgpt
|
|
if ! type -P chatgpt; then
|
|
echo "chezmoi: Installing chatgpt"
|
|
curl -L -o chatgpt https://github.com/kardolus/chatgpt-cli/releases/latest/download/chatgpt-linux-amd64
|
|
chmod +x chatgpt
|
|
sudo mv chatgpt /usr/local/bin/
|
|
fi
|
|
|
|
{{- else if eq .chezmoi.os "darwin" -}}
|
|
#!/bin/sh
|
|
brew install ripgrep
|
|
{{ end -}}
|