Quick fix for #581

This commit is contained in:
clsty
2024-06-05 18:30:05 +08:00
parent 9eaf715666
commit 742af70af7
4 changed files with 424 additions and 75 deletions
+29 -72
View File
@@ -1,7 +1,6 @@
#!/usr/bin/env bash
cd "$(dirname "$0")"
export base="$(pwd)"
source ./scriptdata/environment-variables
source ./scriptdata/functions
source ./scriptdata/installers
source ./scriptdata/options
@@ -14,7 +13,7 @@ printf "\e[34m[$0]: Hi there! Before we start:\n"
printf 'This script 1. only works for ArchLinux and Arch-based distros.\n'
printf ' 2. does not handle system-level/hardware stuff like Nvidia drivers\n'
printf "\e[31m"
printf "Please CONFIRM that you HAVE ALREADY BACKED UP \"$XDG_CONFIG_HOME\" and \"$HOME/.local/\" folders!\n"
printf "Please CONFIRM that you HAVE ALREADY BACKED UP \"$HOME/.config/\" and \"$HOME/.local/\" folders!\n"
printf "\e[0m"
printf "Enter capital \"YES\" (without quotes) to continue:"
read -p " " p
@@ -81,45 +80,12 @@ if ! command -v yay >/dev/null 2>&1;then
else AUR_HELPER=yay
fi
# Install extra packages from dependencies.conf as declared by the user
if (( ${#pkglist[@]} != 0 )); then
if $ask; then
# execute per element of the array $pkglist
for i in "${pkglist[@]}";do v $AUR_HELPER -S --needed $i;done
else
# execute for all elements of the array $pkglist in one line
v $AUR_HELPER -S --needed --noconfirm ${pkglist[*]}
fi
fi
# Convert old dependencies to non explicit dependencies so that they can be orphaned if not in meta packages
set-explicit-to-implicit() {
remove_bashcomments_emptylines ./scriptdata/previous_dependencies.conf ./cache/old_deps_stripped.conf
readarray -t old_deps_list < ./cache/old_deps_stripped.conf
pacman -Qeq > ./cache/pacman_explicit_packages
readarray -t explicitly_installed < ./cache/pacman_explicit_packages
echo "Attempting to set previously explicitly installed deps as implicit..."
for i in "${explicitly_installed[@]}"; do for j in "${old_deps_list[@]}"; do
[ "$i" = "$j" ] && $AUR_HELPER -D --asdeps "$i"
done; done
return 0
}
$ask && echo "Attempt to set previously explicitly installed deps as implicit? "
$ask && showfun set-explicit-to-implicit
v set-explicit-to-implicit
# Install core dependencies from the meta-packages
metapkgs=(arch-packages/illogical-impulse-{audio,backlight,basic,fonts-themes,gnome,gtk,microtex,portal,python,screencapture,widgets})
if $ask; then
# execute for every meta package
for i in "${metapkgs[@]}";do v $AUR_HELPER -Bi --needed --answerclean=n $i;done
if $ask;then
# execute per element of the array $pkglist
for i in "${pkglist[@]}";do v $AUR_HELPER -S --needed $i;done
else
# execute for all meta packages at once
v $AUR_HELPER -Bi --needed --answerclean=n --noconfirm ${metapkgs[@]}
# execute for all elements of the array $pkglist in one line
v $AUR_HELPER -S --needed --noconfirm ${pkglist[*]}
fi
@@ -135,18 +101,6 @@ case $SKIP_HYPR_AUR in
;;
esac
install-pymyc-aur() {
# Yay is bugged and destroys the PKGBUILD if you specify to cleanBuild with the -Bi flag, so we install the deps manually.
# If we install the deps using --asdeps we can remove them recursively by removing the metapackage.
installflags="-S --answerclean=a --asdeps"
$ask || installflags="$installflags --noconfirm"
$AUR_HELPER $installflags ${pymyc[@]}
pushd arch-packages/illogical-impulse-pymyc-aur
makepkg -si
popd
}
# https://github.com/end-4/dots-hyprland/issues/428#issuecomment-2081690658
# https://github.com/end-4/dots-hyprland/issues/428#issuecomment-2081701482
# https://github.com/end-4/dots-hyprland/issues/428#issuecomment-2081707099
@@ -154,8 +108,11 @@ pymyc=(python-materialyoucolor-git gradience-git python-libsass python-material-
case $SKIP_PYMYC_AUR in
true) sleep 0;;
*)
$ask && showfun install-pymyc-aur
v install-pymyc-aur
if $ask;then
v $AUR_HELPER -S --answerclean=a ${pymyc[@]}
else
v $AUR_HELPER -S --answerclean=a --noconfirm ${pymyc[@]}
fi
;;
esac
@@ -244,7 +201,7 @@ if $ask_MicroTeX;then showfun install-MicroTeX;v install-MicroTeX;fi
printf "\e[36m[$0]: 3. Copying + Configuring\e[0m\n"
# In case some folders does not exists
v mkdir -p $XDG_BIN_HOME $XDG_CACHE_HOME $XDG_CONFIG_HOME $XDG_DATA_HOME
v mkdir -p "$HOME"/.{config,cache,local/{bin,share}}
# `--delete' for rsync to make sure that
# original dotfiles and new ones in the SAME DIRECTORY
@@ -255,10 +212,10 @@ case $SKIP_MISCCONF in
true) sleep 0;;
*)
for i in $(find .config/ -mindepth 1 -maxdepth 1 ! -name 'ags' ! -name 'fish' ! -name 'hypr' -exec basename {} \;); do
# i=".config/$i"
echo "[$0]: Found target: .config/$i"
if [ -d ".config/$i" ];then v rsync -av --delete ".config/$i/" "$XDG_CONFIG_HOME/$i/"
elif [ -f ".config/$i" ];then v rsync -av ".config/$i" "$XDG_CONFIG_HOME/$i"
i=".config/$i"
echo "[$0]: Found target: $i"
if [ -d "$i" ];then v rsync -av --delete "$i/" "$HOME/$i/"
elif [ -f "$i" ];then v rsync -av "$i" "$HOME/$i"
fi
done
;;
@@ -267,7 +224,7 @@ esac
case $SKIP_FISH in
true) sleep 0;;
*)
v rsync -av --delete .config/fish/ "$XDG_CONFIG_HOME"/fish/
v rsync -av --delete .config/fish/ "$HOME"/.config/fish/
;;
esac
@@ -275,8 +232,8 @@ esac
case $SKIP_AGS in
true) sleep 0;;
*)
v rsync -av --delete --exclude '/user_options.js' .config/ags/ "$XDG_CONFIG_HOME"/ags/
t="$XDG_CONFIG_HOME/ags/user_options.js"
v rsync -av --delete --exclude '/user_options.js' .config/ags/ "$HOME"/.config/ags/
t="$HOME/.config/ags/user_options.js"
if [ -f $t ];then
echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m"
# v cp -f .config/ags/user_options.js $t.new
@@ -293,8 +250,8 @@ esac
case $SKIP_HYPRLAND in
true) sleep 0;;
*)
v rsync -av --delete --exclude '/custom' --exclude '/hyprland.conf' .config/hypr/ "$XDG_CONFIG_HOME"/hypr/
t="$XDG_CONFIG_HOME/hypr/hyprland.conf"
v rsync -av --delete --exclude '/custom' --exclude '/hyprland.conf' .config/hypr/ "$HOME"/.config/hypr/
t="$HOME/.config/hypr/hyprland.conf"
if [ -f $t ];then
echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m"
v cp -f .config/hypr/hyprland.conf $t.new
@@ -304,7 +261,7 @@ case $SKIP_HYPRLAND in
v cp .config/hypr/hyprland.conf $t
existed_hypr_conf=n
fi
t="$XDG_CONFIG_HOME/hypr/custom"
t="$HOME/.config/hypr/custom"
if [ -d $t ];then
echo -e "\e[34m[$0]: \"$t\" already exists, will not do anything.\e[0m"
else
@@ -317,7 +274,7 @@ esac
# some foldes (eg. .local/bin) should be processed separately to avoid `--delete' for rsync,
# since the files here come from different places, not only about one program.
v rsync -av ".local/bin/" "$XDG_BIN_HOME"
v rsync -av ".local/bin/" "$HOME/.local/bin/"
# Dark mode by default
v gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
@@ -327,7 +284,7 @@ sleep 1
try hyprctl reload
existed_zsh_conf=n
grep -q 'source ${XDG_CONFIG_HOME:-~/.config}/zshrc.d/dots-hyprland.zsh' ~/.zshrc && existed_zsh_conf=y
grep -q 'source ~/.config/zshrc.d/dots-hyprland.zsh' ~/.zshrc && existed_zsh_conf=y
#####################################################################################
printf "\e[36m[$0]: Finished. See the \"Import Manually\" folder and grab anything you need.\e[0m\n"
@@ -342,11 +299,11 @@ printf "\e[36mPress \e[30m\e[46m Super+/ \e[0m\e[36m for a list of keybinds\e[0m
printf "\n"
case $existed_ags_opt in
y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/ags/user_options.js\" already existed before and we didn't overwrite it. \e[0m\n"
# printf "\e[33mPlease use \"$XDG_CONFIG_HOME/ags/user_options.js.new\" as a reference for a proper format.\e[0m\n"
y) printf "\n\e[33m[$0]: Warning: \"~/.config/ags/user_options.js\" already existed before and we didn't overwrite it. \e[0m\n"
# printf "\e[33mPlease use \"~/.config/ags/user_options.js.new\" as a reference for a proper format.\e[0m\n"
;;esac
case $existed_hypr_conf in
y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hyprland.conf\" already existed before and we didn't overwrite it. \e[0m\n"
printf "\e[33mPlease use \"$XDG_CONFIG_HOME/hypr/hyprland.conf.new\" as a reference for a proper format.\e[0m\n"
printf "\e[33mIf this is your first time installation, you must overwrite \"$XDG_CONFIG_HOME/hypr/hyprland.conf\" with \"$XDG_CONFIG_HOME/hypr/hyprland.conf.new\".\e[0m\n"
y) printf "\n\e[33m[$0]: Warning: \"~/.config/hypr/hyprland.conf\" already existed before and we didn't overwrite it. \e[0m\n"
printf "\e[33mPlease use \"~/.config/hypr/hyprland.conf.new\" as a reference for a proper format.\e[0m\n"
printf "\e[33mIf this is your first time installation, you must overwrite \"~/.config/hypr/hyprland.conf\" with \"~/.config/hypr/hyprland.conf.new\".\e[0m\n"
;;esac