52 lines
1.4 KiB
Bash
Executable File
52 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
CONFIG_DIR="$HOME/.config"
|
|
|
|
# Function to remove symlink and restore backup if it exists
|
|
uninstall_config() {
|
|
local name=$1
|
|
local target="$CONFIG_DIR/$name"
|
|
|
|
# Remove symlink if it exists
|
|
if [ -L "$target" ]; then
|
|
echo "Removing $name symlink"
|
|
rm "$target"
|
|
|
|
# Restore backup if it exists
|
|
if [ -e "${target}.bak" ]; then
|
|
echo "Restoring $name backup from ${target}.bak"
|
|
mv "${target}.bak" "$target"
|
|
fi
|
|
elif [ -e "$target" ]; then
|
|
echo "$name is not a symlink, skipping"
|
|
else
|
|
echo "$name config not found, skipping"
|
|
fi
|
|
}
|
|
|
|
# Uninstall each config
|
|
echo "Uninstalling dotfiles..."
|
|
uninstall_config "fish"
|
|
uninstall_config "mc"
|
|
uninstall_config "nvim"
|
|
uninstall_config "kitty"
|
|
|
|
# Uninstall starship.toml
|
|
if [ -L "$CONFIG_DIR/starship.toml" ]; then
|
|
echo "Removing starship.toml symlink"
|
|
rm "$CONFIG_DIR/starship.toml"
|
|
|
|
# Restore backup if it exists
|
|
if [ -e "${CONFIG_DIR}/starship.toml.bak" ]; then
|
|
echo "Restoring starship.toml backup from ${CONFIG_DIR}/starship.toml.bak"
|
|
mv "${CONFIG_DIR}/starship.toml.bak" "$CONFIG_DIR/starship.toml"
|
|
fi
|
|
elif [ -e "$CONFIG_DIR/starship.toml" ]; then
|
|
echo "starship.toml is not a symlink, skipping"
|
|
else
|
|
echo "starship.toml not found, skipping"
|
|
fi
|
|
|
|
echo "Dotfiles uninstallation complete!"
|