From 49832a989fbfd4fe930da8b17493c77601d5a8b4 Mon Sep 17 00:00:00 2001 From: Cutieguwu Date: Sun, 12 Apr 2026 09:21:02 -0400 Subject: [PATCH] Many hotfixes... --- manjaro2archcachy.sh | 46 ++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 17 deletions(-) mode change 100755 => 100644 manjaro2archcachy.sh diff --git a/manjaro2archcachy.sh b/manjaro2archcachy.sh old mode 100755 new mode 100644 index 5ae3c1c..ad2a25e --- a/manjaro2archcachy.sh +++ b/manjaro2archcachy.sh @@ -31,6 +31,8 @@ RED="\e[31m" GREEN="\e[32m" ERASE='\033[0m' +USERNAME=$(logname) + run_unprivileged() { sudo -u "$USERNAME" "$@" } @@ -44,10 +46,11 @@ is_installed() { assert() { if ! $1; then echo "Script depends on $2 to function, please resolve manually." + exit 1 fi # Yes, this is always true, but anyway. - return $1 + return 0 } # Credit to NaN on StackOverflow for this solution. @@ -78,6 +81,29 @@ if [[ $(id -u) > 0 ]]; then exit 1 fi +# Needs to be this funky to avoid fetching ase, base-devel, and filesystem. +# For some reason, pacman -Qqs "manjaro" will do that. +log "Checking for soon-to-be Manjaro orphans..." +deps_remove=( + $(pacman -Qqs "manjaro-") + $(pacman -Qqs "\-manjaro") + pacman-mirrors +) +printf "Found:\n${deps_remove[@]}\n" + +log "Checking for Pamac..." +deps_pamac=$(pacman -Qqs pamac) +deps_remove+=($deps_pamac) +printf "Found:\n${deps_pamac[@]}\n" + +log "Checking for mhwd..." +deps_mhwd=$(pacman -Qqs mhwd) +deps_remove+=($deps_mhwd) +printf "Found:\n${deps_mhwd[@]}\n" + +log "Removing old packages and Manjaro orphans..." +pacman -Rdd "${deps_remove[@]}" + log "Checking for reflector..." if ! is_installed reflector; then pacman -S yay @@ -167,10 +193,6 @@ deps_install=( "protonup-qt" "proton-cachyos-slr" ) -deps_remove=( - "manjaro-release" - "mhwd" -) log "Checking for KDE..." if [[ $(echo $XDG_CURRENT_DESKTOP | grep -i "kde") ]]; then @@ -182,18 +204,6 @@ if [[ $(echo $XDG_CURRENT_DESKTOP | grep -i "kde") ]]; then fi fi -log "Checking for Pamac..." -if [[ $(is_installed pamac-manager) || $(is_installed pamac) ]]; then - prompt_bool "Uninstall Pamac?" true - if [[ $? ]]; then - # TODO: Uninstall pamac deps. - echo -e "${RED}Not implemented!" - fi -fi - -log "Removing old packages and Manjaro orphans..." -pacman -R ${deps_remove[@]} - log "Fetching all system packages to replace with CachyOS+Arch packages..." # Credit to https://insrt.uk/post/pacman-reinstall for this solution. deps_install+=($(comm -12 <(pacman -Slq | sort -u) <(pacman -Qq | sort -u))) @@ -201,6 +211,8 @@ deps_install+=($(comm -12 <(pacman -Slq | sort -u) <(pacman -Qq | sort -u))) log "Installing new packages..." pacman -Sdd ${deps_install[@]} +chwd --autoconfigure + log "Done." echo "Quick reminder: Be prepared to fix things!" echo "Many orphaned packages will still exist on the system, and should be"