mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-03-21 08:07:03 +00:00
Compare commits
6 Commits
7cfafbfa87
...
26.2.5
| Author | SHA1 | Date | |
|---|---|---|---|
| 443361cddb | |||
| 083d30a0c3 | |||
| 81190c051a | |||
| de773ad68f | |||
| e8725c4b47 | |||
| b8070e2815 |
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
# @description Create file containing key mappings for Neovim
|
# @description Create file containing key mappings for Neovim
|
||||||
# Usage: ./create-nvim-keymaps.sh
|
# Usage: ./create-nvim-keymaps.sh
|
||||||
#
|
#
|
||||||
@@ -15,7 +16,7 @@ main()
|
|||||||
printf "\`\`\`txt"
|
printf "\`\`\`txt"
|
||||||
} > "$DEST"
|
} > "$DEST"
|
||||||
|
|
||||||
nvim -c "redir! >> $DEST" -c 'silent verbose map' -c 'redir END' -c 'q'
|
nvim -c "redir! >> \"$DEST\"" -c 'silent verbose map' -c 'redir END' -c 'q'
|
||||||
|
|
||||||
printf "\n\`\`\`\n\n- Generated on %s\n" "$(date)" >> "$DEST"
|
printf "\n\`\`\`\n\n- Generated on %s\n" "$(date)" >> "$DEST"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
# @description Install cargo/rust packages.
|
# @description Install cargo/rust packages.
|
||||||
|
#
|
||||||
|
# shellcheck source=shared.sh
|
||||||
|
source "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
msgr run "Starting to install rust/cargo packages"
|
msgr run "Starting to install rust/cargo packages"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
# @description Update pure-bash-bible cheatsheets
|
# @description Update pure-bash-bible cheatsheets
|
||||||
# shellcheck disable=SC2231,SC2034,SC2181,SC2068
|
# shellcheck disable=SC2231,SC2034,SC2181,SC2068
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
@@ -85,7 +86,7 @@ process_chapters()
|
|||||||
if [ '---' != "$(head -1 < "$cheat_file")" ]; then
|
if [ '---' != "$(head -1 < "$cheat_file")" ]; then
|
||||||
local metadata
|
local metadata
|
||||||
metadata="$PBB_SYNTAX\n$PBB_TAGS\n$PBB_SOURCE\n"
|
metadata="$PBB_SYNTAX\n$PBB_TAGS\n$PBB_SOURCE\n"
|
||||||
echo -e "---\n$metadata---\n$(cat "$cheat_file")" > "$cheat_file"
|
printf '%s\n%b%s\n%s' "---" "$metadata" "---" "$(cat "$cheat_file")" > "$cheat_file"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
# @description Install PHP Package Manager Composer
|
# @description Install PHP Package Manager Composer
|
||||||
#
|
#
|
||||||
# shellcheck source="shared.sh"
|
# shellcheck source="shared.sh"
|
||||||
source "$HOME/.dotfiles/config/shared.sh"
|
source "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
if ! command -v php &> /dev/null; then
|
if ! command -v php &> /dev/null; then
|
||||||
msg_err "PHP Not Available, cannot install composer"
|
msg_err "PHP Not Available, cannot install composer"
|
||||||
@@ -22,5 +23,7 @@ fi
|
|||||||
php composer-setup.php --quiet
|
php composer-setup.php --quiet
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
rm composer-setup.php
|
rm composer-setup.php
|
||||||
mv composer.phar ~/.local/bin/composer
|
if [ $RESULT -eq 0 ]; then
|
||||||
|
mv composer.phar ~/.local/bin/composer
|
||||||
|
fi
|
||||||
exit $RESULT
|
exit $RESULT
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
# @description Install NerdFonts
|
# @description Install NerdFonts
|
||||||
#
|
#
|
||||||
# shellcheck source="shared.sh"
|
# shellcheck source="shared.sh"
|
||||||
@@ -21,7 +22,7 @@ clone_or_update_repo()
|
|||||||
git clone --quiet --filter=blob:none --sparse --depth=1 "$GIT_REPO" "$TMP_PATH"
|
git clone --quiet --filter=blob:none --sparse --depth=1 "$GIT_REPO" "$TMP_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$TMP_PATH" || msgr err "No such folder $TMP_PATH"
|
cd "$TMP_PATH" || { msgr err "No such folder $TMP_PATH"; exit 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add fonts to sparse-checkout
|
# Function to add fonts to sparse-checkout
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
# @description Install GitHub CLI extensions
|
# @description Install GitHub CLI extensions
|
||||||
#
|
#
|
||||||
# shellcheck source="shared.sh"
|
# shellcheck source="shared.sh"
|
||||||
source "${DOTFILES}/config/shared.sh"
|
source "${DOTFILES}/config/shared.sh"
|
||||||
|
|
||||||
# Enable verbosity with VERBOSE=1
|
|
||||||
VERBOSE="${VERBOSE:-0}"
|
|
||||||
|
|
||||||
msgr run "Installing gh (GitHub Client) extensions"
|
msgr run "Installing gh (GitHub Client) extensions"
|
||||||
|
|
||||||
if ! command -v gh &> /dev/null; then
|
if ! command -v gh &> /dev/null; then
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
# @description Install git-crypt
|
# @description Install git-crypt
|
||||||
#
|
#
|
||||||
# NOTE: Experimental, wip
|
# NOTE: Experimental, wip
|
||||||
@@ -6,21 +7,17 @@
|
|||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "${DOTFILES}/config/shared.sh"
|
source "${DOTFILES}/config/shared.sh"
|
||||||
|
|
||||||
# Enable verbosity with VERBOSE=1
|
|
||||||
VERBOSE="${VERBOSE:-0}"
|
|
||||||
|
|
||||||
msgr run "Installing git-crypt"
|
msgr run "Installing git-crypt"
|
||||||
|
|
||||||
if ! command -v git-crypt &> /dev/null; then
|
if ! command -v git-crypt &> /dev/null; then
|
||||||
REPO_URL="https://github.com/AGWA/git-crypt.git"
|
REPO_URL="https://github.com/AGWA/git-crypt.git"
|
||||||
CHECK_PATH="${XDG_BIN_HOME}/git-crypt"
|
CHECK_PATH="${XDG_BIN_HOME}/git-crypt"
|
||||||
BUILD_PATH="/tmp/git-crypt"
|
BUILD_PATH="$(mktemp -d)"
|
||||||
|
trap 'rm -rf "$BUILD_PATH"' EXIT
|
||||||
|
|
||||||
rm -rf "$BUILD_PATH"
|
if [ ! -f "$CHECK_PATH" ]; then
|
||||||
|
git clone --depth 1 "$REPO_URL" "$BUILD_PATH" || { msgr err "Failed to clone $REPO_URL"; exit 1; }
|
||||||
if [ ! -d "$CHECK_PATH" ]; then
|
cd "$BUILD_PATH" || { msgr err "$BUILD_PATH not found"; exit 1; }
|
||||||
git clone --depth 1 "$REPO_URL" "$BUILD_PATH" || true
|
|
||||||
cd "$BUILD_PATH" || msg_err "$BUILD_PATH not found"
|
|
||||||
make && make install PREFIX="$HOME/.local"
|
make && make install PREFIX="$HOME/.local"
|
||||||
else
|
else
|
||||||
msgr run_done "git-crypt ($CHECK_PATH) already installed"
|
msgr run_done "git-crypt ($CHECK_PATH) already installed"
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
# @description Install Go packages
|
# @description Install Go packages
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$DOTFILES/config/shared.sh"
|
source "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
# Enable verbosity with VERBOSE=1
|
|
||||||
VERBOSE="${VERBOSE:-0}"
|
|
||||||
|
|
||||||
msgr run "Installing go packages"
|
msgr run "Installing go packages"
|
||||||
|
|
||||||
! x-have "go" && msgr err "go hasn't been installed yet." && exit 0
|
! x-have "go" && msgr err "go hasn't been installed yet." && exit 0
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -uo pipefail
|
||||||
# @description Sets macOS Defaults that I like
|
# @description Sets macOS Defaults that I like
|
||||||
#
|
#
|
||||||
# This script contains large portions from following scripts:
|
# This script contains large portions from following scripts:
|
||||||
@@ -7,7 +8,7 @@
|
|||||||
[ "$(uname)" != "Darwin" ] && echo "Not a macOS system" && exit 0
|
[ "$(uname)" != "Darwin" ] && echo "Not a macOS system" && exit 0
|
||||||
|
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$HOME/.dotfiles/config/shared.sh"
|
source "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
msgr run "Starting to set macOS defaults, these require sudo privileges:"
|
msgr run "Starting to set macOS defaults, these require sudo privileges:"
|
||||||
|
|
||||||
@@ -23,12 +24,12 @@ while true; do
|
|||||||
done 2> /dev/null &
|
done 2> /dev/null &
|
||||||
|
|
||||||
# Skip when shell is fish
|
# Skip when shell is fish
|
||||||
if [[ $SHELL != $(which fish) ]]; then
|
if [[ $SHELL != "$(command -v fish)" ]]; then
|
||||||
msgr nested "Change user shell to zsh if it is available and not the current"
|
msgr nested "Change user shell to zsh if it is available and not the current"
|
||||||
|
|
||||||
# Change user shell to zsh if not that already.
|
# Change user shell to zsh if not that already.
|
||||||
if hash zsh 2> /dev/null; then
|
if hash zsh 2> /dev/null; then
|
||||||
[[ $SHELL != $(which zsh) ]] && chsh -s "$(which zsh)"
|
[[ $SHELL != "$(command -v zsh)" ]] && chsh -s "$(command -v zsh)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
# @description Install npm packages globally.
|
# @description Install npm packages globally.
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$DOTFILES/config/shared.sh"
|
source "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
# Enable verbosity with VERBOSE=1
|
|
||||||
VERBOSE="${VERBOSE:-0}"
|
|
||||||
|
|
||||||
msgr msg "Starting to install npm packages"
|
msgr msg "Starting to install npm packages"
|
||||||
|
|
||||||
if ! command -v npm &> /dev/null; then
|
if ! command -v npm &> /dev/null; then
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
# @description Install ntfy
|
# @description Install ntfy
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$DOTFILES/config/shared.sh"
|
source "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
# Enable verbosity with VERBOSE=1
|
|
||||||
VERBOSE="${VERBOSE:-0}"
|
|
||||||
|
|
||||||
# Check if ntfy is already installed
|
# Check if ntfy is already installed
|
||||||
if x-have "ntfy"; then
|
if x-have "ntfy"; then
|
||||||
msgr "done" "ntfy already installed"
|
msgr "done" "ntfy already installed"
|
||||||
@@ -23,28 +21,31 @@ case $(dfm check arch) in
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
msgr err "Unsupported OS"
|
msgr err "Unsupported OS"
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
NTFY_VERSION="$(x-gh-get-latest-version binwiederhier/ntfy)"
|
NTFY_VERSION="$(x-gh-get-latest-version binwiederhier/ntfy)"
|
||||||
NTFY_URL="https://github.com/binwiederhier/ntfy"
|
NTFY_URL="https://github.com/binwiederhier/ntfy"
|
||||||
NTFY_DEST="/tmp/ntfy_${NTFY_VERSION}_${NTFY_ARCH}"
|
NTFY_TARBALL="ntfy_${NTFY_VERSION}_${NTFY_ARCH}.tar.gz"
|
||||||
|
NTFY_DIR="ntfy_${NTFY_VERSION}_${NTFY_ARCH}"
|
||||||
|
|
||||||
# Download and extract ntfy
|
# Download and extract ntfy
|
||||||
install_ntfy()
|
install_ntfy()
|
||||||
{
|
{
|
||||||
curl -L "$NTFY_URL/releases/download/v${NTFY_VERSION}/${NTFY_DEST}.tar.gz" -o "${NTFY_DEST}.tar.gz"
|
local tmpdir
|
||||||
tar zxvf "${NTFY_DEST}.tar.gz"
|
tmpdir="$(mktemp -d)"
|
||||||
cp -a "${NTFY_DEST}/ntfy" ~/.local/bin/ntfy
|
trap 'rm -rf "$tmpdir"' EXIT
|
||||||
|
|
||||||
|
curl -L "$NTFY_URL/releases/download/v${NTFY_VERSION}/${NTFY_TARBALL}" -o "$tmpdir/${NTFY_TARBALL}"
|
||||||
|
tar zxvf "$tmpdir/${NTFY_TARBALL}" -C "$tmpdir"
|
||||||
|
cp -a "$tmpdir/${NTFY_DIR}/ntfy" ~/.local/bin/ntfy
|
||||||
mkdir -p ~/.config/ntfy
|
mkdir -p ~/.config/ntfy
|
||||||
|
|
||||||
# Copy config only if it does not exist
|
# Copy config only if it does not exist
|
||||||
if [ ! -f "$HOME/.config/ntfy/client.yml" ]; then
|
if [ ! -f "$HOME/.config/ntfy/client.yml" ]; then
|
||||||
cp "${NTFY_DEST}/client/client.yml" ~/.config/ntfy/client.yml
|
cp "$tmpdir/${NTFY_DIR}/client/client.yml" ~/.config/ntfy/client.yml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean up
|
|
||||||
rm -rf "${NTFY_DEST}" "${NTFY_DEST}.tar.gz"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
# @description Install Python packages using uv.
|
# @description Install Python packages using uv.
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$DOTFILES/config/shared.sh"
|
source "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
# Enable verbosity with VERBOSE=1
|
|
||||||
VERBOSE="${VERBOSE:-0}"
|
|
||||||
|
|
||||||
msgr run "Starting to install Python packages"
|
msgr run "Starting to install Python packages"
|
||||||
|
|
||||||
# Ensure uv is available
|
# Ensure uv is available
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
# @description Install XCode CLI Tools with osascript magic.
|
# @description Install XCode CLI Tools with osascript magic.
|
||||||
# Ismo Vuorinen <https://github.com/ivuorinen> 2018
|
# Ismo Vuorinen <https://github.com/ivuorinen> 2018
|
||||||
#
|
#
|
||||||
|
|
||||||
# Enable verbosity with VERBOSE=1
|
|
||||||
VERBOSE="${VERBOSE:-0}"
|
|
||||||
|
|
||||||
# Check if the script is running on macOS
|
# Check if the script is running on macOS
|
||||||
if [ "$(uname)" != "Darwin" ]; then
|
if [ "$(uname)" != "Darwin" ]; then
|
||||||
msgr warn "Not a macOS system"
|
msgr warn "Not a macOS system"
|
||||||
@@ -31,7 +29,7 @@ keep_alive_sudo()
|
|||||||
done 2> /dev/null &
|
done 2> /dev/null &
|
||||||
}
|
}
|
||||||
|
|
||||||
XCODE_TOOLS_PATH=$(xcode-select -p)
|
XCODE_TOOLS_PATH="$(xcode-select -p)"
|
||||||
XCODE_SWIFT_PATH="$XCODE_TOOLS_PATH/usr/bin/swift"
|
XCODE_SWIFT_PATH="$XCODE_TOOLS_PATH/usr/bin/swift"
|
||||||
|
|
||||||
# Function to prompt for XCode CLI Tools installation
|
# Function to prompt for XCode CLI Tools installation
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
# @description Install z
|
# @description Install z
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
|
|||||||
@@ -4,17 +4,8 @@
|
|||||||
# Helper env variables. Use like this: VERBOSE=1 ./script.sh
|
# Helper env variables. Use like this: VERBOSE=1 ./script.sh
|
||||||
: "${VERBOSE:=0}"
|
: "${VERBOSE:=0}"
|
||||||
|
|
||||||
# Set variable that checks if the shared.sh script has been
|
# Source the main shared config if not already loaded
|
||||||
# sourced only once If the script has been sourced more than once,
|
if [ -z "${SHARED_SCRIPTS_SOURCED:-}" ]; then
|
||||||
# the script not be sourced again.
|
|
||||||
[ -z "$SHARED_SCRIPTS_SOURCED" ] && {
|
|
||||||
|
|
||||||
source "${DOTFILES}/config/shared.sh"
|
source "${DOTFILES}/config/shared.sh"
|
||||||
# Warn the user if the shared configuration hasn't been loaded yet
|
|
||||||
msgr warn "(!) shared.sh not sourced"
|
|
||||||
|
|
||||||
# Set variable that checks if the shared.sh script has been
|
|
||||||
# sourced only once.
|
|
||||||
# shellcheck disable=SC2034
|
|
||||||
export SHARED_SCRIPTS_SOURCED=1
|
export SHARED_SCRIPTS_SOURCED=1
|
||||||
}
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user