updated uninstall.sh
This commit is contained in:
68
uninstall.sh
68
uninstall.sh
@@ -32,14 +32,11 @@ printf "\n%.0s" {1..1}
|
|||||||
whiptail --title "Arch-Hyprland KooL Dots Uninstall Script" --yesno \
|
whiptail --title "Arch-Hyprland KooL Dots Uninstall Script" --yesno \
|
||||||
"Hello! This script will uninstall KooL Hyprland packages and configs.
|
"Hello! This script will uninstall KooL Hyprland packages and configs.
|
||||||
|
|
||||||
|
|
||||||
You can choose packages and directories you want to remove.
|
You can choose packages and directories you want to remove.
|
||||||
NOTE: This will remove configs from ~/.config
|
NOTE: This will remove configs from ~/.config
|
||||||
|
|
||||||
|
|
||||||
WARNING: After uninstallation, your system may become unstable.
|
WARNING: After uninstallation, your system may become unstable.
|
||||||
|
|
||||||
|
|
||||||
Shall we Proceed?" 20 80
|
Shall we Proceed?" 20 80
|
||||||
|
|
||||||
# Check if the user confirmed to proceed
|
# Check if the user confirmed to proceed
|
||||||
@@ -52,7 +49,7 @@ fi
|
|||||||
remove_packages() {
|
remove_packages() {
|
||||||
local selected_packages=($1)
|
local selected_packages=($1)
|
||||||
for package in "${selected_packages[@]}"; do
|
for package in "${selected_packages[@]}"; do
|
||||||
package=$(echo "$package" | tr -d '"') # Remove extra quotes
|
package=$(echo "$package" | tr -d '"')
|
||||||
if pacman -Qi "$package" &> /dev/null; then
|
if pacman -Qi "$package" &> /dev/null; then
|
||||||
echo "Removing package: $package"
|
echo "Removing package: $package"
|
||||||
if ! sudo pacman -Rsc --noconfirm "$package"; then
|
if ! sudo pacman -Rsc --noconfirm "$package"; then
|
||||||
@@ -70,7 +67,7 @@ remove_packages() {
|
|||||||
remove_directories() {
|
remove_directories() {
|
||||||
local selected_dirs=($1)
|
local selected_dirs=($1)
|
||||||
for dir in "${selected_dirs[@]}"; do
|
for dir in "${selected_dirs[@]}"; do
|
||||||
dir=$(echo "$dir" | tr -d '"') # Remove extra quotes
|
dir=$(echo "$dir" | tr -d '"')
|
||||||
if [ -d "$HOME/.config/$dir" ]; then
|
if [ -d "$HOME/.config/$dir" ]; then
|
||||||
echo "Removing directory: $HOME/.config/$dir"
|
echo "Removing directory: $HOME/.config/$dir"
|
||||||
if ! rm -rf "$HOME/.config/$dir"; then
|
if ! rm -rf "$HOME/.config/$dir"; then
|
||||||
@@ -157,52 +154,55 @@ directories=(
|
|||||||
"wlogout" "wlogout (logout menu) configuration" "off"
|
"wlogout" "wlogout (logout menu) configuration" "off"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Use whiptail to choose packages to remove
|
# Loop for package selection until user selects something or cancels
|
||||||
package_choices=$(whiptail --title "Select Packages to Uninstall" --checklist \
|
while true; do
|
||||||
"Select the packages you want to remove\nNOTE: 'SPACEBAR' to select & 'TAB' key to change selection" 35 90 25 \
|
package_choices=$(whiptail --title "Select Packages to Uninstall" --checklist \
|
||||||
"${packages[@]}" 3>&1 1>&2 2>&3)
|
"Select the packages you want to remove\nNOTE: 'SPACEBAR' to select & 'TAB' key to change selection" 35 90 25 \
|
||||||
|
"${packages[@]}" 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
# Check if the user canceled the operation
|
# Check if the user canceled the operation
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
echo "Operation canceled."
|
echo "$INFO uninstall process canceled."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Debugging output: Check what was selected
|
# If no packages are selected, ask again
|
||||||
echo "Selected packages: '$package_choices'" # Debugging line
|
if [[ -z "$package_choices" ]]; then
|
||||||
|
echo "$NOTE No packages selected. Please select at least one package."
|
||||||
# Check if the selected packages are empty or not
|
else
|
||||||
if [[ -z "$package_choices" ]]; then
|
|
||||||
echo "No packages selected."
|
|
||||||
else
|
|
||||||
# Convert the selected package list into an array and clean up quotes
|
# Convert the selected package list into an array and clean up quotes
|
||||||
IFS=" " read -r -a selected_packages <<< "$package_choices"
|
IFS=" " read -r -a selected_packages <<< "$package_choices"
|
||||||
selected_packages=($(echo "${selected_packages[@]}" | tr -d '"'))
|
selected_packages=($(echo "${selected_packages[@]}" | tr -d '"'))
|
||||||
echo "Packages to remove: ${selected_packages[@]}"
|
echo "Packages to remove: ${selected_packages[@]}"
|
||||||
fi
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Use whiptail to choose directories to remove
|
# Loop for directory selection until user selects something or cancels
|
||||||
dir_choices=$(whiptail --title "Select Directories to Remove" --checklist \
|
while true; do
|
||||||
"Select the directories you want to remove\nNOTE: This will remove configs from ~/.config\n\nNOTE: 'SPACEBAR' to select & 'TAB' key to change selection" 28 90 18 \
|
dir_choices=$(whiptail --title "Select Directories to Remove" --checklist \
|
||||||
"${directories[@]}" 3>&1 1>&2 2>&3)
|
"Select the directories you want to remove\nNOTE: This will remove configs from ~/.config\n\nNOTE: 'SPACEBAR' to select & 'TAB' key to change selection" 28 90 18 \
|
||||||
|
"${directories[@]}" 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
# Check if the user canceled the operation
|
# Check if the user canceled the operation
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
echo "$INFO uninstall process canceled."
|
echo "$INFO uninstall process canceled."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Selected directories: '$dir_choices'"
|
echo "Selected directories: '$dir_choices'"
|
||||||
|
|
||||||
# Check if the selected directories are empty or not
|
# If no directories are selected, ask again
|
||||||
if [[ -z "$dir_choices" ]]; then
|
if [[ -z "$dir_choices" ]]; then
|
||||||
echo "$NOTE No directories selected."
|
echo "$NOTE No directories selected. Please select at least one directory."
|
||||||
else
|
else
|
||||||
# Convert the selected directories list into an array and clean up quotes
|
# Convert the selected directories list into an array and clean up quotes
|
||||||
IFS=" " read -r -a selected_dirs <<< "$dir_choices"
|
IFS=" " read -r -a selected_dirs <<< "$dir_choices"
|
||||||
selected_dirs=($(echo "${selected_dirs[@]}" | tr -d '"'))
|
selected_dirs=($(echo "${selected_dirs[@]}" | tr -d '"'))
|
||||||
echo "Directories to remove: ${selected_dirs[@]}"
|
echo "Directories to remove: ${selected_dirs[@]}"
|
||||||
fi
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# First confirmation - Warning about potential instability
|
# First confirmation - Warning about potential instability
|
||||||
if ! whiptail --title "Warning" --yesno \
|
if ! whiptail --title "Warning" --yesno \
|
||||||
|
|||||||
Reference in New Issue
Block a user