This commit is contained in:
Brian Zalewski 2023-12-05 05:53:15 +00:00
parent 54f924697d
commit 25b3f620c0
16 changed files with 320 additions and 265 deletions

View file

@ -11,6 +11,17 @@ adobe-creative-cloud curl: (18) HTTP/2 stream 1 was reset
* export PATH="$HOME/.jenv/bin:$PATH" * export PATH="$HOME/.jenv/bin:$PATH"
* eval "$(jenv init -)" * eval "$(jenv init -)"
# Create the $HOME/opt destination folder
mkdir -p ~/opt
# Download the AppImage inside it
wget -O ~/opt/Espanso.AppImage 'https://github.com/federico-terzi/espanso/releases/download/v2.1.8/Espanso-X11.AppImage'
# Make it executable
chmod u+x ~/opt/Espanso.AppImage
# Create the "espanso" command alias
sudo ~/opt/Espanso.AppImage env-path register
# TODOs # TODOs
This page outlines various projects and tasks that we are currently working on. Creating a GitHub issue for each of these items would be overkill. This page outlines various projects and tasks that we are currently working on. Creating a GitHub issue for each of these items would be overkill.
@ -21,6 +32,7 @@ This page outlines various projects and tasks that we are currently working on.
- Consider https://formulae.brew.sh/cask/parallels-client#default - Consider https://formulae.brew.sh/cask/parallels-client#default
- https://github.com/tadamcz/updates.sh/blob/main/updates.sh (Homebrew download parallelism) - https://github.com/tadamcz/updates.sh/blob/main/updates.sh (Homebrew download parallelism)
- Add Mamba - Add Mamba
- Come up with some sensible defaults for https://espanso.org/
- https://docs.pkgx.sh/using-pkgx/shell-integration - https://docs.pkgx.sh/using-pkgx/shell-integration
- https://containertoolbx.org/install/ - https://containertoolbx.org/install/
- https://github.com/todotxt/todo.txt-cli - https://github.com/todotxt/todo.txt-cli

View file

@ -38,15 +38,9 @@ if [ -d /Applications ] && [ -d /Library ] && [ -z "$NO_RESTART" ]; then
if [ ! -f "$HOME/.zshrc" ] || ! cat "$HOME/.zshrc" | grep '# TEMPORARY FOR INSTALL DOCTOR MACOS' > /dev/null; then if [ ! -f "$HOME/.zshrc" ] || ! cat "$HOME/.zshrc" | grep '# TEMPORARY FOR INSTALL DOCTOR MACOS' > /dev/null; then
echo 'bash <(curl -sSL https://install.doctor/start) # TEMPORARY FOR INSTALL DOCTOR MACOS' >> "$HOME/.zshrc" echo 'bash <(curl -sSL https://install.doctor/start) # TEMPORARY FOR INSTALL DOCTOR MACOS' >> "$HOME/.zshrc"
fi fi
if command -v gtimeout > /dev/null; then
logg info 'Ensuring system software is upgraded (timing out after 50 minutes if system upgrade fails)'
sudo gtimeout 3000 softwareupdate -i -a -R --agree-to-license || logg warn 'The system update command timed out after 50 minutes'
else
# If gtimeout is unavailable, then attempt system upgrade without a timeout (which usually works on fresh systems)
logg info 'Applying OS upgrades (if available)' logg info 'Applying OS upgrades (if available)'
sudo softwareupdate -i -a -R --agree-to-license || logg error 'Failed to perform a system update via sudo softwareupdate -i -a -R' sudo softwareupdate -i -a --agree-to-license --background || logg error 'Failed to trigger a system update via sudo softwareupdate -i -a --agree-to-license --background'
fi logg info 'If system updates are downloaded / installed, a reboot might be required.'
logg info 'If system updates were downloaded / installed, a reboot might be required.'
if command -v gsed > /dev/null; then if command -v gsed > /dev/null; then
sudo gsed -i '/# TEMPORARY FOR INSTALL DOCTOR MACOS/d' "$HOME/.zshrc" || logg warn "Failed to remove kickstart script from .zshrc" sudo gsed -i '/# TEMPORARY FOR INSTALL DOCTOR MACOS/d' "$HOME/.zshrc" || logg warn "Failed to remove kickstart script from .zshrc"
else else

View file

@ -112,7 +112,7 @@ if command -v postfix > /dev/null; then
### Re-generate the /etc/aliases.db file ### Re-generate the /etc/aliases.db file
if [ -f /etc/aliases ]; then if [ -f /etc/aliases ]; then
logg info 'Ensuring proper permissions on the /etc/aliases file' && sudo chown $(stat -c "%U:%G" /etc/sudoers) /etc/aliases logg info 'Ensuring proper permissions on the /etc/aliases file' && sudo chown $(stat -c "%U:%G" /etc/sudoers) /etc/aliases
logg info 'Generating Postfix aliases' && sudo postalias /etc/aliases logg info 'Generating Postfix aliases' && sudo postalias /etc/aliases > /dev/null
else else
logg warn '/etc/aliases is missing which is required for Postfix' logg warn '/etc/aliases is missing which is required for Postfix'
fi fi
@ -133,10 +133,10 @@ if command -v postfix > /dev/null; then
fi fi
if ! sudo postfix status > /dev/null; then if ! sudo postfix status > /dev/null; then
logg info 'Starting postfix' logg info 'Starting postfix'
sudo postfix start sudo postfix start > /dev/null
else else
logg info 'Reloading postfix' logg info 'Reloading postfix'
sudo postfix reload sudo postfix reload > /dev/null
fi fi
else else
### Enable / restart postfix on Linux ### Enable / restart postfix on Linux

View file

@ -16,8 +16,7 @@
if command -v docker > /dev/null; then if command -v docker > /dev/null; then
DOCKERHUB_TOKEN="{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "DOCKERHUB_TOKEN")) }}{{- includeTemplate "secrets/DOCKERHUB_TOKEN" | decrypt | trim -}}{{ else }}{{- env "DOCKERHUB_TOKEN" -}}{{ end }}" DOCKERHUB_TOKEN="{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "DOCKERHUB_TOKEN")) }}{{- includeTemplate "secrets/DOCKERHUB_TOKEN" | decrypt | trim -}}{{ else }}{{- env "DOCKERHUB_TOKEN" -}}{{ end }}"
DOCKERHUB_USER="{{ .user.docker.username }}" DOCKERHUB_USER="{{ .user.docker.username }}"
logg info 'Headlessly authenticating with DockerHub registry' logg info 'Headlessly authenticating with DockerHub registry' && echo "$DOCKERHUB_TOKEN" | docker login -u "$DOCKERHUB_USER" --password-stdin > /dev/null && logg success 'Successfully authenticated with DockerHub registry'
echo "$DOCKERHUB_TOKEN" | docker login -u "$DOCKERHUB_USER" --password-stdin
fi fi
{{- end }} {{- end }}

View file

@ -1,4 +1,4 @@
{{- if (ne .host.distro.family "darwin") -}} {{- if (eq .host.distro.family "darwin") -}}
#!/usr/bin/env bash #!/usr/bin/env bash
# @file macOS System Settings # @file macOS System Settings
# @brief Applies an optimized set of macOS system configurations intended to provide more sensible system defaults # @brief Applies an optimized set of macOS system configurations intended to provide more sensible system defaults
@ -216,6 +216,8 @@ sudo pmset -b sleep 5
sudo pmset -a standbydelay 86400 sudo pmset -a standbydelay 86400
# Never go into computer sleep mode # Never go into computer sleep mode
sudo systemsetup -setdisplaysleep 30 > /dev/null
sudo systemsetup -setharddisksleep Off > /dev/null
sudo systemsetup -setcomputersleep Off > /dev/null sudo systemsetup -setcomputersleep Off > /dev/null
# Hibernation mode # Hibernation mode

View file

@ -20,8 +20,7 @@ if [ -f "$ASDF_DIR/asdf.sh" ] && [ -f ~/.tool-versions ]; then
logg info 'Sourcing asdf.sh' logg info 'Sourcing asdf.sh'
. ${ASDF_DIR}/asdf.sh . ${ASDF_DIR}/asdf.sh
cat .tool-versions | while read TOOL; do cat .tool-versions | while read TOOL; do
logg info 'Installing ASDF plugin '"$(echo "$TOOL" | sed 's/ .*//')"'' logg info 'Installing ASDF plugin '"$(echo "$TOOL" | sed 's/ .*//')"'' && asdf plugin add "$(echo "$TOOL" | sed 's/ .*//')" > /dev/null && logg success "Successfully added $(echo "$TOOL" | sed 's/ .*//') via ASDF"
asdf plugin add "$(echo "$TOOL" | sed 's/ .*//')"
done done
# Only proceed with installation if either DEBUG_MODE is enabled or ~/.cache/megabyte-labs/asdf-install is missing # Only proceed with installation if either DEBUG_MODE is enabled or ~/.cache/megabyte-labs/asdf-install is missing
# Added to save time between tests because PHP takes awhile to install # Added to save time between tests because PHP takes awhile to install

View file

@ -70,7 +70,7 @@ if [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/gas-station/requirements.yml" ]; t
if command -v ansible-galaxy > /dev/null; then if command -v ansible-galaxy > /dev/null; then
logg info 'Ensuring Ansible Galaxy collections are installed' logg info 'Ensuring Ansible Galaxy collections are installed'
export ANSIBLE_CONFIG="${XDG_DATA_HOME:-$HOME/.local/share}/ansible/ansible.cfg" export ANSIBLE_CONFIG="${XDG_DATA_HOME:-$HOME/.local/share}/ansible/ansible.cfg"
ansible-galaxy install -r "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/requirements.yml" || EXIT_CODE=$? ansible-galaxy install -r "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/requirements.yml" > /dev/null || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then if [ -n "$EXIT_CODE" ]; then
logg error 'Failed to install Ansible requirements from Ansible Galaxy' logg error 'Failed to install Ansible requirements from Ansible Galaxy'
if [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/gas-station/collections" ]; then if [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/gas-station/collections" ]; then

View file

@ -36,4 +36,8 @@ if [ -d /Applications ] && [ -d /System ]; then
if command -v m > /dev/null; then if command -v m > /dev/null; then
logg info 'Emptying trash' && m trash clean logg info 'Emptying trash' && m trash clean
fi fi
logg info 'Checking if there is a pending update'
defaults read /Library/Updates/index.plist InstallAtLogout
elif [ -f /var/run/reboot-required ]; then
logg info '/var/run/reboot-required is present so a reboot is required'
fi fi

View file

@ -20,10 +20,6 @@ if [ -n "$KEYID" ] && command -v gpg > /dev/null; then
chown -Rf "$(whoami)" "$HOME/.gnupg/" chown -Rf "$(whoami)" "$HOME/.gnupg/"
find "$HOME/.gnupg" -type f -exec chmod 600 {} \; find "$HOME/.gnupg" -type f -exec chmod 600 {} \;
find "$HOME/.gnupg" -type d -exec chmod 700 {} \; find "$HOME/.gnupg" -type d -exec chmod 700 {} \;
if [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/private_dot_gnupg/public/${KEYID}.asc" ]; then
logg info "Importing GPG key stored in ${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/private_dot_gnupg/public/${KEYID}.asc since its name matches the GPG key ID in .chezmoi.yaml.tmpl"
gpg --import "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/private_dot_gnupg/public/${KEYID}.asc" && logg success 'Successfully imported master GPG key'
fi
if [ ! -f "$HOME/.gnupg/gpg.conf" ]; then if [ ! -f "$HOME/.gnupg/gpg.conf" ]; then
logg 'Downloading hardened gpg.conf file to ~/.gpnupg/gpg.conf' logg 'Downloading hardened gpg.conf file to ~/.gpnupg/gpg.conf'
curl -sSL "{{ .config.gpg }}" > "$HOME/.gnupg/gpg.conf" curl -sSL "{{ .config.gpg }}" > "$HOME/.gnupg/gpg.conf"
@ -31,12 +27,12 @@ if [ -n "$KEYID" ] && command -v gpg > /dev/null; then
fi fi
KEYID_TRIMMED="$(echo "$KEYID" | sed 's/^0x//')" KEYID_TRIMMED="$(echo "$KEYID" | sed 's/^0x//')"
if ! gpg --list-secret-keys --keyid-format=long | grep "$KEYID_TRIMMED" > /dev/null; then if ! gpg --list-secret-keys --keyid-format=long | grep "$KEYID_TRIMMED" > /dev/null; then
logg info 'Killing dirmngr instance and reloading daemon with standard-resolver' if [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/private_dot_gnupg/public/${KEYID}.asc" ]; then
sudo pkill dirmngr logg info "Importing GPG key stored in ${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/private_dot_gnupg/public/${KEYID}.asc since its name matches the GPG key ID in .chezmoi.yaml.tmpl"
dirmngr --daemon --standard-resolver gpg --import "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/private_dot_gnupg/public/${KEYID}.asc" && logg success 'Successfully imported master GPG key'
if [ -f "$HOME/.gnupg/public/$KEYID.sig" ]; then
gpg --import "$HOME/.gnupg/public/$KEYID.sig"
else else
logg info 'Killing dirmngr instance and reloading daemon with standard-resolver' && sudo pkill dirmngr
dirmngr --daemon --standard-resolver
logg info 'Attempting to download the specified public GPG key ({{ .user.gpg.id }}) from public keyservers' logg info 'Attempting to download the specified public GPG key ({{ .user.gpg.id }}) from public keyservers'
gpg --keyserver https://pgp.mit.edu --recv "$KEYID" || EXIT_CODE=$? gpg --keyserver https://pgp.mit.edu --recv "$KEYID" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then if [ -n "$EXIT_CODE" ]; then
@ -48,9 +44,9 @@ if [ -n "$KEYID" ] && command -v gpg > /dev/null; then
logg success 'Successfully imported configured public user GPG key' logg success 'Successfully imported configured public user GPG key'
fi fi
fi fi
fi
logg info 'Stopping dirmngr' logg info 'Stopping dirmngr'
gpgconf --kill dirmngr && logg info 'Stopped dirmngr' || info warn 'Failed to stop dirmngr' gpgconf --kill dirmngr && logg info 'Stopped dirmngr' || info warn 'Failed to stop dirmngr'
fi
else else
logg info 'Key is already in keyring' logg info 'Key is already in keyring'
fi fi

View file

@ -0,0 +1,4 @@
filter_title: "Visual Studio Code"
extra_includes:
- "../match/_code_snippets.yml"

View file

View file

@ -342,6 +342,15 @@ async function generateInstallOrders(pkgsToInstall) {
} }
} }
// Handle the _app definition
const appName = softwarePackages[packageKey]['_app']
if (appName) {
if(fileExists(`/Applications/${appName}`) || fileExists(`${process.env.HOME}/Applications/${appName}`)) {
processPluginOrders(pkg)
continue pkgFor
}
}
// Handle the _deps attribute // Handle the _deps attribute
currentSelector = 'deps' currentSelector = 'deps'
doubleScoped = doubleScoped =
@ -582,9 +591,9 @@ async function afterInstall(packageManager) {
log('info', logStage, `Ensuring temporary passwordless sudo privileges used by Ansible are removed`) log('info', logStage, `Ensuring temporary passwordless sudo privileges used by Ansible are removed`)
const gsed = which.sync('gsed', { nothrow: true }) const gsed = which.sync('gsed', { nothrow: true })
if (gsed) { if (gsed) {
await $`sudo gsed -i '/# TEMPORARY FOR ANSIBLE INSTALL DOCTOR/d' /etc/sudoers` await $`sudo gsed -i '/# TEMPORARY FOR INSTALL DOCTOR ANSIBLE/d' /etc/sudoers`
} else { } else {
await $`sudo sed -i '/# TEMPORARY FOR ANSIBLE INSTALL DOCTOR/d' /etc/sudoers` await $`sudo sed -i '/# TEMPORARY FOR INSTALL DOCTOR ANSIBLE/d' /etc/sudoers`
} }
} else if (packageManager === 'apk') { } else if (packageManager === 'apk') {
} else if (packageManager === 'apt') { } else if (packageManager === 'apt') {
@ -1837,10 +1846,9 @@ async function linkBin(installOrdersBinLink) {
} catch (e) { } catch (e) {
log('warn', 'Bin', `Expected flatpak directory not available - ${flatpakDir}/app/${pkg}`) log('warn', 'Bin', `Expected flatpak directory not available - ${flatpakDir}/app/${pkg}`)
} }
} else if (binLink.preference === 'cask') { } else if (softwarePackages[binLink.package]['_app']) {
try { try {
const caskWhen = softwarePackages[binLink.package]['_when:cask'].replace(/blue/g, "red") const appName = softwarePackages[binLink.package]['_app']
const appName = caskWhen.replace(/ && ! test -d .*/, '').replace(/! test -d "\/Applications\//, '').replace(/! test -d \/Applications\//, '').replace('"', '')
log('info', 'Bin', `Checking for existence of ${appName} application in /Applications and ~/Applications`) log('info', 'Bin', `Checking for existence of ${appName} application in /Applications and ~/Applications`)
if (fileExists(`/Applications/${appName}`)) { if (fileExists(`/Applications/${appName}`)) {
runCommand( runCommand(

27
scripts/partials/reboot Normal file
View file

@ -0,0 +1,27 @@
# @description This function determines whether or not a reboot is required on the target system.
# On Linux, it will check for the presence of the `/var/run/reboot-required` file to determine
# whether or not a reboot is required. On macOS, it will reboot `/Library/Updates/index.plist`
# to determine whether or not a reboot is required.
#
# After determining whether or not a reboot is required, the script will attempt to automatically
# reboot the machine.
handleRequiredReboot() {
if [ -d /Applications ] && [ -d /System ]; then
### macOS
logg info 'Checking if there is a pending update' && defaults read /Library/Updates/index.plist InstallAtLogout
# TODO - Uncomment this when we can determine conditions for reboot
# sudo shutdown -r now
elif [ -f /var/run/reboot-required ]; then
### Linux
logg info '/var/run/reboot-required is present so a reboot is required'
if command -v systemctl > /dev/null; then
logg info 'systemctl present so rebooting with sudo systemctl start reboot.target' && sudo systemctl start reboot.target
elif command -v reboot > /dev/null; then
logg info 'reboot available as command so rebooting with sudo reboot' && sudo reboot
elif command -v shutdown > /dev/null; then
logg info 'shutdown command available so rebooting with sudo shutdown -r now' && sudo shutdown -r now
else
logg warn 'Reboot required but unable to determine appropriate restart command'
fi
fi
}

View file

@ -79,6 +79,7 @@ setEnvironmentVariables() {
{{ include "partials" "basic-deps" }} {{ include "partials" "basic-deps" }}
{{ include "partials" "homebrew" }} {{ include "partials" "homebrew" }}
{{ include "partials" "reboot" }}
# @description Load default settings if it is in a CI setting # @description Load default settings if it is in a CI setting
setCIEnvironmentVariables() { setCIEnvironmentVariables() {
if [ -n "$CI" ]; then if [ -n "$CI" ]; then
@ -385,5 +386,6 @@ provisionLogic() {
logg info "Running the Chezmoi provisioning" && runChezmoi logg info "Running the Chezmoi provisioning" && runChezmoi
logg info "Ensuring temporary passwordless sudo is removed" && removePasswordlessSudo logg info "Ensuring temporary passwordless sudo is removed" && removePasswordlessSudo
logg info "Handling post-provision logic" && postProvision logg info "Handling post-provision logic" && postProvision
logg info "Determing whether or not reboot" && handleRequiredReboot
} }
provisionLogic provisionLogic

File diff suppressed because it is too large Load diff