mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-27 14:54:10 +00:00
chore: shfmt, cleanup
This commit is contained in:
@@ -130,6 +130,6 @@ X_ALIAS_FILES=(
|
|||||||
)
|
)
|
||||||
for aliasFile in "${X_ALIAS_FILES[@]}"; do
|
for aliasFile in "${X_ALIAS_FILES[@]}"; do
|
||||||
# shellcheck source=$HOME/.config/alias-secret
|
# shellcheck source=$HOME/.config/alias-secret
|
||||||
[ -f "$aliasFile" ] && source "$aliasFile" && msg "Sourced $aliasFile"
|
[ -f "$aliasFile" ] && source "$aliasFile" && msgr ok "Sourced $aliasFile"
|
||||||
done
|
done
|
||||||
unset X_ALIAS_FILES
|
unset X_ALIAS_FILES
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ if ! declare -f msg > /dev/null; then
|
|||||||
# $1 - message (string)
|
# $1 - message (string)
|
||||||
msg()
|
msg()
|
||||||
{
|
{
|
||||||
[ "$VERBOSE" -eq 1 ] && echo "$1"
|
[ "$VERBOSE" -eq 1 ] && msgr msg "$1"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
msg "msg was not defined, defined it now"
|
msg "msg was not defined, defined it now"
|
||||||
@@ -54,7 +54,7 @@ if ! declare -f msg_err > /dev/null; then
|
|||||||
# $1 - error message (string)
|
# $1 - error message (string)
|
||||||
msg_err()
|
msg_err()
|
||||||
{
|
{
|
||||||
echo "(!) ERROR: $1" >&2
|
msgr err "$1" >&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
@@ -65,7 +65,7 @@ if ! declare -f msg_done > /dev/null; then
|
|||||||
# $1 - message (string)
|
# $1 - message (string)
|
||||||
msg_done()
|
msg_done()
|
||||||
{
|
{
|
||||||
echo "✓ $1"
|
msgr done "$1"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
@@ -76,7 +76,7 @@ if ! declare -f msg_run > /dev/null; then
|
|||||||
# $1 - message (string)
|
# $1 - message (string)
|
||||||
msg_run()
|
msg_run()
|
||||||
{
|
{
|
||||||
echo "→ $1"
|
msgr run "$1"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
@@ -87,10 +87,29 @@ if ! declare -f msg_ok > /dev/null; then
|
|||||||
# $1 - message (string)
|
# $1 - message (string)
|
||||||
msg_ok()
|
msg_ok()
|
||||||
{
|
{
|
||||||
echo "✓ $1"
|
msgr ok "$1"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! declare -f array_diff > /dev/null; then
|
||||||
|
# Function to compare two arrays and return the difference
|
||||||
|
# Example: array_diff DIFFERENCE ARRAY1 ARRAY2
|
||||||
|
# $1 - variable to store the difference
|
||||||
|
# $2 - first array
|
||||||
|
# $3 - second array
|
||||||
|
# Output to $1 the difference between $2 and $3
|
||||||
|
# Source: https://stackoverflow.com/a/42399479/594940
|
||||||
|
array_diff()
|
||||||
|
{
|
||||||
|
# shellcheck disable=SC1083,SC2086
|
||||||
|
eval local ARR1=\(\"\${$2[@]}\"\)
|
||||||
|
# shellcheck disable=SC1083,SC2086
|
||||||
|
eval local ARR2=\(\"\${$3[@]}\"\)
|
||||||
|
local IFS=$'\n'
|
||||||
|
mapfile -t "$1" < <(comm -23 <(echo "${ARR1[*]}" | sort) <(echo "${ARR2[*]}" | sort))
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
source "$DOTFILES/config/exports"
|
source "$DOTFILES/config/exports"
|
||||||
source "$DOTFILES/config/alias"
|
source "$DOTFILES/config/alias"
|
||||||
|
|||||||
6
install
6
install
@@ -25,9 +25,9 @@ git submodule update --init --recursive "${DOTBOT_DIR}"
|
|||||||
if [ "${DOTBOT_HOST}" != "" ]; then
|
if [ "${DOTBOT_HOST}" != "" ]; then
|
||||||
DOTBOT_HOST_CONFIG="${BASEDIR}/hosts/${DOTBOT_HOST}/${CONFIG}"
|
DOTBOT_HOST_CONFIG="${BASEDIR}/hosts/${DOTBOT_HOST}/${CONFIG}"
|
||||||
echo "-> Trying if host config can be found: ${DOTBOT_HOST_CONFIG}"
|
echo "-> Trying if host config can be found: ${DOTBOT_HOST_CONFIG}"
|
||||||
[ -r "$DOTBOT_HOST_CONFIG" ] && [ -f "$DOTBOT_HOST_CONFIG" ] &&
|
[ -r "$DOTBOT_HOST_CONFIG" ] && [ -f "$DOTBOT_HOST_CONFIG" ] \
|
||||||
echo "(!) Found $DOTBOT_HOST_CONFIG" &&
|
&& echo "(!) Found $DOTBOT_HOST_CONFIG" \
|
||||||
"$DOTBOT_BIN_PATH" \
|
&& "$DOTBOT_BIN_PATH" \
|
||||||
-d "$BASEDIR" \
|
-d "$BASEDIR" \
|
||||||
--plugin-dir=tools/dotbot-asdf \
|
--plugin-dir=tools/dotbot-asdf \
|
||||||
--plugin-dir=tools/dotbot-brew \
|
--plugin-dir=tools/dotbot-brew \
|
||||||
|
|||||||
35
local/bin/a
35
local/bin/a
@@ -19,7 +19,8 @@ for arg in "$@"; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Ensure log directory and file exist with correct permissions
|
# Ensure log directory and file exist with correct permissions
|
||||||
prepare_log_file() {
|
prepare_log_file()
|
||||||
|
{
|
||||||
local log_dir
|
local log_dir
|
||||||
log_dir=$(dirname "$LOG_FILE")
|
log_dir=$(dirname "$LOG_FILE")
|
||||||
|
|
||||||
@@ -40,7 +41,8 @@ prepare_log_file() {
|
|||||||
prepare_log_file
|
prepare_log_file
|
||||||
|
|
||||||
# Logging function
|
# Logging function
|
||||||
log_message() {
|
log_message()
|
||||||
|
{
|
||||||
local message="$1"
|
local message="$1"
|
||||||
echo "$(date +'%Y-%m-%d %H:%M:%S') - $message" >> "$LOG_FILE"
|
echo "$(date +'%Y-%m-%d %H:%M:%S') - $message" >> "$LOG_FILE"
|
||||||
|
|
||||||
@@ -51,8 +53,9 @@ log_message() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Function to print usage
|
# Function to print usage
|
||||||
print_help() {
|
print_help()
|
||||||
cat <<EOF
|
{
|
||||||
|
cat << EOF
|
||||||
Usage: a [command] [file_or_directory] [options]
|
Usage: a [command] [file_or_directory] [options]
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
@@ -88,13 +91,15 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Function to print version
|
# Function to print version
|
||||||
print_version() {
|
print_version()
|
||||||
|
{
|
||||||
echo "a version $VERSION"
|
echo "a version $VERSION"
|
||||||
echo "Created by Ismo Vuorinen <https://github.com/ivuorinen>"
|
echo "Created by Ismo Vuorinen <https://github.com/ivuorinen>"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to fetch keys if missing
|
# Function to fetch keys if missing
|
||||||
fetch_keys_if_missing() {
|
fetch_keys_if_missing()
|
||||||
|
{
|
||||||
if [[ ! -f "$KEYS_FILE" ]]; then
|
if [[ ! -f "$KEYS_FILE" ]]; then
|
||||||
log_message "Keys file '$KEYS_FILE' not found. Attempting to fetch from $KEYS_SOURCE..."
|
log_message "Keys file '$KEYS_FILE' not found. Attempting to fetch from $KEYS_SOURCE..."
|
||||||
mkdir -p "$(dirname "$KEYS_FILE")"
|
mkdir -p "$(dirname "$KEYS_FILE")"
|
||||||
@@ -111,7 +116,8 @@ fetch_keys_if_missing() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Function to encrypt files or directories
|
# Function to encrypt files or directories
|
||||||
encrypt_file_or_directory() {
|
encrypt_file_or_directory()
|
||||||
|
{
|
||||||
local file="$1"
|
local file="$1"
|
||||||
if [[ -d "$file" ]]; then
|
if [[ -d "$file" ]]; then
|
||||||
for f in "$file"/*; do
|
for f in "$file"/*; do
|
||||||
@@ -120,7 +126,7 @@ encrypt_file_or_directory() {
|
|||||||
elif [[ -f "$file" ]]; then
|
elif [[ -f "$file" ]]; then
|
||||||
fetch_keys_if_missing
|
fetch_keys_if_missing
|
||||||
local output_file="${file}.age"
|
local output_file="${file}.age"
|
||||||
age -R "$KEYS_FILE" "$file" >"$output_file"
|
age -R "$KEYS_FILE" "$file" > "$output_file"
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
log_message "File encrypted successfully: $output_file"
|
log_message "File encrypted successfully: $output_file"
|
||||||
else
|
else
|
||||||
@@ -131,7 +137,8 @@ encrypt_file_or_directory() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Function to decrypt files or directories
|
# Function to decrypt files or directories
|
||||||
decrypt_file_or_directory() {
|
decrypt_file_or_directory()
|
||||||
|
{
|
||||||
local file="$1"
|
local file="$1"
|
||||||
if [[ -d "$file" ]]; then
|
if [[ -d "$file" ]]; then
|
||||||
for f in "$file"/*.age; do
|
for f in "$file"/*.age; do
|
||||||
@@ -140,7 +147,7 @@ decrypt_file_or_directory() {
|
|||||||
elif [[ -f "$file" ]]; then
|
elif [[ -f "$file" ]]; then
|
||||||
fetch_keys_if_missing
|
fetch_keys_if_missing
|
||||||
local output_file="${file%.age}"
|
local output_file="${file%.age}"
|
||||||
age -d -i "$KEYS_FILE" "$file" >"$output_file"
|
age -d -i "$KEYS_FILE" "$file" > "$output_file"
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
log_message "File decrypted successfully: $output_file"
|
log_message "File decrypted successfully: $output_file"
|
||||||
else
|
else
|
||||||
@@ -152,7 +159,7 @@ decrypt_file_or_directory() {
|
|||||||
|
|
||||||
# Main logic
|
# Main logic
|
||||||
case "$1" in
|
case "$1" in
|
||||||
e|enc|encrypt)
|
e | enc | encrypt)
|
||||||
if [[ $# -lt 2 ]]; then
|
if [[ $# -lt 2 ]]; then
|
||||||
log_message "Error: No file or directory specified for encryption."
|
log_message "Error: No file or directory specified for encryption."
|
||||||
print_help
|
print_help
|
||||||
@@ -160,7 +167,7 @@ case "$1" in
|
|||||||
fi
|
fi
|
||||||
encrypt_file_or_directory "$2"
|
encrypt_file_or_directory "$2"
|
||||||
;;
|
;;
|
||||||
d|dec|decrypt)
|
d | dec | decrypt)
|
||||||
if [[ $# -lt 2 ]]; then
|
if [[ $# -lt 2 ]]; then
|
||||||
log_message "Error: No file or directory specified for decryption."
|
log_message "Error: No file or directory specified for decryption."
|
||||||
print_help
|
print_help
|
||||||
@@ -168,10 +175,10 @@ case "$1" in
|
|||||||
fi
|
fi
|
||||||
decrypt_file_or_directory "$2"
|
decrypt_file_or_directory "$2"
|
||||||
;;
|
;;
|
||||||
help|--help)
|
help | --help)
|
||||||
print_help
|
print_help
|
||||||
;;
|
;;
|
||||||
version|--version)
|
version | --version)
|
||||||
print_version
|
print_version
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ KEYS_FILE="${AGE_KEYSFILE:-$HOME/.ssh/keys.txt}"
|
|||||||
KEYS_SOURCE="${AGE_KEYSSOURCE:-https://github.com/ivuorinen.keys}"
|
KEYS_SOURCE="${AGE_KEYSSOURCE:-https://github.com/ivuorinen.keys}"
|
||||||
|
|
||||||
# Check for required commands
|
# Check for required commands
|
||||||
if ! command -v age &>/dev/null; then
|
if ! command -v age &> /dev/null; then
|
||||||
echo "Error: age is not installed. Please install it to continue."
|
echo "Error: age is not installed. Please install it to continue."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v curl &>/dev/null; then
|
if ! command -v curl &> /dev/null; then
|
||||||
echo "Error: curl is not installed. Please install it to continue."
|
echo "Error: curl is not installed. Please install it to continue."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -28,7 +28,6 @@ if [[ ! -f "$FILE" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Check if keys file exists, otherwise fetch it
|
# Check if keys file exists, otherwise fetch it
|
||||||
if [[ ! -f "$KEYS_FILE" ]]; then
|
if [[ ! -f "$KEYS_FILE" ]]; then
|
||||||
echo "Keys file '$KEYS_FILE' not found. Attempting to fetch from $KEYS_SOURCE..."
|
echo "Keys file '$KEYS_FILE' not found. Attempting to fetch from $KEYS_SOURCE..."
|
||||||
@@ -51,7 +50,7 @@ fi
|
|||||||
|
|
||||||
# Decrypt the file
|
# Decrypt the file
|
||||||
OUTPUT_FILE="${FILE%.age}"
|
OUTPUT_FILE="${FILE%.age}"
|
||||||
age -d -i "$KEYS_FILE" "$FILE" >"$OUTPUT_FILE"
|
age -d -i "$KEYS_FILE" "$FILE" > "$OUTPUT_FILE"
|
||||||
|
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
echo "File decrypted successfully: $OUTPUT_FILE"
|
echo "File decrypted successfully: $OUTPUT_FILE"
|
||||||
@@ -59,4 +58,3 @@ else
|
|||||||
echo "Error: Failed to decrypt file."
|
echo "Error: Failed to decrypt file."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -6,17 +6,18 @@ KEYS_FILE="${AGE_KEYSFILE:-$HOME/.ssh/keys.txt}"
|
|||||||
KEYS_SOURCE="${AGE_KEYSSOURCE:-https://github.com/ivuorinen.keys}"
|
KEYS_SOURCE="${AGE_KEYSSOURCE:-https://github.com/ivuorinen.keys}"
|
||||||
|
|
||||||
# Check for required commands
|
# Check for required commands
|
||||||
if ! command -v age &>/dev/null; then
|
if ! command -v age &> /dev/null; then
|
||||||
echo "Error: age is not installed. Please install it to continue."
|
echo "Error: age is not installed. Please install it to continue."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v curl &>/dev/null; then
|
if ! command -v curl &> /dev/null; then
|
||||||
echo "Error: curl is not installed. Please install it to continue."
|
echo "Error: curl is not installed. Please install it to continue."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure a file is provided
|
# Ensure a file is provided
|
||||||
|
# shellcheck disable=SC2181
|
||||||
if [[ $# -lt 1 ]]; then
|
if [[ $# -lt 1 ]]; then
|
||||||
echo "Usage: $0 <file-to-encrypt>"
|
echo "Usage: $0 <file-to-encrypt>"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -50,7 +51,7 @@ fi
|
|||||||
|
|
||||||
# Encrypt the file
|
# Encrypt the file
|
||||||
OUTPUT_FILE="${FILE}.age"
|
OUTPUT_FILE="${FILE}.age"
|
||||||
age -R "$KEYS_FILE" "$FILE" >"$OUTPUT_FILE"
|
age -R "$KEYS_FILE" "$FILE" > "$OUTPUT_FILE"
|
||||||
|
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
echo "File encrypted successfully: $OUTPUT_FILE"
|
echo "File encrypted successfully: $OUTPUT_FILE"
|
||||||
|
|||||||
392
local/bin/dfm
392
local/bin/dfm
@@ -14,62 +14,8 @@
|
|||||||
|
|
||||||
SCRIPT=$(basename "$0")
|
SCRIPT=$(basename "$0")
|
||||||
|
|
||||||
if ! declare -f msg > /dev/null; then
|
|
||||||
# Function to print messages if VERBOSE is enabled
|
|
||||||
# $1 - message (string)
|
|
||||||
msg()
|
|
||||||
{
|
|
||||||
[ "$VERBOSE" -eq 1 ] && echo "$1"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! declare -f msg_err > /dev/null; then
|
|
||||||
# Function to print error messages and exit
|
|
||||||
# $1 - error message (string)
|
|
||||||
msg_err()
|
|
||||||
{
|
|
||||||
# shellcheck disable=SC2317
|
|
||||||
echo "(!) ERROR: $1" >&2
|
|
||||||
# shellcheck disable=SC2317
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! declare -f msg_done > /dev/null; then
|
|
||||||
# Function to print done message
|
|
||||||
# $1 - message (string)
|
|
||||||
msg_done()
|
|
||||||
{
|
|
||||||
# shellcheck disable=SC2317
|
|
||||||
echo "✓ $1"
|
|
||||||
# shellcheck disable=SC2317
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! declare -f array_diff > /dev/null; then
|
|
||||||
# Function to compare two arrays and return the difference
|
|
||||||
# Example: array_diff DIFFERENCE ARRAY1 ARRAY2
|
|
||||||
# $1 - variable to store the difference
|
|
||||||
# $2 - first array
|
|
||||||
# $3 - second array
|
|
||||||
# Output to $1 the difference between $2 and $3
|
|
||||||
# Source: https://stackoverflow.com/a/42399479/594940
|
|
||||||
array_diff()
|
|
||||||
{
|
|
||||||
# shellcheck disable=SC1083,SC2086
|
|
||||||
eval local ARR1=\(\"\${$2[@]}\"\)
|
|
||||||
# shellcheck disable=SC1083,SC2086
|
|
||||||
eval local ARR2=\(\"\${$3[@]}\"\)
|
|
||||||
local IFS=$'\n'
|
|
||||||
mapfile -t "$1" < <(comm -23 <(echo "${ARR1[*]}" | sort) <(echo "${ARR2[*]}" | sort))
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Loads configs for better installation experience
|
# Loads configs for better installation experience
|
||||||
source "$DOTFILES/config/shared.sh"
|
source "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
source "${DOTFILES}/local/bin/msgr"
|
source "${DOTFILES}/local/bin/msgr"
|
||||||
|
|
||||||
# -- Menu builder -- #
|
# -- Menu builder -- #
|
||||||
@@ -153,15 +99,15 @@ section_install()
|
|||||||
"gh:Install GitHub CLI Extensions"
|
"gh:Install GitHub CLI Extensions"
|
||||||
"go:Install Go Packages"
|
"go:Install Go Packages"
|
||||||
"imagick:Install ImageMagick CLI"
|
"imagick:Install ImageMagick CLI"
|
||||||
"starship:Install starship.rs"
|
|
||||||
"macos:Setup nice macOS defaults"
|
"macos:Setup nice macOS defaults"
|
||||||
"neofetch:Install neofetch"
|
"neofetch:Install neofetch"
|
||||||
"nvm:Install Node Version Manager (nvm)"
|
|
||||||
"nvm-latest:Install latest lts node using nvm"
|
|
||||||
"npm:Install NPM Packages"
|
"npm:Install NPM Packages"
|
||||||
"ntfy:Install ntfy"
|
"ntfy:Install ntfy"
|
||||||
|
"nvm-latest:Install latest lts node using nvm"
|
||||||
|
"nvm:Install Node Version Manager (nvm)"
|
||||||
"ohmybash:Install oh-my-bash"
|
"ohmybash:Install oh-my-bash"
|
||||||
"pip:Install pip/python packages"
|
"pip:Install pip/python packages"
|
||||||
|
"starship:Install starship.rs"
|
||||||
"z:Install z"
|
"z:Install z"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -171,124 +117,117 @@ section_install()
|
|||||||
$0 install macos
|
$0 install macos
|
||||||
$0 install fonts
|
$0 install fonts
|
||||||
$0 brew install
|
$0 brew install
|
||||||
#$0 install ohmyposh
|
|
||||||
$0 install asdf
|
$0 install asdf
|
||||||
$0 install composer
|
$0 install composer
|
||||||
$0 install fzf
|
$0 install fzf
|
||||||
#$0 install go
|
|
||||||
$0 install cheat-databases
|
$0 install cheat-databases
|
||||||
#$0 install imagick
|
|
||||||
$0 install nvm
|
$0 install nvm
|
||||||
$0 install npm
|
$0 install npm-packages
|
||||||
# $0 install ntfy
|
|
||||||
$0 install z
|
$0 install z
|
||||||
msgr msg "Reloading configurations again..."
|
msgr msg "Reloading configurations again..."
|
||||||
source "$DOTFILES/config/shared.sh"
|
source "$DOTFILES/config/shared.sh"
|
||||||
msgr yay "All done!"
|
msgr yay "All done!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
asdf)
|
asdf)
|
||||||
msg "Installing asdf..."
|
msgr run "Installing asdf..."
|
||||||
$0 asdf plugins-add \
|
$0 asdf plugins-add \
|
||||||
&& msg_yay "asdf installed!"
|
&& msgr yay "asdf plugins installed!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
cargo)
|
cargo)
|
||||||
msg "Installing cargo packages..."
|
msgr run "Installing cargo packages..."
|
||||||
bash "$DOTFILES/scripts/install-cargo-packages.sh" \
|
bash "$DOTFILES/scripts/install-cargo-packages.sh" \
|
||||||
&& msg_yay "cargo packages installed!"
|
&& msgr yay "cargo packages installed!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
cheat-databases)
|
cheat-databases)
|
||||||
msg "Installing cheat databases..."
|
msgr run "Installing cheat databases..."
|
||||||
for database in "$DOTFILES"/scripts/install-cheat-*; do
|
for database in "$DOTFILES"/scripts/install-cheat-*; do
|
||||||
bash "$database" \
|
bash "$database" \
|
||||||
&& msg_yay "Cheat: $database run"
|
&& msgr run_done "Cheat: $database run"
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
composer)
|
composer)
|
||||||
msg "Installing composer..."
|
msgr run "Installing composer..."
|
||||||
bash "$DOTFILES/scripts/install-composer.sh" \
|
bash "$DOTFILES/scripts/install-composer.sh" \
|
||||||
&& msg_yay "composer installed!"
|
&& msgr run_done "composer installed!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
fonts)
|
fonts)
|
||||||
msg "Installing fonts..."
|
msgr run "Installing fonts..."
|
||||||
bash "$DOTFILES/scripts/install-fonts.sh" \
|
bash "$DOTFILES/scripts/install-fonts.sh" \
|
||||||
&& msg_yay "Installed fonts!"
|
&& msgr yay "Installed fonts!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
fzf)
|
fzf)
|
||||||
msg "Installing fzf..."
|
msgr run "Installing fzf..."
|
||||||
bash "$DOTFILES/scripts/install-fzf.sh" \
|
bash "$DOTFILES/scripts/install-fzf.sh" \
|
||||||
&& msg_yay "fzf installed!"
|
&& msgr yay "fzf installed!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
gh)
|
gh)
|
||||||
msg "Installing GitHub CLI Extensions..."
|
msgr run "Installing GitHub CLI Extensions..."
|
||||||
bash "$DOTFILES/scripts/install-gh-extensions.sh" \
|
bash "$DOTFILES/scripts/install-gh-extensions.sh" \
|
||||||
&& msg_yay "github cli extensions installed!"
|
&& msgr yay "github cli extensions installed!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
go)
|
go)
|
||||||
msg "Installing Go Packages..."
|
msgr run "Installing Go Packages..."
|
||||||
bash "$DOTFILES/scripts/install-go-packages.sh" \
|
bash "$DOTFILES/scripts/install-go-packages.sh" \
|
||||||
&& msg_yay "go packages installed!"
|
&& msgr yay "go packages installed!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
imagick)
|
imagick)
|
||||||
msg "Installing ImageMagick CLI..."
|
msgr run "Downloading and installing ImageMagick CLI..."
|
||||||
curl -L https://imagemagick.org/archive/binaries/magick > "$XDG_BIN_HOME/magick" \
|
curl -L https://imagemagick.org/archive/binaries/magick > "$XDG_BIN_HOME/magick" \
|
||||||
&& chmod +x "$XDG_BIN_HOME/magick" \
|
&& chmod +x "$XDG_BIN_HOME/magick" \
|
||||||
&& msg_yay "imagick installed!"
|
&& msgr yay "imagick downloaded and installed!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
macos)
|
macos)
|
||||||
msg "Setting up macOS defaults..."
|
msgr run "Setting up macOS defaults..."
|
||||||
bash "$DOTFILES/scripts/set-macos-defaults.sh" \
|
bash "$DOTFILES/scripts/install-macos-defaults.sh" \
|
||||||
&& msg_yay "Brewfile defined apps has been installed!"
|
&& msgr yay "macOS defaults set!"
|
||||||
;;
|
|
||||||
neofetch)
|
|
||||||
msg "Installing neofetch..."
|
|
||||||
bash "$DOTFILES/scripts/install-neofetch.sh" \
|
|
||||||
&& msg_yay "neofetch installed!"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
nvm)
|
nvm)
|
||||||
msg "Installing nvm..."
|
msgr run "Installing nvm..."
|
||||||
|
local NVM_VERSION
|
||||||
NVM_VERSION=$(x-gh-get-latest-version nvm-sh/nvm)
|
NVM_VERSION=$(x-gh-get-latest-version nvm-sh/nvm)
|
||||||
msg "Latest nvm version: $NVM_VERSION"
|
msgr ok "Latest nvm version: $NVM_VERSION"
|
||||||
NVM_INSTALL="https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh"
|
local NVM_INSTALL="https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh"
|
||||||
NVM_CURL="curl -o- \"$NVM_INSTALL\" | bash"
|
local NVM_CURL="curl -o- \"$NVM_INSTALL\" | bash"
|
||||||
PROFILE=/dev/null bash -c "$NVM_CURL"
|
PROFILE=/dev/null bash -c "$NVM_CURL"
|
||||||
$0 install nvm-latest
|
$0 install nvm-latest
|
||||||
msg_yay "nvm installed!"
|
msgr yay "nvm installed!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
nvm-latest)
|
nvm-latest)
|
||||||
msg "Installing latest lts node..."
|
msgr run "Installing latest lts node..."
|
||||||
if [ -n "$NVM_DIR" ]; then
|
if [ -n "$NVM_DIR" ]; then
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||||
fi
|
fi
|
||||||
nvm install --lts --latest-npm --default
|
nvm install --lts --latest-npm --default
|
||||||
git checkout "$DOTFILES/base/zshrc"
|
git checkout "$DOTFILES/base/zshrc"
|
||||||
git checkout "$DOTFILES/base/bashrc"
|
git checkout "$DOTFILES/base/bashrc"
|
||||||
msg_yay "latest lts node installed!"
|
msgr yay "latest lts node installed!"
|
||||||
;;
|
;;
|
||||||
npm)
|
|
||||||
msg "NPM Packages install started..."
|
npm-packages)
|
||||||
|
msgr run "NPM Packages install started..."
|
||||||
bash "$DOTFILES/scripts/install-npm-packages.sh" \
|
bash "$DOTFILES/scripts/install-npm-packages.sh" \
|
||||||
&& msg_yay "NPM Packages have been installed!"
|
&& msgr yay "NPM Packages have been installed!"
|
||||||
;;
|
|
||||||
ntfy)
|
|
||||||
msg "ntfy install started..."
|
|
||||||
bash "$DOTFILES/scripts/install-ntfy.sh" \
|
|
||||||
&& msg_yay "ntfy installed!"
|
|
||||||
;;
|
|
||||||
ohmyposh)
|
|
||||||
msg "oh-my-posh install started..."
|
|
||||||
bash "$DOTFILES/scripts/install-ohmyposh.sh" \
|
|
||||||
&& msg_yay "oh-my-posh installed!"
|
|
||||||
;;
|
|
||||||
pip)
|
|
||||||
msg "pip install started..."
|
|
||||||
bash "$DOTFILES/scripts/install-pip-packages.sh"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
z)
|
z)
|
||||||
msg "Installing z..."
|
msgr run "Installing z..."
|
||||||
bash "$DOTFILES/scripts/install-z.sh" \
|
bash "$DOTFILES/scripts/install-z.sh" \
|
||||||
&& msg_yay "z has been installed!"
|
&& msgr yay "z has been installed!"
|
||||||
;;
|
;;
|
||||||
*) menu_usage "$USAGE_PREFIX" "${MENU[@]}" ;;
|
|
||||||
|
*) menu_builder "$USAGE_PREFIX" "${MENU[@]}" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,12 +248,14 @@ section_brew()
|
|||||||
x-have brew && {
|
x-have brew && {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
install)
|
install)
|
||||||
brew bundle install --file="$BREWFILE" --force --quiet && msg_yay "Done!"
|
brew bundle install --file="$BREWFILE" --force --quiet && msgr yay "Done!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
update)
|
update)
|
||||||
brew update && brew outdated && brew upgrade && brew cleanup
|
brew update && brew outdated && brew upgrade && brew cleanup
|
||||||
msg_yay "Done!"
|
msgr yay "Done!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
updatebundle)
|
updatebundle)
|
||||||
# Updates .dotfiles/homebrew/Brewfile with descriptions
|
# Updates .dotfiles/homebrew/Brewfile with descriptions
|
||||||
brew bundle dump \
|
brew bundle dump \
|
||||||
@@ -324,11 +265,13 @@ section_brew()
|
|||||||
--tap \
|
--tap \
|
||||||
--formula \
|
--formula \
|
||||||
--cask \
|
--cask \
|
||||||
--describe && msg_yay "Done!"
|
--describe && msgr yay "Done!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
leaves)
|
leaves)
|
||||||
brew leaves --installed-on-request
|
brew leaves --installed-on-request
|
||||||
;;
|
;;
|
||||||
|
|
||||||
untracked)
|
untracked)
|
||||||
declare -a BREW_LIST_ALL
|
declare -a BREW_LIST_ALL
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
@@ -361,7 +304,7 @@ section_brew()
|
|||||||
|
|
||||||
# If there are no untracked packages, exit
|
# If there are no untracked packages, exit
|
||||||
if [ ${#BREW_LIST_UNTRACKED[@]} -eq 0 ]; then
|
if [ ${#BREW_LIST_UNTRACKED[@]} -eq 0 ]; then
|
||||||
msg_yay "No untracked packages found!"
|
msgr yay "No untracked packages found!"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -370,20 +313,19 @@ section_brew()
|
|||||||
echo " $f"
|
echo " $f"
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
clean)
|
|
||||||
brew bundle cleanup --file="$BREWFILE" && msg_yay "Done!"
|
|
||||||
;;
|
|
||||||
autoupdate)
|
autoupdate)
|
||||||
brew autoupdate delete
|
brew autoupdate delete
|
||||||
brew autoupdate start 43200 --upgrade --cleanup --immediate
|
brew autoupdate start 43200 --upgrade --cleanup --immediate
|
||||||
;;
|
;;
|
||||||
*)
|
|
||||||
menu_usage "$USAGE_PREFIX" "${MENU[@]}"
|
clean) brew bundle cleanup --file="$BREWFILE" && msgr yay "Done!" ;;
|
||||||
;;
|
|
||||||
|
*) menu_builder "$USAGE_PREFIX" "${MENU[@]}" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
! x-have brew && menu_section "$USAGE_PREFIX" "brew not available on this system"
|
! x-have brew && menu_builder "$USAGE_PREFIX" "brew not available on this system"
|
||||||
}
|
}
|
||||||
|
|
||||||
section_asdf()
|
section_asdf()
|
||||||
@@ -431,13 +373,13 @@ section_asdf()
|
|||||||
|
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
# Ohita tyhjät rivit ja kommentit
|
# Ohita tyhjät rivit ja kommentit
|
||||||
[[ -z "$line" || "$line" =~ ^# ]] && continue
|
[[ -z $line || $line =~ ^# ]] && continue
|
||||||
|
|
||||||
local plugin
|
local plugin
|
||||||
plugin=$(echo "$line" | awk '{print $1}')
|
plugin=$(echo "$line" | awk '{print $1}')
|
||||||
|
|
||||||
# Ohita direnv, käsiteltiin jo
|
# Ohita direnv, käsiteltiin jo
|
||||||
[[ "$plugin" == "direnv" ]] && continue
|
[[ $plugin == "direnv" ]] && continue
|
||||||
|
|
||||||
if ! echo "$installed_plugins" | grep -q "^${plugin}$"; then
|
if ! echo "$installed_plugins" | grep -q "^${plugin}$"; then
|
||||||
msgr nested "Installing $plugin plugin"
|
msgr nested "Installing $plugin plugin"
|
||||||
@@ -476,30 +418,30 @@ section_asdf()
|
|||||||
|
|
||||||
msgr run "Fixing tool-versions file"
|
msgr run "Fixing tool-versions file"
|
||||||
|
|
||||||
# Tarkista että tiedosto on olemassa
|
# Check that .tool-versions file exists
|
||||||
if [[ ! -f "$tool_versions_file" ]]; then
|
if [[ ! -f $tool_versions_file ]]; then
|
||||||
msgr error "tool-versions file not found: $tool_versions_file"
|
msgr error "tool-versions file not found: $tool_versions_file"
|
||||||
rm -f "$temp_file"
|
rm -f "$temp_file"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Tarkista että asdf on asennettu
|
# Check that asdf can be found in the path
|
||||||
if ! command -v asdf > /dev/null; then
|
if ! command -v asdf > /dev/null; then
|
||||||
msgr error "asdf not found"
|
msgr error "asdf not found"
|
||||||
rm -f "$temp_file"
|
rm -f "$temp_file"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Lue asennetut pluginit
|
# Read installed plugins
|
||||||
msgr nested "Reading installed plugins"
|
msgr nested "Reading installed plugins"
|
||||||
local installed_plugins
|
local installed_plugins
|
||||||
installed_plugins=$(asdf plugin list | sort)
|
installed_plugins=$(asdf plugin list | sort)
|
||||||
|
|
||||||
# Käy läpi tool-versions tiedosto ja säilytä vain asennetut pluginit
|
# Compare .tool-versions and installed plugins, remove unknown plugins from .tool-versions
|
||||||
msgr nested "Updating tool-versions file"
|
msgr nested "Updating tool-versions file"
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
# Säilytä kommentit ja tyhjät rivit
|
# Säilytä kommentit ja tyhjät rivit
|
||||||
if [[ -z "$line" || "$line" =~ ^[[:space:]]*# ]]; then
|
if [[ -z $line || $line =~ ^[[:space:]]*# ]]; then
|
||||||
echo "$line" >> "$temp_file"
|
echo "$line" >> "$temp_file"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@@ -514,17 +456,17 @@ section_asdf()
|
|||||||
fi
|
fi
|
||||||
done < "$tool_versions_file"
|
done < "$tool_versions_file"
|
||||||
|
|
||||||
# Tarkista että temp-tiedosto ei ole tyhjä tai sisällä vain kommentteja
|
# Check that the temp file is valid
|
||||||
if [[ ! -s "$temp_file" ]] || ! grep -v '^[[:space:]]*#' "$temp_file" | grep -q .; then
|
if [[ ! -s $temp_file ]] || ! grep -v '^[[:space:]]*#' "$temp_file" | grep -q .; then
|
||||||
msgr error "Generated file is empty or contains only comments, keeping original"
|
msgr error "Generated file is empty or contains only comments, keeping original"
|
||||||
rm -f "$temp_file"
|
rm -f "$temp_file"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Varmuuskopioi alkuperäinen
|
# Backup the original .tool-versions
|
||||||
cp "$tool_versions_file" "${tool_versions_file}.bak"
|
cp "$tool_versions_file" "${tool_versions_file}.bak"
|
||||||
|
|
||||||
# Siirrä uusi versio paikalleen
|
# Overwrite .tool-versions with the generated file
|
||||||
mv "$temp_file" "$tool_versions_file"
|
mv "$temp_file" "$tool_versions_file"
|
||||||
|
|
||||||
msgr run_done "Updated $tool_versions_file"
|
msgr run_done "Updated $tool_versions_file"
|
||||||
@@ -533,30 +475,12 @@ section_asdf()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
current)
|
current) asdf current ;;
|
||||||
asdf current
|
global) asdf global ;;
|
||||||
;;
|
installed) asdf list ;;
|
||||||
|
versions) asdf list all ;;
|
||||||
global)
|
where) asdf where ;;
|
||||||
asdf global
|
which) asdf which ;;
|
||||||
;;
|
|
||||||
|
|
||||||
installed)
|
|
||||||
asdf list
|
|
||||||
;;
|
|
||||||
|
|
||||||
versions)
|
|
||||||
asdf list all
|
|
||||||
;;
|
|
||||||
|
|
||||||
where)
|
|
||||||
asdf where
|
|
||||||
;;
|
|
||||||
|
|
||||||
which)
|
|
||||||
asdf which
|
|
||||||
;;
|
|
||||||
|
|
||||||
*) menu_builder "$USAGE_PREFIX" "${MENU[@]}" ;;
|
*) menu_builder "$USAGE_PREFIX" "${MENU[@]}" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
@@ -586,6 +510,7 @@ section_helpers()
|
|||||||
# shellcheck disable=2001
|
# shellcheck disable=2001
|
||||||
for i in $(echo "$PATH" | sed 's/:/ /g'); do echo "$i"; done
|
for i in $(echo "$PATH" | sed 's/:/ /g'); do echo "$i"; done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
aliases)
|
aliases)
|
||||||
case "$SECTION" in
|
case "$SECTION" in
|
||||||
"zsh")
|
"zsh")
|
||||||
@@ -599,6 +524,7 @@ section_helpers()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"colors")
|
"colors")
|
||||||
max=255
|
max=255
|
||||||
start=0
|
start=0
|
||||||
@@ -622,24 +548,14 @@ section_helpers()
|
|||||||
printf "\n"
|
printf "\n"
|
||||||
start=$((start + 10))
|
start=$((start + 10))
|
||||||
done
|
done
|
||||||
|
;;
|
||||||
|
|
||||||
;;
|
"env") env | sort ;;
|
||||||
"env")
|
"functions") declare -F ;;
|
||||||
env | sort
|
"nvim") cat "$DOTFILES/docs/nvim-keybindings.md" ;;
|
||||||
;;
|
"tmux") cat "$DOTFILES/docs/tmux-keybindings.md" ;;
|
||||||
"functions")
|
"wezterm") cat "$DOTFILES/docs/wezterm-keybindings.md" ;;
|
||||||
declare -F
|
*) menu_builder "$USAGE_PREFIX" "${MENU[@]}" ;;
|
||||||
;;
|
|
||||||
"nvim")
|
|
||||||
cat "$DOTFILES/docs/nvim-keybindings.md"
|
|
||||||
;;
|
|
||||||
"tmux")
|
|
||||||
cat "$DOTFILES/docs/tmux-keybindings.md"
|
|
||||||
;;
|
|
||||||
"wezterm")
|
|
||||||
cat "$DOTFILES/docs/wezterm-keybindings.md"
|
|
||||||
;;
|
|
||||||
*) menu_usage "$USAGE_PREFIX" "${MENU[@]}" ;;
|
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -663,7 +579,7 @@ section_docs()
|
|||||||
tmux) bash "$DOTFILES/local/bin/x-dfm-docs-xterm-keybindings" ;;
|
tmux) bash "$DOTFILES/local/bin/x-dfm-docs-xterm-keybindings" ;;
|
||||||
nvim) bash "$DOTFILES/scripts/create-nvim-keymaps.sh" ;;
|
nvim) bash "$DOTFILES/scripts/create-nvim-keymaps.sh" ;;
|
||||||
wezterm) bash "$DOTFILES/scripts/create-wezterm-keymaps.sh" ;;
|
wezterm) bash "$DOTFILES/scripts/create-wezterm-keymaps.sh" ;;
|
||||||
*) menu_usage "$USAGE_PREFIX" "${MENU[@]}" ;;
|
*) menu_builder "$USAGE_PREFIX" "${MENU[@]}" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -681,37 +597,42 @@ section_dotfiles()
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
fmt)
|
fmt)
|
||||||
msg_ok "Running all formatters"
|
msgr run "Running all formatters"
|
||||||
$0 dotfiles yamlfmt
|
$0 dotfiles yamlfmt
|
||||||
$0 dotfiles shfmt
|
$0 dotfiles shfmt
|
||||||
msg_done "...done!"
|
msgr run_done "...done!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
reset_all)
|
reset_all)
|
||||||
msg_ok "Running all reset commands"
|
msgr ok "Running all reset commands"
|
||||||
$0 dotfiles reset_nvim
|
$0 dotfiles reset_nvim
|
||||||
;;
|
;;
|
||||||
|
|
||||||
reset_nvim)
|
reset_nvim)
|
||||||
|
msgr run "Cleaning nvim state, cache and config"
|
||||||
rm -rf \
|
rm -rf \
|
||||||
~/.local/share/nvim \
|
~/.local/share/nvim \
|
||||||
~/.local/state/nvim \
|
~/.local/state/nvim \
|
||||||
~/.cache/nvim \
|
~/.cache/nvim \
|
||||||
~/.config/nvim
|
~/.config/nvim
|
||||||
msg_ok "Deleted old nvim files (share, state and cache + config)"
|
msgr ok "Deleted old nvim files (share, state and cache + config)"
|
||||||
ln -s "$DOTFILES/config/nvim" ~/.config/nvim
|
ln -s "$DOTFILES/config/nvim" ~/.config/nvim
|
||||||
msg_ok "Linked nvim and astronvim"
|
msgr ok "Linked nvim and astronvim"
|
||||||
x-have npm && $0 install npm
|
x-have npm && $0 install npm
|
||||||
msg_ok "Installed packages"
|
msgr ok "Installed packages"
|
||||||
msg_done "nvim reset!"
|
msgr run_done "nvim reset!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
yamlfmt)
|
yamlfmt)
|
||||||
# format yaml files
|
# format yaml files
|
||||||
x-have yamlfmt && yamlfmt -conf "$DOTFILES/.yamlfmt"
|
x-have yamlfmt && yamlfmt -conf "$DOTFILES/.yamlfmt"
|
||||||
! x-have yamlfmt && msg_err "yamlfmt not found"
|
! x-have yamlfmt && msgr err "yamlfmt not found"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
shfmt)
|
shfmt)
|
||||||
# If system doesn't have fd or shfmt installed, exit
|
# If system doesn't have fd or shfmt installed, exit
|
||||||
! x-have fd && msg_err "fd not found, install with asdf"
|
! x-have fd && msgr err "fd not found, install it to continue"
|
||||||
! x-have shfmt && msg_err "shfmt not found, install with asdf"
|
! x-have shfmt && msgr err "shfmt not found, install it to continue"
|
||||||
# Format shell scripts according to following rules.
|
# Format shell scripts according to following rules.
|
||||||
fd --full-path "$DOTFILES" -tx \
|
fd --full-path "$DOTFILES" -tx \
|
||||||
--hidden \
|
--hidden \
|
||||||
@@ -722,9 +643,10 @@ section_dotfiles()
|
|||||||
--func-next-line --list --write \
|
--func-next-line --list --write \
|
||||||
--indent 2 --case-indent --space-redirects \
|
--indent 2 --case-indent --space-redirects \
|
||||||
--binary-next-line {} \;
|
--binary-next-line {} \;
|
||||||
msg_yay "dotfiles have been shfmt formatted!"
|
msgr yay "dotfiles have been shfmt formatted!"
|
||||||
;;
|
;;
|
||||||
*) menu_usage "$USAGE_PREFIX" "${MENU[@]}" ;;
|
|
||||||
|
*) menu_builder "$USAGE_PREFIX" "${MENU[@]}" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -744,11 +666,58 @@ section_check()
|
|||||||
[[ $2 == "" ]] && echo "$X_ARCH" && exit 0
|
[[ $2 == "" ]] && echo "$X_ARCH" && exit 0
|
||||||
[[ $X_ARCH == "$2" ]] && exit 0 || exit 1
|
[[ $X_ARCH == "$2" ]] && exit 0 || exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
h | host | hostname)
|
h | host | hostname)
|
||||||
[[ $2 == "" ]] && echo "$X_HOSTNAME" && exit 0
|
[[ $2 == "" ]] && echo "$X_HOSTNAME" && exit 0
|
||||||
[[ $X_HOSTNAME == "$2" ]] && exit 0 || exit 1
|
[[ $X_HOSTNAME == "$2" ]] && exit 0 || exit 1
|
||||||
;;
|
;;
|
||||||
*) menu_usage "$USAGE_PREFIX" "${MENU[@]}" ;;
|
|
||||||
|
*) menu_builder "$USAGE_PREFIX" "${MENU[@]}" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
section_scripts()
|
||||||
|
{
|
||||||
|
USAGE_PREFIX="$SCRIPT scripts <command>"
|
||||||
|
|
||||||
|
# Get description from a file
|
||||||
|
get_script_description()
|
||||||
|
{
|
||||||
|
local file
|
||||||
|
local desc
|
||||||
|
file="$1"
|
||||||
|
desc=$(sed -n '/@description/s/.*@description *\(.*\)/\1/p' "$file" | head -1)
|
||||||
|
echo "${desc:-No description available}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Collect scripts and their descriptions
|
||||||
|
declare -A SCRIPT_MENU
|
||||||
|
for script in "$DOTFILES/scripts/install-"*.sh; do
|
||||||
|
if [ -f "$script" ]; then
|
||||||
|
name=$(basename "$script" .sh | sed 's/install-//')
|
||||||
|
desc=$(get_script_description "$script")
|
||||||
|
SCRIPT_MENU[$name]="$desc"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
"")
|
||||||
|
# Show the menu
|
||||||
|
local menu_items=()
|
||||||
|
for name in "${!SCRIPT_MENU[@]}"; do
|
||||||
|
menu_items+=("$name:${SCRIPT_MENU[$name]}")
|
||||||
|
done
|
||||||
|
menu_builder "$USAGE_PREFIX" "${menu_items[@]}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Run the chosen script
|
||||||
|
script_path="$DOTFILES/scripts/install-$1.sh"
|
||||||
|
if [ -f "$script_path" ]; then
|
||||||
|
bash "$script_path"
|
||||||
|
else
|
||||||
|
msgr err "Script not found: $1"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -758,7 +727,7 @@ section_tests()
|
|||||||
USAGE_PREFIX="$SCRIPT tests <command>"
|
USAGE_PREFIX="$SCRIPT tests <command>"
|
||||||
|
|
||||||
MENU=(
|
MENU=(
|
||||||
"msg:List all log functions from shared.sh"
|
"msgr:List all available msgr message types"
|
||||||
"params:List all parameters"
|
"params:List all parameters"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -770,29 +739,29 @@ section_tests()
|
|||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
msg)
|
msg)
|
||||||
msg "msg"
|
# shellcheck disable=SC1010
|
||||||
msg_done "msg_done"
|
msgr done "msgr done"
|
||||||
msg_done_suffix "msg_done_suffix"
|
msgr done_suffix "msgr done_suffix"
|
||||||
msg_err "msg_err"
|
msgr err "msgr err"
|
||||||
msg_nested "msg_nested"
|
msgr nested "msgr nested"
|
||||||
msg_nested_done "msg_nested_done"
|
msgr nested_done "msgr nested_done"
|
||||||
msg_ok "msg_ok"
|
msgr ok "msgr ok"
|
||||||
msg_prompt "msg_prompt"
|
msgr prompt "msgr prompt"
|
||||||
msg_prompt_done "msg_prompt_done"
|
msgr prompt_done "msgr prompt_done"
|
||||||
msg_run "msg_run" "second_param"
|
msgr run "msgr run" "second_param"
|
||||||
msg_run_done "msg_run_done" "second_param"
|
msgr run_done "msgr run_done" "second_param"
|
||||||
msg_warn "msg_warn"
|
msgr warn "msgr warn"
|
||||||
msg_yay "msg_yay"
|
msgr yay "msgr yay"
|
||||||
msg_yay_done "msg_yay_done"
|
msgr yay_done "msgr yay_done"
|
||||||
;;
|
;;
|
||||||
*) menu_usage "$USAGE_PREFIX" "${MENU[@]}" ;;
|
*) menu_builder "$USAGE_PREFIX" "${MENU[@]}" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
echo ""
|
echo ""
|
||||||
msg_prompt "Usage: $SCRIPT <section> <command>"
|
msgr prompt "Usage: $SCRIPT <section> <command>"
|
||||||
echo $" Empty <command> prints <section> help."
|
echo $" Empty <command> prints <section> help."
|
||||||
echo ""
|
echo ""
|
||||||
section_install
|
section_install
|
||||||
@@ -807,6 +776,8 @@ usage()
|
|||||||
echo ""
|
echo ""
|
||||||
section_docs
|
section_docs
|
||||||
echo ""
|
echo ""
|
||||||
|
section_scripts
|
||||||
|
echo ""
|
||||||
section_helpers
|
section_helpers
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -823,6 +794,7 @@ main()
|
|||||||
dotfiles) section_dotfiles "$@" ;;
|
dotfiles) section_dotfiles "$@" ;;
|
||||||
helpers) section_helpers "$@" ;;
|
helpers) section_helpers "$@" ;;
|
||||||
docs) section_docs "$@" ;;
|
docs) section_docs "$@" ;;
|
||||||
|
scripts) section_scripts "$@" ;;
|
||||||
tests) section_tests "$@" ;;
|
tests) section_tests "$@" ;;
|
||||||
*) usage && exit 0 ;;
|
*) usage && exit 0 ;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Export oh-my-posh configuration as an image
|
|
||||||
#
|
|
||||||
# shellcheck source=shared.sh
|
|
||||||
source "${DOTFILES}/config/shared.sh"
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
cd "$DOTFILES" || msg_err "Failed to change directory to $DOTFILES"
|
|
||||||
|
|
||||||
oh-my-posh config export image \
|
|
||||||
--config "$OHMYPOSH_CFG" \
|
|
||||||
--output "$HOME/.dotfiles/.github/screenshots/oh-my-posh.png" \
|
|
||||||
--author "Ismo Vuorinen"
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Install asdf and plugins I use
|
|
||||||
#
|
|
||||||
# It also updates asdf and the plugins, and then reshim asdf.
|
|
||||||
#
|
|
||||||
# Usage: ./install-asdf.sh [both|install|update|add_plugins]
|
|
||||||
# Author: Ismo Vuorinen <https://github.com/ivuorinen>
|
|
||||||
# License: MIT
|
|
||||||
|
|
||||||
msgr warn "The asdf plugins should be installed with dotbot, and 'dfm asdf'."
|
|
||||||
exit 0
|
|
||||||
@@ -3,9 +3,6 @@
|
|||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
|
|
||||||
echo "This file ($0) has been deprecated in favor of asdf. Please use asdf instead."
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
eval "$HOME/.dotfiles/config/shared.sh"
|
eval "$HOME/.dotfiles/config/shared.sh"
|
||||||
|
|
||||||
msg "Starting to install rust/cargo packages"
|
msg "Starting to install rust/cargo packages"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Install PHP Package Manager Composer
|
# Install PHP Package Manager Composer
|
||||||
#
|
#
|
||||||
# shellcheck source="shared.sh"
|
# shellcheck source="shared.sh"
|
||||||
eval "$HOME/.dotfiles/config/shared.sh"
|
source "$HOME/.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"
|
||||||
|
|||||||
@@ -7,24 +7,21 @@ source "$DOTFILES/config/shared.sh"
|
|||||||
GIT_REPO="https://github.com/ryanoasis/nerd-fonts.git"
|
GIT_REPO="https://github.com/ryanoasis/nerd-fonts.git"
|
||||||
TMP_PATH="$XDG_CACHE_HOME/nerd-fonts"
|
TMP_PATH="$XDG_CACHE_HOME/nerd-fonts"
|
||||||
|
|
||||||
msg "-- NerdFonts --"
|
msgr run "Starting to install NerdFonts"
|
||||||
|
|
||||||
fonts=(
|
fonts=(
|
||||||
Hack
|
|
||||||
IntelOneMono
|
|
||||||
JetBrainsMono
|
JetBrainsMono
|
||||||
OpenDyslexic
|
OpenDyslexic
|
||||||
SpaceMono
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Function to clone or update the NerdFonts repository
|
# Function to clone or update the NerdFonts repository
|
||||||
clone_or_update_repo()
|
clone_or_update_repo()
|
||||||
{
|
{
|
||||||
if [ ! -d "$TMP_PATH" ]; then
|
if [ ! -d "$TMP_PATH" ]; then
|
||||||
git clone --quiet --filter=blob:none --sparse "$GIT_REPO" "$TMP_PATH"
|
git clone --quiet --filter=blob:none --sparse --depth=1 "$GIT_REPO" "$TMP_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$TMP_PATH" || msg_err "No such folder $TMP_PATH"
|
cd "$TMP_PATH" || msgr err "No such folder $TMP_PATH"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to add fonts to sparse-checkout
|
# Function to add fonts to sparse-checkout
|
||||||
@@ -36,7 +33,7 @@ add_fonts_to_sparse_checkout()
|
|||||||
# Skip comments
|
# Skip comments
|
||||||
if [[ ${font:0:1} == "#" ]]; then continue; fi
|
if [[ ${font:0:1} == "#" ]]; then continue; fi
|
||||||
|
|
||||||
msg_run "Adding $font to sparse-checkout"
|
msgr run "Adding $font to sparse-checkout"
|
||||||
git sparse-checkout add "patched-fonts/$font"
|
git sparse-checkout add "patched-fonts/$font"
|
||||||
echo ""
|
echo ""
|
||||||
done
|
done
|
||||||
@@ -45,9 +42,9 @@ add_fonts_to_sparse_checkout()
|
|||||||
# Function to install NerdFonts
|
# Function to install NerdFonts
|
||||||
install_fonts()
|
install_fonts()
|
||||||
{
|
{
|
||||||
msg "Starting to install NerdFonts..."
|
msgr run "Starting to install NerdFonts..."
|
||||||
./install.sh -q -s ${fonts[*]}
|
./install.sh -q -s ${fonts[*]}
|
||||||
msg_ok "Done"
|
msgr run_done "Done"
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_tmp_path()
|
remove_tmp_path()
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Install fzf
|
|
||||||
#
|
|
||||||
|
|
||||||
echo "This file ($0) has been deprecated in favor of asdf. Please use asdf instead."
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
# shellcheck source=shared.sh
|
|
||||||
eval "$DOTFILES/config/shared.sh"
|
|
||||||
|
|
||||||
FZF_GIT="https://github.com/junegunn/fzf.git"
|
|
||||||
FZF_PATH="${XDG_CONFIG_HOME}/fzf"
|
|
||||||
FZF_BUILD="/tmp/fzf"
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
if [ ! -d "$FZF_BUILD" ]; then
|
|
||||||
git clone --depth 1 "$FZF_GIT" "$FZF_BUILD"
|
|
||||||
"$FZF_BUILD/install" \
|
|
||||||
--xdg \
|
|
||||||
--bin
|
|
||||||
msg_done "fzf installed"
|
|
||||||
else
|
|
||||||
msg_done "fzf ($FZF_PATH/) already installed"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
@@ -7,10 +7,10 @@ source "${DOTFILES}/config/shared.sh"
|
|||||||
# Enable verbosity with VERBOSE=1
|
# Enable verbosity with VERBOSE=1
|
||||||
VERBOSE="${VERBOSE:-0}"
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
msg_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
|
||||||
msg_err "gh (GitHub Client) could not be found, please install it first"
|
msgr err "gh (GitHub Client) could not be found, please install it first"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ install_extensions()
|
|||||||
# Skip comments
|
# Skip comments
|
||||||
if [[ ${ext:0:1} == "#" ]]; then continue; fi
|
if [[ ${ext:0:1} == "#" ]]; then continue; fi
|
||||||
|
|
||||||
msg_nested "Installing $ext"
|
msgr nested "Installing $ext"
|
||||||
gh extension install "$ext"
|
gh extension install "$ext"
|
||||||
echo ""
|
echo ""
|
||||||
done
|
done
|
||||||
@@ -52,7 +52,7 @@ install_extensions()
|
|||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
install_extensions
|
install_extensions
|
||||||
msg_ok "Done"
|
msgr run_done "Done"
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ source "${DOTFILES}/config/shared.sh"
|
|||||||
# Enable verbosity with VERBOSE=1
|
# Enable verbosity with VERBOSE=1
|
||||||
VERBOSE="${VERBOSE:-0}"
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
msg_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"
|
||||||
@@ -23,8 +23,8 @@ if ! command -v git-crypt &> /dev/null; then
|
|||||||
cd "$BUILD_PATH" || msg_err "$BUILD_PATH not found"
|
cd "$BUILD_PATH" || msg_err "$BUILD_PATH not found"
|
||||||
make && make install PREFIX="$HOME/.local"
|
make && make install PREFIX="$HOME/.local"
|
||||||
else
|
else
|
||||||
msg_done "git-crypt ($CHECK_PATH) already installed"
|
msgr run_done "git-crypt ($CHECK_PATH) already installed"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_done "Done installing git-crypt"
|
msgr run_done "Done installing git-crypt"
|
||||||
|
|||||||
@@ -2,18 +2,14 @@
|
|||||||
# Install Go packages
|
# Install Go packages
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
|
source "$DOTFILES/config/shared.sh"
|
||||||
echo "This file ($0) has been deprecated in favor of asdf. Please use asdf instead."
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
eval "$DOTFILES/config/shared.sh"
|
|
||||||
|
|
||||||
# Enable verbosity with VERBOSE=1
|
# Enable verbosity with VERBOSE=1
|
||||||
VERBOSE="${VERBOSE:-0}"
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
msg_run "Installing go packages"
|
msgr run "Installing go packages"
|
||||||
|
|
||||||
! x-have "go" && msg "go hasn't been installed yet." && exit 0
|
! x-have "go" && msgr err "go hasn't been installed yet." && exit 0
|
||||||
|
|
||||||
packages=(
|
packages=(
|
||||||
# A shell parser, formatter, and interpreter with bash support; includes shfmt
|
# A shell parser, formatter, and interpreter with bash support; includes shfmt
|
||||||
@@ -49,7 +45,7 @@ install_packages()
|
|||||||
# Skip comments
|
# Skip comments
|
||||||
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
||||||
|
|
||||||
msg_nested "Installing go package: $pkg"
|
msgr nested "Installing go package: $pkg"
|
||||||
go install "$pkg"
|
go install "$pkg"
|
||||||
echo ""
|
echo ""
|
||||||
done
|
done
|
||||||
@@ -58,23 +54,23 @@ install_packages()
|
|||||||
# Function to install completions and run actions for selected packages
|
# Function to install completions and run actions for selected packages
|
||||||
post_install()
|
post_install()
|
||||||
{
|
{
|
||||||
msg_run "Installing completions for selected packages"
|
msgr run "Installing completions for selected packages"
|
||||||
|
|
||||||
if command -v git-profile &> /dev/null; then
|
if command -v git-profile &> /dev/null; then
|
||||||
git-profile completion zsh > "$ZSH_CUSTOM_COMPLETION_PATH/_git-profile" \
|
git-profile completion zsh > "$ZSH_CUSTOM_COMPLETION_PATH/_git-profile" \
|
||||||
&& msg_ok "Installed completions for git-profile"
|
&& msgr run_done "Installed completions for git-profile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v antidot &> /dev/null; then
|
if command -v antidot &> /dev/null; then
|
||||||
antidot update \
|
antidot update \
|
||||||
&& msg_ok "Updated antidot database"
|
&& msgr run_done "Updated antidot database"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to clear go cache
|
# Function to clear go cache
|
||||||
clear_go_cache()
|
clear_go_cache()
|
||||||
{
|
{
|
||||||
msg_run "Clearing go cache"
|
msgr run "Clearing go cache"
|
||||||
go clean -cache -modcache
|
go clean -cache -modcache
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +79,7 @@ main()
|
|||||||
install_packages
|
install_packages
|
||||||
post_install
|
post_install
|
||||||
clear_go_cache
|
clear_go_cache
|
||||||
msg_ok "Done"
|
msgr run_done "Done"
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Install neofetch from source
|
|
||||||
#
|
|
||||||
# shellcheck source=shared.sh
|
|
||||||
source "$DOTFILES/config/shared.sh"
|
|
||||||
|
|
||||||
if ! declare -f msg > /dev/null; then
|
|
||||||
# Function to print messages if VERBOSE is enabled
|
|
||||||
# $1 - message (string)
|
|
||||||
msg()
|
|
||||||
{
|
|
||||||
[ "$VERBOSE" -eq 1 ] && echo "$1"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! declare -f msg_err > /dev/null; then
|
|
||||||
# Function to print error messages and exit
|
|
||||||
# $1 - error message (string)
|
|
||||||
msg_err()
|
|
||||||
{
|
|
||||||
echo "(!) ERROR: $1" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! declare -f msg_done > /dev/null; then
|
|
||||||
# Function to print done message
|
|
||||||
# $1 - message (string)
|
|
||||||
msg_done()
|
|
||||||
{
|
|
||||||
echo "✓ $1"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
NEOFETCH_VERSION="$(x-gh-get-latest-version dylanaraps/neofetch)"
|
|
||||||
NEOFETCH_REPO="https://github.com/dylanaraps/neofetch"
|
|
||||||
NEOFETCH_URL="${NEOFETCH_REPO}/archive/refs/tags/${NEOFETCH_VERSION}.tar.gz"
|
|
||||||
NEOFETCH_TEMP="/tmp/neofetch"
|
|
||||||
NEOFETCH_INSTALL_PREFIX="$HOME/.local"
|
|
||||||
|
|
||||||
# Enable verbosity with VERBOSE=1
|
|
||||||
VERBOSE="${VERBOSE:-0}"
|
|
||||||
|
|
||||||
# Function to install neofetch from source
|
|
||||||
install_neofetch()
|
|
||||||
{
|
|
||||||
LC_ALL=C
|
|
||||||
|
|
||||||
mkdir -p "$NEOFETCH_TEMP" "$NEOFETCH_INSTALL_PREFIX"
|
|
||||||
|
|
||||||
curl -L "$NEOFETCH_URL" -o "$NEOFETCH_TEMP.tar.gz"
|
|
||||||
tar zxvf "$NEOFETCH_TEMP.tar.gz" --directory="$NEOFETCH_TEMP"
|
|
||||||
cd "$NEOFETCH_TEMP/neofetch-$NEOFETCH_VERSION" \
|
|
||||||
&& make PREFIX="${NEOFETCH_INSTALL_PREFIX}" install \
|
|
||||||
&& rm -rf "$NEOFETCH_TEMP*" \
|
|
||||||
&& msg_yay "neofetch installed!"
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
if ! command -v neofetch &> /dev/null; then
|
|
||||||
install_neofetch
|
|
||||||
elif [ "$NEOFETCH_VERSION" != "$(neofetch --version | awk '{print $2}')" ]; then
|
|
||||||
install_neofetch
|
|
||||||
else
|
|
||||||
msg_done "neofetch v.${NEOFETCH_VERSION} already installed"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
@@ -2,8 +2,7 @@
|
|||||||
# Install npm packages globally.
|
# Install npm packages globally.
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
|
source "$DOTFILES/config/shared.sh"
|
||||||
eval "$DOTFILES/config/shared.sh"
|
|
||||||
|
|
||||||
# Enable verbosity with VERBOSE=1
|
# Enable verbosity with VERBOSE=1
|
||||||
VERBOSE="${VERBOSE:-0}"
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
# Install ntfy
|
# Install ntfy
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
eval "$DOTFILES/config/shared.sh"
|
source "$DOTFILES/config/shared.sh"
|
||||||
|
|
||||||
# Enable verbosity with VERBOSE=1
|
# Enable verbosity with VERBOSE=1
|
||||||
VERBOSE="${VERBOSE:-0}"
|
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
|
||||||
msg "ntfy already installed"
|
msgr done "ntfy already installed"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ case $(dfm check arch) in
|
|||||||
NTFY_ARCH="macOS_all"
|
NTFY_ARCH="macOS_all"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
msg_err "Unsupported OS"
|
msgr err "Unsupported OS"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ install_ntfy()
|
|||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
install_ntfy
|
install_ntfy
|
||||||
msg "ntfy installation complete"
|
msgr done "ntfy installation complete"
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Install oh-my-bash
|
|
||||||
#
|
|
||||||
# shellcheck source=shared.sh
|
|
||||||
source "${DOTFILES}/config/shared.sh"
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Enable verbosity with VERBOSE=1
|
|
||||||
VERBOSE="${VERBOSE:-0}"
|
|
||||||
|
|
||||||
OSH="$HOME/.local/share/oh-my-bash"
|
|
||||||
|
|
||||||
# Function to install oh-my-bash
|
|
||||||
install_oh_my_bash()
|
|
||||||
{
|
|
||||||
if [ ! -d "$OSH" ]; then
|
|
||||||
[ -f "$HOME/.bashrc" ] && mv "$HOME/.bashrc" "$HOME/.bashrc.temp"
|
|
||||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)" --unattended
|
|
||||||
[ -f "$HOME/.bashrc.temp" ] && mv "$HOME/.bashrc.temp" "$HOME/.bashrc"
|
|
||||||
msg "oh-my-bash installed to $OSH"
|
|
||||||
else
|
|
||||||
msg_done "oh-my-bash ($OSH) already installed"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
install_oh_my_bash
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#!/usr/bin/env zsh
|
|
||||||
#
|
|
||||||
# Install oh-my-posh
|
|
||||||
#
|
|
||||||
# shellcheck source=shared.sh
|
|
||||||
source "${DOTFILES}/config/shared.sh"
|
|
||||||
|
|
||||||
# Enable verbosity with VERBOSE=1
|
|
||||||
VERBOSE="${VERBOSE:-0}"
|
|
||||||
|
|
||||||
msg "Starting to install oh-my-posh"
|
|
||||||
|
|
||||||
# Install oh-my-posh
|
|
||||||
install_oh_my_posh()
|
|
||||||
{
|
|
||||||
curl -s https://ohmyposh.dev/install.sh | bash -s -- -d ~/.local/bin
|
|
||||||
msg "oh-my-posh installed to ~/.local/bin"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Initialize oh-my-posh
|
|
||||||
init_oh_my_posh()
|
|
||||||
{
|
|
||||||
eval "$(oh-my-posh init zsh --config $OHMYPOSH_CFG)"
|
|
||||||
msg "oh-my-posh initialized with config $OHMYPOSH_CFG"
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
install_oh_my_posh
|
|
||||||
init_oh_my_posh
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
@@ -2,20 +2,19 @@
|
|||||||
# Install python/pip packages.
|
# Install python/pip packages.
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
|
|
||||||
source "${DOTFILES}/config/shared.sh"
|
source "${DOTFILES}/config/shared.sh"
|
||||||
|
|
||||||
# Enable verbosity with VERBOSE=1
|
# Enable verbosity with VERBOSE=1
|
||||||
VERBOSE="${VERBOSE:-0}"
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
msg "Starting to install pip packages"
|
msgr run "Starting to install pip packages"
|
||||||
|
|
||||||
if ! command -v python3 &> /dev/null; then
|
if ! command -v python3 &> /dev/null; then
|
||||||
msg_err "Could not find python3, something really weird is going on."
|
msgr err "Could not find python3, something really weird is going on."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_nested "Upgrading pip"
|
msgr nested "Upgrading pip"
|
||||||
python3 -m pip install --user --upgrade pip
|
python3 -m pip install --user --upgrade pip
|
||||||
|
|
||||||
packages=(
|
packages=(
|
||||||
@@ -32,11 +31,11 @@ install_packages()
|
|||||||
# Skip comments
|
# Skip comments
|
||||||
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
||||||
|
|
||||||
msg_nested "Installing pip package: $pkg"
|
msgr nested "Installing pip package: $pkg"
|
||||||
python3 -m pip install --user --upgrade "$pkg"
|
python3 -m pip install --user --upgrade "$pkg"
|
||||||
echo ""
|
echo ""
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
install_packages
|
install_packages
|
||||||
msg_yay "Run pip package installations"
|
msgr run_done "Run pip package installations"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
|
||||||
# Install XCode CLI Tools with osascript magic.
|
# Install XCode CLI Tools with osascript magic.
|
||||||
# Ismo Vuorinen <https://github.com/ivuorinen> 2018
|
# Ismo Vuorinen <https://github.com/ivuorinen> 2018
|
||||||
#
|
#
|
||||||
@@ -9,13 +8,13 @@ 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
|
||||||
echo "Not a macOS system"
|
msgr warn "Not a macOS system"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if xcode-select is available
|
# Check if xcode-select is available
|
||||||
if ! command -v xcode-select &> /dev/null; then
|
if ! command -v xcode-select &> /dev/null; then
|
||||||
msg_err "xcode-select could not be found, skipping"
|
msgr err "xcode-select could not be found, skipping"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -46,7 +45,7 @@ prompt_xcode_install()
|
|||||||
if [ "$XCODE_MESSAGE" = "button returned:OK" ]; then
|
if [ "$XCODE_MESSAGE" = "button returned:OK" ]; then
|
||||||
xcode-select --install
|
xcode-select --install
|
||||||
else
|
else
|
||||||
echo "You have cancelled the installation, please rerun the installer."
|
msgr warn "You have cancelled the installation, please rerun the installer."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -57,7 +56,7 @@ main()
|
|||||||
keep_alive_sudo
|
keep_alive_sudo
|
||||||
|
|
||||||
if [ -x "$XCODE_SWIFT_PATH" ]; then
|
if [ -x "$XCODE_SWIFT_PATH" ]; then
|
||||||
echo "You have swift from xcode-select. Continuing..."
|
msgr run "You have swift from xcode-select. Continuing..."
|
||||||
else
|
else
|
||||||
prompt_xcode_install
|
prompt_xcode_install
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
|
||||||
# Install z
|
# Install z
|
||||||
#
|
#
|
||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
@@ -16,9 +15,9 @@ clone_z_repo()
|
|||||||
|
|
||||||
if [ ! -d "$bin_path" ]; then
|
if [ ! -d "$bin_path" ]; then
|
||||||
git clone "$git_path" "$bin_path"
|
git clone "$git_path" "$bin_path"
|
||||||
msg "z installed at $bin_path"
|
msgr run_done "z installed at $bin_path"
|
||||||
else
|
else
|
||||||
msg "z ($bin_path/) already installed"
|
msgr ok "z ($bin_path/) already installed"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
# Sets macOS Defaults that I like
|
||||||
# set-macos-defaults.sh - Sets macOS Defaults that I like
|
|
||||||
#
|
#
|
||||||
# This script contains large portions from following scripts:
|
# This script contains large portions from following scripts:
|
||||||
# - https://github.com/freekmurze/dotfiles/blob/main/macos/set-defaults.sh
|
# - https://github.com/freekmurze/dotfiles/blob/main/macos/set-defaults.sh
|
||||||
#
|
|
||||||
|
|
||||||
[ "$(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
|
||||||
eval "$HOME/.dotfiles/config/shared.sh"
|
source "$HOME/.dotfiles/config/shared.sh"
|
||||||
|
|
||||||
msg_run "Starting to set macOS defaults, these require sudo privileges:"
|
msgr run "Starting to set macOS defaults, these require sudo privileges:"
|
||||||
|
|
||||||
# Ask for the administrator password upfront
|
# Ask for the administrator password upfront
|
||||||
sudo -v
|
sudo -v
|
||||||
@@ -24,7 +22,7 @@ while true; do
|
|||||||
kill -0 "$$" || exit
|
kill -0 "$$" || exit
|
||||||
done 2> /dev/null &
|
done 2> /dev/null &
|
||||||
|
|
||||||
msg_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
|
||||||
@@ -35,7 +33,7 @@ fi
|
|||||||
# General UI/UX #
|
# General UI/UX #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
msg_nested "Setting General UI/UX settings"
|
msgr nested "Setting General UI/UX settings"
|
||||||
|
|
||||||
# Disable the sound effects on boot
|
# Disable the sound effects on boot
|
||||||
sudo nvram SystemAudioVolume=" "
|
sudo nvram SystemAudioVolume=" "
|
||||||
@@ -89,7 +87,7 @@ defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
|
|||||||
# SSD-specific tweaks #
|
# SSD-specific tweaks #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
msg_nested "Setting SSD-specific tweaks"
|
msgr nested "Setting SSD-specific tweaks"
|
||||||
|
|
||||||
# Disable hibernation (speeds up entering sleep mode)
|
# Disable hibernation (speeds up entering sleep mode)
|
||||||
sudo pmset -a hibernatemode 0
|
sudo pmset -a hibernatemode 0
|
||||||
@@ -101,7 +99,7 @@ sudo pmset -a sms 0
|
|||||||
# Trackpad, mouse, keyboard, Bluetooth accessories, and input #
|
# Trackpad, mouse, keyboard, Bluetooth accessories, and input #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
msg_nested "Settings for Trackpad, mouse, keyboard, Bluetooth accessories, and input"
|
msgr nested "Settings for Trackpad, mouse, keyboard, Bluetooth accessories, and input"
|
||||||
|
|
||||||
# Increase sound quality for Bluetooth headphones/headsets
|
# Increase sound quality for Bluetooth headphones/headsets
|
||||||
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 80
|
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 80
|
||||||
@@ -137,7 +135,7 @@ launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/nul
|
|||||||
# Screen #
|
# Screen #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
msg_nested "Settings for Screen"
|
msgr nested "Settings for Screen"
|
||||||
|
|
||||||
# Require password immediately after sleep or screen saver begins
|
# Require password immediately after sleep or screen saver begins
|
||||||
defaults write com.apple.screensaver askForPassword -int 1
|
defaults write com.apple.screensaver askForPassword -int 1
|
||||||
@@ -147,7 +145,7 @@ defaults write com.apple.screensaver askForPasswordDelay -int 0
|
|||||||
# Finder #
|
# Finder #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
msg_nested "Settings for Finder"
|
msgr nested "Settings for Finder"
|
||||||
|
|
||||||
# Set Desktop as the default location for new Finder windows
|
# Set Desktop as the default location for new Finder windows
|
||||||
# For other paths, use `PfLo` and `file:///full/path/here/`
|
# For other paths, use `PfLo` and `file:///full/path/here/`
|
||||||
@@ -207,7 +205,7 @@ defaults write com.apple.finder FXInfoPanesExpanded -dict \
|
|||||||
# Screenshots #
|
# Screenshots #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
msg_nested "Settings for Screenshots"
|
msgr nested "Settings for Screenshots"
|
||||||
|
|
||||||
# Set default screenshot location
|
# Set default screenshot location
|
||||||
mkdir -p "$HOME/Documents/Screenshots"
|
mkdir -p "$HOME/Documents/Screenshots"
|
||||||
@@ -223,7 +221,7 @@ defaults write com.apple.screencapture "name" -string "screenshot"
|
|||||||
# Dock, Dashboard, and hot corners #
|
# Dock, Dashboard, and hot corners #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
msg_nested "Settings for Dock, Dashboard, and hot corners"
|
msgr nested "Settings for Dock, Dashboard, and hot corners"
|
||||||
|
|
||||||
# Prevent applications from bouncing in Dock
|
# Prevent applications from bouncing in Dock
|
||||||
defaults write com.apple.dock no-bouncing -bool true
|
defaults write com.apple.dock no-bouncing -bool true
|
||||||
@@ -255,7 +253,7 @@ defaults write com.apple.dock showhidden -bool true
|
|||||||
# Safari & WebKit #
|
# Safari & WebKit #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
msg_nested "Settings for Safari & WebKit"
|
msgr nested "Settings for Safari & WebKit"
|
||||||
|
|
||||||
# Enable Safari's debug menu
|
# Enable Safari's debug menu
|
||||||
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
|
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
|
||||||
@@ -281,7 +279,7 @@ defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
|
|||||||
# Activity Monitor #
|
# Activity Monitor #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
msg_nested "Settings for ActivityMonitor"
|
msgr nested "Settings for ActivityMonitor"
|
||||||
|
|
||||||
# Show the main window when launching Activity Monitor
|
# Show the main window when launching Activity Monitor
|
||||||
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
|
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
|
||||||
@@ -300,7 +298,7 @@ defaults write com.apple.ActivityMonitor SortDirection -int 0
|
|||||||
# Address Book, Dashboard, iCal, TextEdit, and Disk Utility #
|
# Address Book, Dashboard, iCal, TextEdit, and Disk Utility #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
msg_nested "Settings for Address Book, Dashboard, iCal, TextEdit, and Disk Utility"
|
msgr nested "Settings for Address Book, Dashboard, iCal, TextEdit, and Disk Utility"
|
||||||
|
|
||||||
# Use plain text mode for new TextEdit documents
|
# Use plain text mode for new TextEdit documents
|
||||||
defaults write com.apple.TextEdit RichText -int 0
|
defaults write com.apple.TextEdit RichText -int 0
|
||||||
@@ -313,7 +311,7 @@ defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
|
|||||||
# Messages #
|
# Messages #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
msg_nested "Settings for Messages"
|
msgr nested "Settings for Messages"
|
||||||
|
|
||||||
# Disable smart quotes as it's annoying for messages that contain code
|
# Disable smart quotes as it's annoying for messages that contain code
|
||||||
defaults write com.apple.messageshelper.MessageController \
|
defaults write com.apple.messageshelper.MessageController \
|
||||||
@@ -327,7 +325,7 @@ defaults write com.apple.messageshelper.MessageController \
|
|||||||
-dict-add "continuousSpellCheckingEnabled" \
|
-dict-add "continuousSpellCheckingEnabled" \
|
||||||
-bool false
|
-bool false
|
||||||
|
|
||||||
msg_nested "Restarting applications to apply changes"
|
msgr nested "Restarting applications to apply changes"
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Kill affected applications #
|
# Kill affected applications #
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
# Shared bash functions and helpers.
|
||||||
# Shared bash functions and helpers
|
|
||||||
# that can be sourced to other scripts.
|
|
||||||
|
|
||||||
# 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 sourced only once
|
# Set variable that checks if the shared.sh script has been
|
||||||
# If the script has been sourced more than once, the script not be sourced again
|
# sourced only once If the script has been sourced more than once,
|
||||||
|
# the script not be sourced again.
|
||||||
[ -z "$SHARED_SCRIPTS_SOURCED" ] && {
|
[ -z "$SHARED_SCRIPTS_SOURCED" ] && {
|
||||||
|
|
||||||
source "${DOTFILES}/config/shared.sh"
|
source "${DOTFILES}/config/shared.sh"
|
||||||
msgr warn "(!) shared.sh not sourced"
|
msgr warn "(!) shared.sh not sourced"
|
||||||
|
|
||||||
# Set variable that checks if the shared.sh script has been sourced only once
|
# Set variable that checks if the shared.sh script has been
|
||||||
|
# sourced only once.
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
export SHARED_SCRIPTS_SOURCED=1
|
export SHARED_SCRIPTS_SOURCED=1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user