This commit is contained in:
Brian Zalewski 2023-07-17 17:41:49 +00:00
parent d8adba1c1c
commit 03f5dbdce6
13 changed files with 46 additions and 20 deletions

View file

@ -57,12 +57,12 @@ if command -v code > /dev/null && command -v npm > /dev/null && [ -f "${XDG_DATA
if sudo cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/vscode/package.json" /package.json; then
logg info 'Successfully copied linter fallback configurations package.json to /package.json'
logg info 'Installing system root directory node_modules'
cd / && sudo npm i --no-package-lock || EXIT_CODE=$?
cd / && sudo npm i --quiet --no-package-lock || EXIT_CODE=$?
else
logg warn 'Unable to successfully copy linter fallback configurations package.json to /package.json'
logg info 'Installing linter fallback configurations node_modules to home directory instead'
cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/vscode/package.json" "$HOME/package.json"
cd ~ && npm i --no-package-lock || EXIT_CODE=$?
cd ~ && npm i --quiet --no-package-lock || EXIT_CODE=$?
fi
### Log message if install failed

View file

@ -35,10 +35,12 @@ function gitomaticSetup() {
### macOS
logg info 'Copying `gitomatic` plist file to /Library/LaunchDaemons'
sudo cp -f "{{ .chezmoi.homeDir }}/.config/gitomatic/gitomatic.plist" /Library/LaunchDaemons/gitomatic.plist
if ! sudo launchctl list | grep 'gitomatic' > /dev/null; then
logg info 'Running `sudo launchctl load /Library/LaunchDaemons/gitomatic.plist`'
sudo launchctl load /Library/LaunchDaemons/gitomatic.plist
logg info 'Running `sudo launchctl start /Library/LaunchDaemons/gitomatic.plist`'
sudo launchctl start /Library/LaunchDaemons/gitomatic.plist
fi
else
### Linux
logg info 'Copying `gitomatic` systemd unit file to /etc/systemd/system/'

View file

@ -88,9 +88,9 @@ if command -v smbd > /dev/null; then
chmod 775 "$HOME/Public"
chown -Rf {{ .user.username }}:rclone "$HOME/Public"
sudo sharing -a "$PRIVATE_SHARE" -S "Private (System)" -n "Private (System)" -g 000 -s 001 -E 1 -R 1 && logg success "Configured $PRIVATE_SHARE as a private Samba share"
sudo sharing -a "$PUBLIC_SHARE" -S "Public (System)" -n "Public (System)" -g 001 -s 001 -E 1 -R 0 && logg success "Configured $PUBLIC_SHARE as a public Samba share"
sudo sharing -a "$HOME/Public" -S "Public (User)" -n "Public (User)" -g 001 -s 001 -E 1 -R 0 && logg success "Configured $HOME/Public as a public Samba share"
sudo sharing -a "$PRIVATE_SHARE" -S "Private (System)" -n "Private (System)" -g 000 -s 001 -E 1 -R 1 && logg success "Configured $PRIVATE_SHARE as a private Samba share" || logg info '`sharing` command failed - it is likely that the share was already set up'
sudo sharing -a "$PUBLIC_SHARE" -S "Public (System)" -n "Public (System)" -g 001 -s 001 -E 1 -R 0 && logg success "Configured $PUBLIC_SHARE as a public Samba share" || logg info '`sharing` command failed - it is likely that the share was already set up'
sudo sharing -a "$HOME/Public" -S "Public (User)" -n "Public (User)" -g 001 -s 001 -E 1 -R 0 && logg success "Configured $HOME/Public as a public Samba share" || logg info '`sharing` command failed - it is likely that the share was already set up'
else
logg info 'Ensuring /mnt for S3 buckets and Samba shares are configured'

View file

@ -53,7 +53,7 @@ if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/tabby/plugins/package.json" ]; then
else
logg info 'Installing Tabby plugins defined in `'"${XDG_CONFIG_HOME:-$HOME/.config}/tabby/plugins/package.json"'`'
cd "${XDG_CONFIG_HOME:-$HOME/.config}/tabby/plugins"
npm install
npm install --quiet
logg success 'Finished installing Tabby plugins'
fi
else

View file

@ -1,5 +1,5 @@
{{- if (ne .host.distro.family "windows") -}}
#!/usr/bin/env -S bash -i
#!/usr/bin/env bash
# @file Bash It!
# @brief Ensures Bash is configured to use Bash It!
# @description
@ -15,6 +15,13 @@ if ! command -v powerline > /dev/null; then
install-software powerline > /dev/null
fi
### Include Bash It
export BASH_IT="${XDG_DATA_HOME:-$HOME/.local/share}/bash_it"
export BASH_IT_THEME="powerline"
if command -v powerline-daemon > /dev/null && [ -f "$BASH_IT/bash_it.sh" ]; then
. "$BASH_IT/bash_it.sh"
fi
### Ensure ble.sh installed
if [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/ble.sh" ] && [ ! ]; then
logg info "${XDG_DATA_HOME:-$HOME/.local/share}/ble.sh present and ${XDG_DATA_HOME:-$HOME/.local/share}/blesh not present - installing ble.sh..."
@ -50,7 +57,9 @@ if command -v powerline > /dev/null && [ -f "$HOME/.bashrc" ]; then
### Ensure plugins are enabled
logg info 'Enabling bash-it plugins'
# TODO: Move these plugins to the .chezmoidata.yaml
for PLUGIN in base blesh browser cht-sh dirs gitstatus powerline sudo xterm; do
# Plugin: xterm causing following error so it was removed
# ble: Please run `stty sane' to recover the correct TTY state.
for PLUGIN in base blesh browser cht-sh dirs gitstatus powerline sudo; do
if ls "$BASH_IT/enabled" | grep "$PLUGIN" > /dev/null; then
rm -f "$BASH_IT/enabled/"*"$PLUGIN"* > /dev/null && logg info "Removed old $PLUGIN bash-it plugin symlink" || logg error "Failed to remove $PLUGIN bash-it plugin symlink"
fi

View file

@ -116,13 +116,13 @@ if [ -d /System ] && [ -d /Applications ] && command -v warp-cli > /dev/null; th
logg info 'Adding Cloudflare certificate to `/usr/local/etc/openssl@3/certs/Cloudflare_CA.pem`'
echo | sudo cat - "${XDG_DATA_HOME:-$HOME/.local/share}/warp/Cloudflare_CA.pem" >> /usr/local/etc/openssl@3/certs/Cloudflare_CA.pem
logg info 'Running `/usr/local/opt/openssl@3/bin/c_rehash`'
/usr/local/opt/openssl@3/bin/c_rehash
/usr/local/opt/openssl@3/bin/c_rehash > /dev/null && logg success 'rehash successful'
elif [ -d "/opt/homebrew/etc/openssl@3/certs" ]; then
# Location on arm64 macOS
logg info 'Adding Cloudflare certificate to `/opt/homebrew/etc/openssl@3/certs/Cloudflare_CA.pem`'
echo | sudo cat - "${XDG_DATA_HOME:-$HOME/.local/share}/warp/Cloudflare_CA.pem" >> /opt/homebrew/etc/openssl@3/certs/Cloudflare_CA.pem
logg info 'Running `/opt/homebrew/opt/openssl@3/bin/c_rehash`'
/opt/homebrew/opt/openssl@3/bin/c_rehash
/opt/homebrew/opt/openssl@3/bin/c_rehash > /dev/null && logg success 'rehash successful'
else
logg warn 'Unable to add `Cloudflare_CA.pem` because `/usr/local/etc/openssl@3/certs` and `/opt/homebrew/etc/openssl@3/certs` do not exist!'
fi
@ -244,7 +244,8 @@ if command -v cloudflared > /dev/null && [ -d "$HOME/.local/etc/cloudflared" ];
# Copy over configuration files
logg info 'Copying over configuration files from ~/.local/etc/cloudflared to /usr/local/etc/cloudflared'
sudo cp -rf "$HOME/.local/etc/cloudflared/"* /usr/local/etc/cloudflared
sudo cp -f "$HOME/.local/etc/cloudflared/cert.pem" /usr/local/etc/cloudflared/cert.pem
sudo cp -f "$HOME/.local/etc/cloudflared/config.yml /usr/local/etc/cloudflared/config.yml
# Register tunnel (if not already registered)
if cloudflared tunnel list | grep "host-{{ .host.hostname }}"; then

View file

@ -15,6 +15,9 @@
{{ includeTemplate "universal/profile-before" }}
{{ includeTemplate "universal/logg-before" }}
export VOLTA_HOME="$XDG_DATA_HOME/volta"
export PATH="$VOLTA_HOME/bin:$PATH"
### Ensure node is installed
if ! command -v node > /dev/null; then
if command -v brew; then

View file

@ -11,6 +11,9 @@
{{ includeTemplate "universal/profile-before" }}
{{ includeTemplate "universal/logg-before" }}
export VOLTA_HOME="$XDG_DATA_HOME/volta"
export PATH="$VOLTA_HOME/bin:$PATH"
### Ensure recent version of Node.js is being used
if command -v volta > /dev/null; then
if ! test "$(node --version | sed 's/^v//' | awk '{print $1}' | awk -F'.' ' ( $1 > 15) ')"; then

View file

@ -11,6 +11,9 @@
{{ includeTemplate "universal/profile-before" }}
{{ includeTemplate "universal/logg-before" }}
export VOLTA_HOME="$XDG_DATA_HOME/volta"
export PATH="$VOLTA_HOME/bin:$PATH"
if command -v brew > /dev/null; then
logg 'Installing base dependencies for macOS using `brew bundle`'
logg info 'Dependencies: age asdf jq node glow go go-task/tap/go-task gnupg gum m-cli progress volta yq m-cli yq zx'

View file

@ -195,6 +195,11 @@ if command -v fd > /dev/null; then
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
fi
### gcloud
if command -v python3 > /dev/null; then
export CLOUDSDK_PYTHON="$(which python3)"
fi
### Git
export GIT_MERGE_AUTOEDIT=no

View file

@ -1083,15 +1083,14 @@ async function ensurePackageManager(packageManager) {
await $`brew install volta`
}
await $`
if [ -z "$VOLTA_HOME" ]; then
volta setup
fi
export VOLTA_HOME="\${XDG_DATA_HOME:-$HOME/.local/share}/volta"
export PATH="$VOLTA_HOME/bin:$PATH"
volta setup
volta install node
`
}
log('info', logStage, 'Ensuring Volt has Node.js runtime available')
await $`if ! volta list 2>&1 | grep 'runtime node' > /dev/null; then volta install node; fi`
await $`export VOLTA_HOME="\${XDG_DATA_HOME:-$HOME/.local/share}/volta" && export PATH="$VOLTA_HOME/bin:$PATH" && if ! volta list 2>&1 | grep 'runtime node' > /dev/null; then volta install node; fi`
} else if (packageManager === 'pacman') {
await ensureInstalled('pacman', false)
} else if (packageManager === 'pipx') {

View file

@ -1154,7 +1154,6 @@ softwarePackages:
_name: Bash Completion Formula
_when: '! brew list bash-completion | grep bash-completion > /dev/null'
brew: bash-completion@2
brew: bash-completion@2
axel:
_bin: axel
_docs: null
@ -9440,6 +9439,8 @@ softwarePackages:
_home: https://volta.sh
_name: volta-vm
_post: |
export VOLTA_HOME="$XDG_DATA_HOME/volta"
export PATH="$VOLTA_HOME/bin:$PATH"
volta setup
volta install node@latest
ansible: professormanhattan.volta