punktdateien/uninstall.sh

166 lines
3.8 KiB
Bash
Executable file

#!/usr/bin/env bash
# jeremystartm's dotfiles "installer"
FORCED_UNLINKING=
# utility function
function unlink() {
if [ -a "${HOME}/${*}" ] || [ -n "${FORCED_UNLINKING}" ]; then
echo ":: Unlinking ${1}"
rm -rf "${HOME:?}/${*:?}"
fi
}
# repositories
[[ -n "$REMOVE_REPOSITORIES" ]] && rm -rf repositories/*
# install bit
[[ -n "$REMOVE_INSTALLBIT" ]] && rm -rf "$HOME/.config/.jstm_dotfiles"
for arg in "${@}"; do
case "${arg}" in
"--remove-legacy-paths")
echo ":: Unlinking legacy paths"
declare -a legacypaths=(
".local/bin/jobrunner"
".local/bin/jobrunner-runjob"
".jstmbash"
".config/jstmbash.env"
".config/starship.toml"
".bashrc"
".config/hypr"
".config/waybar"
".config/fnott"
".config/eww"
".config/xdg-desktop-portal/hyprland-portals.conf"
".config/neofetch"
".config/btop"
".local/share/mc"
".config/mc"
".config/mpv"
".config/GIMP/2.10/splashes"
".config/gitui"
".local/share/mc/skins/dracula.ini"
".local/share/mc/skins/dracula256.ini"
".config/nwg-look"
".config/qt5ct"
".config/qt6ct"
".config/Kvantum"
".icons"
".local/share/icons"
".fonts"
".config/fontconfig"
".local/share/wallpapers"
".local/share/plasma"
".config/kdedefaults"
".local/share/color-schemes"
".local/share/aurorae"
".config/kglobalshortcutsrc"
".config/kiorc"
".config/krunnerrc"
".config/kservicemenurc"
".config/ksplashrc"
".config/ktimezonedrc"
".config/plasma-localrc"
".config/plasma-org.kde.plasma.desktop-appletsrc"
".config/konsolerc"
".local/share/konsole"
".config/dolphinrc"
".local/bin/dotfiles-updatechecker"
".local/bin/dotfiles-updater"
".local/bin/dotfiles-install-software"
".local/bin/launch-menu"
".config/copyq"
)
for path in "${legacypaths[@]}"; do
FORCED_UNLINKING=y unlink "${path}"
done
rm -rf "jstmbash" "dracula-mc"
echo ":: Unlinked legacy paths"
exit 0
;;
"--remove-unshared-bashrcd")
echo ":: Removing unshared bashrc.d"
FORCED_UNLINKING=y unlink ".bashrc.d"
exit 0
;;
*)
echo ":: Warning: Unknown argument \"${arg}\""
;;
esac
done
# repositories
unlink ".local/share/mc/skins/dracula.ini"
unlink ".local/share/mc/skins/dracula256.ini"
# bash
unlink ".bashrc"
unlink ".local/bin/launch-menu"
unlink ".local/bin/launch-menu-apps"
unlink ".local/bin/jobrunner"
unlink ".local/bin/jobrunner-runjob"
unlink ".config/jstmbash.env"
unlink ".config/starship.toml"
# programs
unlink ".config/btop"
unlink ".config/gitui"
unlink ".config/GIMP/2.10/splashes"
unlink ".local/share/konsole"
unlink ".config/mc"
unlink ".local/share/mc"
unlink ".config/mpv"
# gui
unlink ".config/fnott"
unlink ".config/hypr"
unlink ".config/xdg-desktop-portal/hyprland-portals.conf"
unlink ".config/waybar"
unlink ".local/share/aurorae"
unlink ".local/share/color-schemes"
unlink ".config/kdedefaults"
unlink ".local/share/plasma"
unlink ".config/dolphinrc"
unlink ".config/kglobalshortcutsrc"
unlink ".config/kiorc"
unlink ".config/konsolerc"
unlink ".config/krunnerrc"
unlink ".config/kservicemenurc"
unlink ".config/ksplashrc"
unlink ".config/ktimezonedrc"
unlink ".config/plasma-localrc"
unlink ".config/plasma-org.kde.plasma.desktop-appletsrc"
# theming
unlink ".icons"
unlink ".themes"
unlink ".fonts"
unlink ".config/fontconfig"
unlink ".local/share/icons"
unlink ".config/Kvantum"
unlink ".config/neofetch"
unlink ".config/nwg-look"
unlink ".config/qt5ct"
unlink ".config/qt6ct"
unlink ".local/share/wallpapers"
# punktdateien scripts
unlink ".local/bin/dotfiles-install-software"
unlink ".local/bin/dotfiles-updatechecker"
unlink ".local/bin/dotfiles-updater"
# legacy
unlink ".config/copyq"
unlink ".config/eww"
unlink ".jstmbash"
# legacy repositories
rm -rf "repositories/jstmbash"