Cleanup skel

This commit is contained in:
David Tomaschik
2026-02-09 23:11:54 -08:00
parent ff0a7d150d
commit f4e3447eb7
5 changed files with 108 additions and 46 deletions

View File

@@ -3,6 +3,11 @@
set -o nounset
set -o errexit
if [ "$(uname)" != "Linux" ]; then
echo "Error: This backup script is only intended for use on Linux." >&2
exit 1
fi
DEFAULT=`echo /media/${USER}/[bB]ackup/${USER}/`
DEST="${1:-${DEFAULT}}"

46
bin/prune-broken-symlinks.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/sh
# shellcheck disable=SC2039,SC2086
set -o nounset
prune_broken_symlinks() {
ask=1
dir="."
if [ "${1:-}" = "-y" ]; then
ask=0
shift
fi
if [ -n "${1:-}" ]; then
dir="$1"
fi
# Check if there are any broken symlinks first
broken_links=$(find -L "$dir" -xdev -type l -print 2>/dev/null)
if [ -z "$broken_links" ]; then
return 0
fi
if [ "$ask" -eq 1 ]; then
# Print broken links
echo "$broken_links"
printf "Delete these links? [y/N] "
read -r reply
case "$reply" in
[yY]*)
;;
*)
echo "Aborted."
return 0
;;
esac
fi
# Perform deletion
find -L "$dir" -xdev -type l -exec rm -- {} + 2>/dev/null
}
# Execute the function
prune_broken_symlinks "$@"

View File

@@ -2,7 +2,7 @@
set -ue
VER="v2.2.2"
VER="v3.4.0"
FONTS=(
https://github.com/ryanoasis/nerd-fonts/releases/download/${VER}/DejaVuSansMono.zip
@@ -13,14 +13,21 @@ FONTS=(
https://github.com/ryanoasis/nerd-fonts/releases/download/${VER}/OpenDyslexic.zip
)
FPATH=${HOME}/.fonts/nerdfonts
mkdir -p ${FPATH}
cd ${FPATH}
if [ "$(uname)" = "Darwin" ]; then
FPATH="${HOME}/Library/Fonts"
else
FPATH="${HOME}/.local/share/fonts/nerdfonts"
fi
for f in ${FONTS[@]}; do
BN=$(basename $f)
wget -O ${FPATH}/${BN} ${f}
unzip -o -d ${FPATH} ${FPATH}/${BN}
mkdir -p "${FPATH}"
cd "${FPATH}"
for f in "${FONTS[@]}"; do
BN=$(basename "$f")
wget -O "${FPATH}/${BN}" "$f"
unzip -o -d "${FPATH}" "${FPATH}/${BN}"
done
fc-cache -v
if command -v fc-cache >/dev/null 2>&1; then
fc-cache -v
fi