mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 14:59:27 -05:00
Rework uninstall
Comment on Discussion When sdata/dist-arch/ Changes / comment_on_discussion (push) Waiting to run
Comment on Discussion When sdata/dist-arch/ Changes / comment_on_discussion (push) Waiting to run
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
# This script is meant to be sourced.
|
||||||
|
# It's not for directly running.
|
||||||
|
|
||||||
|
for i in illogical-impulse-{quickshell-git,audio,backlight,basic,bibata-modern-classic-bin,fonts-themes,hyprland,kde,microtex-git,oneui4-icons-git,portal,python,screencapture,toolkit,widgets} plasma-browser-integration; do
|
||||||
|
v yay -Rns $i
|
||||||
|
done
|
||||||
@@ -4,9 +4,6 @@ XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}
|
|||||||
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
|
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
|
||||||
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
|
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
|
||||||
XDG_STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state}
|
XDG_STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state}
|
||||||
BACKUP_DIR=${BACKUP_DIR:-$HOME/ii-original-dots-backup}
|
|
||||||
INSTALLED_LISTFILE=${INSTALLED_LISTFILE:-$XDG_CONFIG_HOME/illogical-impulse/installed_listfile}
|
|
||||||
|
|
||||||
|
|
||||||
STY_RED='\e[31m'
|
STY_RED='\e[31m'
|
||||||
STY_GREEN='\e[32m'
|
STY_GREEN='\e[32m'
|
||||||
@@ -23,8 +20,11 @@ STY_BLINK='\e[5m'
|
|||||||
STY_INVERT='\e[7m'
|
STY_INVERT='\e[7m'
|
||||||
STY_RST='\e[00m'
|
STY_RST='\e[00m'
|
||||||
|
|
||||||
|
|
||||||
# Used by register_temp_file()
|
# Used by register_temp_file()
|
||||||
declare -a TEMP_FILES_TO_CLEANUP=()
|
declare -a TEMP_FILES_TO_CLEANUP=()
|
||||||
|
|
||||||
FIRSTRUN_FILE="${XDG_CACHE_HOME}/.ii-qs-installed"
|
# Used by install script
|
||||||
|
BACKUP_DIR="${BACKUP_DIR:-$HOME/ii-original-dots-backup}"
|
||||||
|
DOTS_CORE_CONFDIR="${XDG_CONFIG_HOME}/illogical-impulse"
|
||||||
|
INSTALLED_LISTFILE="${DOTS_CORE_CONFDIR}/installed_listfile"
|
||||||
|
FIRSTRUN_FILE="${DOTS_CORE_CONFDIR}/installed_true"
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
# This script is meant to be sourced.
|
|
||||||
# It's not for directly running.
|
|
||||||
|
|
||||||
# shellcheck shell=bash
|
|
||||||
|
|
||||||
printf 'Hi there!\n'
|
|
||||||
printf 'This script 1. will uninstall [end-4/dots-hyprland > illogical-impulse] dotfiles\n'
|
|
||||||
printf ' 2. will try to revert *mostly everything* installed using "./setup install", so it'\''s pretty destructive\n'
|
|
||||||
printf ' 3. has not been tested, use at your own risk.\n'
|
|
||||||
printf ' 4. will show all commands that it runs.\n'
|
|
||||||
printf 'Ctrl+C to exit. Enter to continue.\n'
|
|
||||||
read -r
|
|
||||||
##############################################################################################################################
|
|
||||||
|
|
||||||
# Undo Step 3: Removing copied config and local folders
|
|
||||||
printf "${STY_CYAN}Removing copied config and local folders...\n${STY_RST}"
|
|
||||||
|
|
||||||
dirs=(
|
|
||||||
Kvantum/
|
|
||||||
fish/
|
|
||||||
fontconfig/
|
|
||||||
foot/
|
|
||||||
fuzzel/
|
|
||||||
hypr/
|
|
||||||
kde-material-you-colors/
|
|
||||||
kitty/
|
|
||||||
matugen/
|
|
||||||
mpv/
|
|
||||||
qt5ct/
|
|
||||||
qt6ct/
|
|
||||||
quickshell/
|
|
||||||
wlogout/
|
|
||||||
xdg-desktop-portal/
|
|
||||||
zshrc.d/
|
|
||||||
chrome-flags.conf
|
|
||||||
code-flags.conf
|
|
||||||
darklyrc
|
|
||||||
dolphinrc
|
|
||||||
kdeglobals
|
|
||||||
konsolerc
|
|
||||||
starship.toml
|
|
||||||
thorium-flags.conf
|
|
||||||
)
|
|
||||||
|
|
||||||
for i in "${dirs[@]}"
|
|
||||||
do v rm -rf "$XDG_CONFIG_HOME/$i"
|
|
||||||
done
|
|
||||||
|
|
||||||
for i in "glib-2.0/schemas/com.github.GradienceTeam.Gradience.Devel.gschema.xml" "gradience"
|
|
||||||
do v rm -rf "$XDG_DATA_HOME/$i"
|
|
||||||
done
|
|
||||||
v rm -rf "$XDG_CACHE_HOME/quickshell"
|
|
||||||
v sudo rm -rf "$XDG_STATE_HOME/quickshell"
|
|
||||||
|
|
||||||
##############################################################################################################################
|
|
||||||
|
|
||||||
# Undo Step 2: Uninstall AGS - Disabled for now, check issues
|
|
||||||
# echo 'Uninstalling AGS...'
|
|
||||||
# sudo meson uninstall -C ~/ags/build
|
|
||||||
# rm -rf ~/ags
|
|
||||||
|
|
||||||
##############################################################################################################################
|
|
||||||
|
|
||||||
# Undo Step 1: Remove added user from video, i2c, and input groups and remove yay packages
|
|
||||||
printf "${STY_CYAN}Removing user from video, i2c, and input groups and removing packages...\n${STY_RST}"
|
|
||||||
user=$(whoami)
|
|
||||||
v sudo gpasswd -d "$user" video
|
|
||||||
v sudo gpasswd -d "$user" i2c
|
|
||||||
v sudo gpasswd -d "$user" input
|
|
||||||
v sudo rm /etc/modules-load.d/i2c-dev.conf
|
|
||||||
|
|
||||||
##############################################################################################################################
|
|
||||||
read -p "Do you want to uninstall the illogical-impulse-* meta packages (Arch Linux only)?
|
|
||||||
Ctrl+C to exit, or press Enter to proceed" p
|
|
||||||
|
|
||||||
# Removing installed yay packages and dependencies
|
|
||||||
v yay -Rns illogical-impulse-{audio,backlight,basic,bibata-modern-classic-bin,fonts-themes,hyprland,kde,microtex-git,oneui4-icons-git,portal,python,screencapture,toolkit,widgets} plasma-browser-integration
|
|
||||||
|
|
||||||
printf "${STY_CYAN}Uninstall Complete.\n${STY_RST}"
|
|
||||||
printf "${STY_CYAN}Hint: If you had agreed to backup when you ran \"./setup install\", you should be able to find it under \"$BACKUP_DIR\".\n${STY_RST}"
|
|
||||||
@@ -120,7 +120,7 @@ case "${SKIP_MISCCONF}" in
|
|||||||
elif [ -f "dots/.config/$i" ];then install_file "dots/.config/$i" "$XDG_CONFIG_HOME/$i"
|
elif [ -f "dots/.config/$i" ];then install_file "dots/.config/$i" "$XDG_CONFIG_HOME/$i"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
install_dir "dots/.local/share/konsole" "${XDG_DATA_HOME:-$HOME/.local/share}"/konsole
|
install_dir "dots/.local/share/konsole" "${XDG_DATA_HOME}"/konsole
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,135 @@
|
|||||||
|
# This script is meant to be sourced.
|
||||||
|
# It's not for directly running.
|
||||||
|
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
printf "${STY_RED}"
|
||||||
|
printf "===CAUTION===\n"
|
||||||
|
printf "This script will try to revert changes made by \"./setup install\".\n"
|
||||||
|
printf "However:\n"
|
||||||
|
printf "1. It is far from enough to precisely revert all changes.\n"
|
||||||
|
printf "2. It has not been fully tested, use at your own risk.\n"
|
||||||
|
printf "${STY_RST}"
|
||||||
|
pause
|
||||||
|
##############################################################################################################################
|
||||||
|
|
||||||
|
# Undo Step 3
|
||||||
|
printf "${STY_CYAN}Undo install step 3...\n${STY_RST}"
|
||||||
|
|
||||||
|
function view_listfile(){
|
||||||
|
local listfile="$1"
|
||||||
|
if command -v less >/dev/null; then
|
||||||
|
less "$listfile"
|
||||||
|
else
|
||||||
|
cat "$listfile"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function edit_listfile(){
|
||||||
|
local listfile="$1"
|
||||||
|
for ed in "$EDITOR" nano vim nvim vi; do
|
||||||
|
if command -v $ed >/dev/null; then
|
||||||
|
x $ed "$listfile"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
printf "Failed to find an available editor, please manually edit \"$listfile\".\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete_targets(){
|
||||||
|
local listfile="$1"
|
||||||
|
local targets=()
|
||||||
|
readarray -t targets < "$listfile"
|
||||||
|
for path in "${targets[@]}"; do
|
||||||
|
if [[ ! -e "$path" ]]; then
|
||||||
|
printf "${STY_YELLOW}Target \"$path\" inexists, skipping...${STY_RST}\n"
|
||||||
|
continue
|
||||||
|
elif [[ "$path" == "$HOME"* ]]; then
|
||||||
|
x rm -- "$path"
|
||||||
|
else
|
||||||
|
while true; do
|
||||||
|
printf "WARNING: Target \"$path\" is not under \$HOME. Still delete it?\ny=Yes, delete it;\nn=No, skip this one\n"
|
||||||
|
read -n1 -p "> " ans < /dev/tty
|
||||||
|
echo
|
||||||
|
case "$ans" in
|
||||||
|
y|Y)
|
||||||
|
x rm -- "$path"
|
||||||
|
break 1
|
||||||
|
;;
|
||||||
|
n|N)
|
||||||
|
break 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function deletion_prompt(){
|
||||||
|
local listfile="$1"
|
||||||
|
while true; do
|
||||||
|
printf "Every target which path as a line inside the list \"$listfile\" will be deleted permanently.\n"
|
||||||
|
printf "Please choose:\nv=View the list\ne=Edit the list\nq=Quit\ny=Perform deletion now\n"
|
||||||
|
read -n1 -p "> " choice
|
||||||
|
echo
|
||||||
|
case "$choice" in
|
||||||
|
q|Q)
|
||||||
|
printf "Quiting...\n"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
y|Y)
|
||||||
|
delete_targets "$listfile"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
v|V)
|
||||||
|
view_listfile "$listfile"
|
||||||
|
;;
|
||||||
|
e|E)
|
||||||
|
edit_listfile "$listfile"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
deletion_prompt "${INSTALLED_LISTFILE}"
|
||||||
|
|
||||||
|
empty_dir_listfile=$(mktemp)
|
||||||
|
scan_paths=(${XDG_CONFIG_HOME} "${XDG_DATA_HOME}"/konsole)
|
||||||
|
for dir in "${scan_paths[@]}"; do
|
||||||
|
find "$dir" -type d -empty -print >> $empty_dir_listfile
|
||||||
|
done
|
||||||
|
x dedup_and_sort_listfile "$empty_dir_listfile" "$empty_dir_listfile"
|
||||||
|
deletion_prompt "$empty_dir_listfile"
|
||||||
|
|
||||||
|
##############################################################################################################################
|
||||||
|
|
||||||
|
printf "${STY_CYAN}Undo install step 2...\n${STY_RST}"
|
||||||
|
user=$(whoami)
|
||||||
|
warn_undo_break_system(){
|
||||||
|
printf "${STY_YELLOW}WARNING: The command below could break your system functionality. If you are unsure about it, just skip the command.${STY_RST}\n"
|
||||||
|
}
|
||||||
|
warn_undo_break_system
|
||||||
|
v sudo gpasswd -d "$user" video
|
||||||
|
warn_undo_break_system
|
||||||
|
v sudo gpasswd -d "$user" i2c
|
||||||
|
warn_undo_break_system
|
||||||
|
v sudo gpasswd -d "$user" input
|
||||||
|
warn_undo_break_system
|
||||||
|
v sudo rm /etc/modules-load.d/i2c-dev.conf
|
||||||
|
|
||||||
|
##############################################################################################################################
|
||||||
|
|
||||||
|
printf "${STY_CYAN}Undo install step 1...\n${STY_RST}"
|
||||||
|
|
||||||
|
if test -f sdata/dist-$OS_GROUP_ID/uninstall-deps.sh; then
|
||||||
|
source sdata/dist-$OS_GROUP_ID/uninstall-deps.sh
|
||||||
|
else
|
||||||
|
printf "${STY_YELLOW}Automatic depedencies uninstallation is not yet avaible for your distro. Skipping...${STY_RST}\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "${STY_CYAN}Uninstall script finished.\n${STY_RST}"
|
||||||
|
printf "${STY_CYAN}Hint: If you had agreed to backup when you ran \"./setup install\", you should be able to find it under \"$BACKUP_DIR\".\n${STY_RST}"
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
# Handle args for subcmd: exp-uninstall
|
# Handle args for subcmd: uninstall
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
showhelp(){
|
showhelp(){
|
||||||
echo -e "Syntax: $0 exp-uninstall [OPTIONS]...
|
echo -e "Syntax: $0 uninstall [OPTIONS]...
|
||||||
|
|
||||||
Experimental unintallation.
|
Unintall dots.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-h, --help Show this help message
|
-h, --help Show this help message
|
||||||
@@ -15,7 +15,7 @@ showhelp_global(){
|
|||||||
printf "${STY_CYAN}NOTE:
|
printf "${STY_CYAN}NOTE:
|
||||||
The old \"./install.sh\" is now \"./setup install\"
|
The old \"./install.sh\" is now \"./setup install\"
|
||||||
The old \"./update.sh\" is now \"./setup exp-update\"
|
The old \"./update.sh\" is now \"./setup exp-update\"
|
||||||
The old \"./uninstall.sh\" is now \"./setup exp-uninstall\"${STY_RST}
|
The old \"./uninstall.sh\" is now \"./setup uninstall\"${STY_RST}
|
||||||
|
|
||||||
[$0]: Handle setup for illogical-impulse.
|
[$0]: Handle setup for illogical-impulse.
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ Subcommands:
|
|||||||
install-files Run the install step \"3. Copying config files\"
|
install-files Run the install step \"3. Copying config files\"
|
||||||
resetfirstrun Reset firstrun state.
|
resetfirstrun Reset firstrun state.
|
||||||
|
|
||||||
exp-uninstall (Experimental) Uninstall illogical-impulse.
|
uninstall Uninstall illogical-impulse.
|
||||||
exp-update (Experimental) Update illogical-impulse without fully reinstall.
|
exp-update (Experimental) Update illogical-impulse without fully reinstall.
|
||||||
exp-update-old (Experimental) exp-update but use behaves like old version.
|
exp-update-old (Experimental) exp-update but use behaves like old version.
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ case $1 in
|
|||||||
# Global help
|
# Global help
|
||||||
""|help|--help|-h)showhelp_global;exit;;
|
""|help|--help|-h)showhelp_global;exit;;
|
||||||
# Correct subcommand
|
# Correct subcommand
|
||||||
install|exp-uninstall|exp-update|exp-update-old|resetfirstrun|checkdeps|virtmon)
|
install|uninstall|exp-update|exp-update-old|resetfirstrun|checkdeps|virtmon)
|
||||||
SUBCMD_NAME=$1
|
SUBCMD_NAME=$1
|
||||||
SUBCMD_DIR=./sdata/subcmd-$1
|
SUBCMD_DIR=./sdata/subcmd-$1
|
||||||
shift;;
|
shift;;
|
||||||
|
|||||||
Reference in New Issue
Block a user