diff --git a/btrfs_backup b/.archived/btrfs_backup
similarity index 72%
rename from btrfs_backup
rename to .archived/btrfs_backup
index 88a4b41..edf54fa 100755
--- a/btrfs_backup
+++ b/.archived/btrfs_backup
@@ -1,18 +1,10 @@
#!/usr/bin/env bash
-LOGFILE="/var/log/btrfs-backup.log"
-SNAP_DATE=$(date '+%Y-%m-%d_%H%M%S')
-
-send_matrix_webhook() {
- /usr/local/bin/send-matrix-webhook "btrfs-backup failed on $(hostname)"
-}
-
-trap send_matrix_webhook SIGINT SIGTERM
+SNAP_DATE=$(date '+%Y-%m-%d_%H-%M-%S')
# Check if device is mounted
-if ! grep "/srv/backup" /etc/mtab >/dev/null; then
- echo "[$(date '+%Y-%m-%d %H:%M:%S')] Backup device is not mounted." | tee -a "$LOGFILE"
- notify-send -i computer-fail "Backup device is not mounted"
+if ! grep "/mnt/storage" /etc/mtab >/dev/null; then
+ logger -p error -t btrfs_backup "ERROR: /mnt/storage is not mounted."
exit 1
fi
diff --git a/btrfs_snapshot b/.archived/btrfs_snapshot
similarity index 100%
rename from btrfs_snapshot
rename to .archived/btrfs_snapshot
diff --git a/gumstarred b/.archived/gumstarred
similarity index 100%
rename from gumstarred
rename to .archived/gumstarred
diff --git a/install_cat_gtk b/.archived/install_cat_gtk
similarity index 100%
rename from install_cat_gtk
rename to .archived/install_cat_gtk
diff --git a/list_iommu_groups b/.archived/list_iommu_groups
similarity index 100%
rename from list_iommu_groups
rename to .archived/list_iommu_groups
diff --git a/roficlipster b/.archived/roficlipster
similarity index 100%
rename from roficlipster
rename to .archived/roficlipster
diff --git a/rofifox b/.archived/rofifox
similarity index 100%
rename from rofifox
rename to .archived/rofifox
diff --git a/rofimaim b/.archived/rofimaim
similarity index 100%
rename from rofimaim
rename to .archived/rofimaim
diff --git a/rofipower b/.archived/rofipower
similarity index 100%
rename from rofipower
rename to .archived/rofipower
diff --git a/rofiprompt b/.archived/rofiprompt
similarity index 100%
rename from rofiprompt
rename to .archived/rofiprompt
diff --git a/rofisearch b/.archived/rofisearch
similarity index 100%
rename from rofisearch
rename to .archived/rofisearch
diff --git a/rofistarred b/.archived/rofistarred
similarity index 100%
rename from rofistarred
rename to .archived/rofistarred
diff --git a/tznu b/.archived/tznu
similarity index 100%
rename from tznu
rename to .archived/tznu
diff --git a/nerdfont_installer b/nerdfont_installer
index 0c8c717..b52102e 100755
--- a/nerdfont_installer
+++ b/nerdfont_installer
@@ -22,20 +22,22 @@ set -o posix
# Check for dependencies: curl and gum.
if ! test -x "$(command -v curl)"; then
- echo "Missing dependencies: please install curl."
+ echo "Missing dependencies: curl"
exit 1
fi
if ! test -x "$(command -v gum)"; then
- echo "Missing dependencies: please install the gum command."
+ echo "Missing dependencies: gum"
echo "See https://github.com/charmbracelet/gum"
exit 1
fi
-# Define variables
-NF_BASE_URL="https://github.com/ryanoasis/nerd-fonts/releases/download"
-NF_VERSION=$(curl -sL https://github.com/ryanoasis/nerd-fonts/releases/latest | grep "
Release" | awk '{ print $2 }')
-NF_URL="${NF_BASE_URL}/${NF_VERSION}"
+if ! test -x "$(command -v unzip)"; then
+ echo "Missing dependencies: unzip"
+ exit 1
+fi
+
+# Directory on the local filesystem where the fonts will be installed.
LOCAL_FONT_DIR="${HOME}/.local/share/fonts"
# Fancy error output message.
@@ -53,63 +55,6 @@ gum_error() {
exit 1
}
-# Array of nerd font names.
-nf_array=(
- 3270
- Agave
- AnonymousPro
- Arimo
- AurulentSansMono
- BigBlueTerminal
- BitstreamVeraSansMono
- CascadiaCode
- CodeNewRoman
- Cousine
- DaddyTimeMono
- DejaVuSansMono
- DroidSansMono
- EnvyCodeR
- FantasqueSansMono
- FiraCode
- FiraMono
- Go-Mono
- Gohu
- Hack
- Hasklig
- HeavyData
- Hermit
- iA-Writer
- IBMPlexMono
- Inconsolata
- InconsolataGo
- InconsolataLGC
- IntelOneMono
- Iosevka
- JetBrainsMono
- Lekton
- LiberationMono
- Lilex
- Meslo
- Monofur
- Monoid
- Mononoki
- MPlus
- Noto
- OpenDyslexic
- Overpass
- ProFont
- ProggyClean
- RobotoMono
- ShareTechMono
- SourceCodePro
- SpaceMono
- Terminus
- Tinos
- Ubuntu
- UbuntuMono
- VictorMono
-)
-
# Print the startup message.
message=$(echo "Nerd font installer :nerd_face:" | gum format -t emoji)
gum style \
@@ -121,10 +66,24 @@ gum style \
--margin "1 2" \
"$message"
-# Print the `nf_array` line by line and pipe to `gum choose --no-limit`.
-# Create `selection` array from the output of `gum choose --no-limit`.
-# It will contain only the items that were selected by the user.
-mapfile -t selection < <(printf "%s\n" "${nf_array[@]}" | gum choose --no-limit)
+# Read the nerd-font download URLs into an array
+readarray -t nf_url_array < <(curl --silent "https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest" | jq '.assets.[].browser_download_url' | tr -d '"' | grep ".zip")
+
+# Add the nerd-font basenames without file extension suffix into an associative
+# array, using these as the keys and the download URLs as the values.
+declare -A nf_array
+for nf in "${nf_url_array[@]}"; do
+ name="$(basename -s .zip "$nf")"
+ nf_array[$name]="$nf"
+done
+
+# Sort the keys of the array.
+IFS=$'\n'
+readarray -t sorted_keys < <(sort <<<"${!nf_array[*]}")
+unset IFS
+
+# Display nerd-font selection menu with the keys of the associative array.
+selection=$(gum choose --height=10 --limit=1 "${sorted_keys[@]}")
# Prompt for user confirmation and proceed with installation of nerd fonts.
#
@@ -133,16 +92,14 @@ mapfile -t selection < <(printf "%s\n" "${nf_array[@]}" | gum choose --no-limit)
#
# If user declines to proceed with installation, print a cancel message.
if gum confirm "Proceed with installation?"; then
- for item in "${selection[@]}"; do
- if ! gum spin --spinner dot --title "Downloading $item..." \
- -- curl --create-dirs -f -sL -o "${LOCAL_FONT_DIR}/$item.zip" "${NF_URL}/$item.zip"; then
- gum_error "Failed to download nerd font archive $item"
- fi
- if ! gum spin --spinner dot --title "Installing $item..." \
- -- unzip -uo "${LOCAL_FONT_DIR}/$item.zip" -d "${LOCAL_FONT_DIR}"; then
- gum_error "Failed to install nerd font archive $item"
- fi
- done
+ if ! gum spin --spinner dot --title "Downloading $selection..." \
+ -- curl --create-dirs -f -sL -o "${LOCAL_FONT_DIR}/$selection.zip" "${nf_array["$selection"]}"; then
+ gum_error "Failed to download nerdfont archive $selection"
+ fi
+ if ! gum spin --spinner dot --title "Installing $selection..." \
+ -- unzip -uo "${LOCAL_FONT_DIR}/$selection.zip" -d "${LOCAL_FONT_DIR}"; then
+ gum_error "Failed to install nerdfont archive $selection"
+ fi
else
gum style \
--foreground 212 \