setup fixes and correct pwd var

This commit is contained in:
nevaforget 2024-04-03 13:46:27 +02:00
parent ccd1408417
commit 1df528665f

119
setup.sh
View File

@ -23,12 +23,11 @@ set -e
function pkg_inst () { function pkg_inst () {
log "Checking if $1 is installed..." log "Checking if $1 is installed..."
IS_INSTALLED=$(pacman -Q | grep $1) if pacman -Qs $1; then
if [[ -z "$IS_INSTALLED" ]]; then log "Found $IS_INSTALLED ...skipping"
else
log "$1 not found. Installing..." log "$1 not found. Installing..."
paru -S $1 2>&1 | tee -a $LOG paru -S $1 2>&1 | tee -a $LOG
else
log "Found $IS_INSTALLED ...skipping"
fi fi
} }
@ -66,16 +65,16 @@ function inst_configs {
if [[ $confirm_configs == "Y" ]]; if [[ $confirm_configs == "Y" ]];
then then
cp -Rf $MOONARCH_DIR/home/config/alacritty $HOME/.config/alacritty cp -Rf $MONARCHOS_DIR/home/config/alacritty $HOME/.config/alacritty
chown $USER:$USER $HOME/.config/alacritty chown $USER:$USER $HOME/.config/alacritty
cp -Rf $MOONARCH_DIR/home/config/dunst $HOME/.config/dunst cp -Rf $MONARCHOS_DIR/home/config/dunst $HOME/.config/dunst
chown $USER:$USER $HOME/.config/dunst chown $USER:$USER $HOME/.config/dunst
cp -Rf $MOONARCH_DIR/home/config/btop $HOME/.config/btop cp -Rf $MONARCHOS_DIR/home/config/btop $HOME/.config/btop
chown $USER:$USER $HOME/.config/btop chown $USER:$USER $HOME/.config/btop
cp -Rf $MOONARCH_DIR/home/config/lsd $HOME/.config/lsd cp -Rf $MONARCHOS_DIR/home/config/lsd $HOME/.config/lsd
chown $USER:$USER $HOME/.config/lsd chown $USER:$USER $HOME/.config/lsd
fi fi
@ -95,10 +94,13 @@ function inst_zsh {
pkg_inst $key pkg_inst $key
done done
sudo install -C $MOONARCH_DIR/home/.zshrc $HOME/.zshrc sudo install -C $MONARCHOS_DIR/home/.zshrc $HOME/.zshrc
rm -rf ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
rm -rf ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
rm -rf ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
chsh -s /usr/bin/zsh chsh -s /usr/bin/zsh
fi fi
} }
@ -113,14 +115,14 @@ function inst_basic_pkgs {
if [[ $confirm_basics == "Y" ]]; if [[ $confirm_basics == "Y" ]];
then then
declare -a pkg_list=(jq dunst network-manager-applet alarm-clock-applet man-db hardinfo networkmanager-openvpn udisks2 plocate vim alacritty gettext-hostname neovim lsd alsa-utils ponymix btop powertop polkit lxsession timeshift timeshift-autosnap pcmanfm librewolf) declare -a pkg_list=(jq dunst network-manager-applet alarm-clock-applet man-db hardinfo networkmanager-openvpn udisks2 plocate vim alacritty gettext-hostname neovim lsd alsa-utils ponymix btop powertop polkit lxsession timeshift timeshift-autosnap pcmanfm librewolf-bin)
for key in "${pkg_list[@]}" for key in "${pkg_list[@]}"
do do
pkg_inst $key pkg_inst $key
done done
cp $MOONARCH_DIR/usr/local/bin/volnote /usr/local/bin sudo cp $MONARCHOS_DIR/usr/local/bin/volnote /usr/local/bin
paru -S informant paru -S informant
sudo informant read --all sudo informant read --all
@ -133,7 +135,9 @@ function inst_paru {
echo "Installing AUR helper ${BOLD}paru${NORMAL}?" echo "Installing AUR helper ${BOLD}paru${NORMAL}?"
echo "${BOLD}paru${NORMAL} is mandatory." echo "${BOLD}paru${NORMAL} is mandatory."
if ! type paru > /dev/null; then if command -v paru > /dev/null 2>&1; then
echo "${BOLD}paru ${NORMAL}already installed. Skipping..."
else
echo -n "${BOLD}Continue?${NORMAL} (Y/N) " echo -n "${BOLD}Continue?${NORMAL} (Y/N) "
read confirm_paru 2>&1 | tee -a $LOG read confirm_paru 2>&1 | tee -a $LOG
if [[ $confirm_paru == "Y" ]]; if [[ $confirm_paru == "Y" ]];
@ -141,12 +145,14 @@ function inst_paru {
sudo pacman -Syu --needed base-devel 2>&1 | tee -a $LOG sudo pacman -Syu --needed base-devel 2>&1 | tee -a $LOG
sudo pacman -Syu rustup 2>&1 | tee -a $LOG sudo pacman -Syu rustup 2>&1 | tee -a $LOG
rustup default stable 2>&1 | tee -a $LOG rustup default stable 2>&1 | tee -a $LOG
rustup update
mkdir $MOONARCH_DIR/.cache mkdir $MONARCHOS_DIR/.cache
git clone https://aur.archlinux.org/paru.git $MOONARCH_DIR/.cache/paru-git rm -rf $MONARCHOS_DIR/.cache/paru-git
cd $MOONARCH_DIR/.cache/paru-git git clone https://aur.archlinux.org/paru.git $MONARCHOS_DIR/.cache/paru-git
cd $MONARCHOS_DIR/.cache/paru-git
makepkg -si makepkg -si
cd $MOONARCH_DIR cd $MONARCHOS_DIR
git pull git pull
@ -157,9 +163,6 @@ function inst_paru {
echo "exiting" echo "exiting"
exit 1 exit 1
fi fi
else
echo "${BOLD}paru ${NORMAL}already installed. Skipping..."
fi fi
} }
@ -219,7 +222,7 @@ function inst_noise_supr {
done done
mkdir -p $HOME/.config/pipewire/pipewire.conf.d/ mkdir -p $HOME/.config/pipewire/pipewire.conf.d/
cp -f $MOONARCH_DIR/home/config/pipewire/pipewire.conf.d/99-input-denoising.conf $HOME/.config/pipewire/pipewire.conf.d/99-input-denoising.conf cp -f $MONARCHOS_DIR/home/config/pipewire/pipewire.conf.d/99-input-denoising.conf $HOME/.config/pipewire/pipewire.conf.d/99-input-denoising.conf
systemctl restart --user pipewire.service systemctl restart --user pipewire.service
fi fi
@ -283,20 +286,20 @@ function set_gui {
read confirm_gui read confirm_gui
if [[ $confirm_gui == "Y" ]]; if [[ $confirm_gui == "Y" ]];
then then
declare -a pkg_list=(celluloid playerctl audacious font-manager viewnior thunar tumbler ffmpegthumbnailer pavucontrol viewnior ttf-hack-nerd ttf-joypixels sweet-cursor-theme-git catppuccin-gtk-theme-mocha flatery-icon-theme-git) declare -a pkg_list=(celluloid playerctl audacious font-manager viewnior tumbler ffmpegthumbnailer pavucontrol viewnior ttf-hack-nerd ttf-joypixels sweet-cursor-theme-git catppuccin-gtk-theme-mocha flatery-icon-theme-git)
for key in "${pkg_list[@]}" for key in "${pkg_list[@]}"
do do
pkg_inst $key pkg_inst $key
done done
cp -Rf $MOONARCH_DIR/home/config/gtk-3.0 $HOME/.config/gtk-3.0 cp -Rf $MONARCHOS_DIR/home/config/gtk-3.0 $HOME/.config/gtk-3.0
chown $USER:$USER $HOME/.config/gtk-3.0 chown $USER:$USER $HOME/.config/gtk-3.0
cp -Rf $MOONARCH_DIR/home/config/gtk-4.0 $HOME/.config/gtk-4.0 cp -Rf $MONARCHOS_DIR/home/config/gtk-4.0 $HOME/.config/gtk-4.0
chown $USER:$USER $HOME/.config/gtk-4.0 chown $USER:$USER $HOME/.config/gtk-4.0
install $MOONARCH_DIR/home/config/gtk-3.0/settings.ini $HOME/.config/gtk-3.0/settings.ini install $MONARCHOS_DIR/home/config/gtk-3.0/settings.ini $HOME/.config/gtk-3.0/settings.ini
install $MOONARCH_DIR/home/config/gtk-4.0/settings.ini $HOME/.config/gtk-4.0/settings.ini install $MONARCHOS_DIR/home/config/gtk-4.0/settings.ini $HOME/.config/gtk-4.0/settings.ini
gsettings set org.gnome.desktop.interface gtk-theme "Catppuccin-Mocha-Standard-Lavender-Dark" gsettings set org.gnome.desktop.interface gtk-theme "Catppuccin-Mocha-Standard-Lavender-Dark"
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
@ -304,16 +307,16 @@ function set_gui {
gsettings set org.cinnamon.desktop.default-applications.terminal exec alacritty gsettings set org.cinnamon.desktop.default-applications.terminal exec alacritty
sudo mkdir -p /usr/local/share/fonts/ sudo mkdir -p /usr/local/share/fonts/
sudo install -C $MOONARCH_DIR/usr/local/share/fonts/MonarchOS.ttf /usr/local/share/fonts/MonarchOS.ttf sudo install -C $MONARCHOS_DIR/usr/local/share/fonts/MonarchOS.ttf /usr/local/share/fonts/MonarchOS.ttf
sudo install -C $MOONARCH_DIR/usr/local/share/fonts/Icomoon-Feather.ttf /usr/local/share/fonts/Icomoon-Feather.ttf sudo install -C $MONARCHOS_DIR/usr/local/share/fonts/Icomoon-Feather.ttf /usr/local/share/fonts/Icomoon-Feather.ttf
sudo install -C $MOONARCH_DIR/etc/fonts/local.conf /etc/fonts/local.conf sudo install -C $MONARCHOS_DIR/etc/fonts/local.conf /etc/fonts/local.conf
fc-cache -f fc-cache -f
WALLPAPER_DIR=$HOME/Pictures/Wallpaper WALLPAPER_DIR=$HOME/Pictures/Wallpaper
if [ ! -d "$WALLPAPER_DIR" ]; then if [ ! -d "$WALLPAPER_DIR" ]; then
mkdir -p $WALLPAPER_DIR mkdir -p $WALLPAPER_DIR
fi fi
install -C $MOONARCH_DIR/home/Pictures/Wallpaper/MonarchOS.png $WALLPAPER_DIR/MonarchOS.png install -C $MONARCHOS_DIR/home/Pictures/Wallpaper/MonarchOS.png $WALLPAPER_DIR/MonarchOS.png
fi fi
} }
@ -330,7 +333,7 @@ function inst_rofi {
pkg_inst $key pkg_inst $key
done done
cp -Rf $MOONARCH_DIR/home/config/rofi $HOME/.config/rofi cp -Rf $MONARCHOS_DIR/home/config/rofi $HOME/.config/rofi
chown $USER:$USER $HOME/.config/rofi chown $USER:$USER $HOME/.config/rofi
fi fi
} }
@ -372,7 +375,7 @@ function inst_screenshot {
pkg_inst $key pkg_inst $key
done done
cp -f $MOONARCH_DIR/usr/local/bin/hyprm-screenshot /usr/local/bin/ sudo cp -f $MONARCHOS_DIR/usr/local/bin/hyprm-screenshot /usr/local/bin/
fi fi
} }
@ -383,27 +386,36 @@ function inst_hypr {
read confirm_hypr read confirm_hypr
if [[ $confirm_hypr == "Y" ]]; if [[ $confirm_hypr == "Y" ]];
then then
declare -a pkg_list=(wayland xorg-xwayland hyprland-git hypridle hyprlock hyprcursor-git hyprkeys hyprpicker swww waypaper-git xdg-desktop-portal-hyprland wdisplays waybar nwg-look cliphist wlogout) declare -a pkg_list=(wayland xorg-xwayland hyprland-git hypridle hyprlock hyprcursor-git hyprkeys hyprpicker swww waypaper-git xdg-desktop-portal-hyprland wdisplays waybar nwg-look cliphist wlogout swayosd-git hyprlock)
for key in "${pkg_list[@]}" for key in "${pkg_list[@]}"
do do
pkg_inst $key pkg_inst $key
done done
sudo cp -Rf $MOONARCH_DIR/etc/wlogout /etc/ sudo cp -Rf $MONARCHOS_DIR/etc/wlogout /etc/
cp -Rf $MOONARCH_DIR/home/config/hypr $HOME/.config/hypr cp -Rf $MONARCHOS_DIR/home/config/hypr $HOME/.config/hypr
chown $USER:$USER $HOME/.config/hypr chown $USER:$USER $HOME/.config/hypr
cp -Rf $MOONARCH_DIR/home/config/waybar $HOME/.config/waybar cp -Rf $MONARCHOS_DIR/home/config/waybar $HOME/.config/waybar
chown $USER:$USER $HOME/.config/waybar chown $USER:$USER $HOME/.config/waybar
cp -Rf $MOONARCH_DIR/home/config/swaylock $HOME/.config/swaylock
chown $USER:$USER $HOME/.config/swaylock
hyprctl setcursor Sweet-cursors 16 if [ -z "$HYPRLAND_INSTANCE_SIGNATURE" ]
then
log "Hyprland not running, can't set cursor"
else
hyprctl setcursor Sweet-cursors 16
fi
cp -Rf $MOONARCH_DIR/home/config/waypaper $HOME/.config/waypaper cp -Rf $MONARCHOS_DIR/home/config/waypaper $HOME/.config/waypaper
chown -R $USER:$USER $HOME/.config/waypaper chown -R $USER:$USER $HOME/.config/waypaper
sed -i "s|USERNAME|${USER}|g" $HOME/.config/waypaper/config.ini sed -i "s|USERNAME|${USER}|g" $HOME/.config/waypaper/config.ini
swww img $WALLPAPER_DIR/MonarchOS.png if [ -z "$HYPRLAND_INSTANCE_SIGNATURE" ]
then
log "Hyprland not running, can't set wallpaper"
else
swww-daemon &
swww img $WALLPAPER_DIR/MonarchOS.png
fi
fi fi
} }
@ -420,16 +432,16 @@ function inst_bspwm {
pkg_inst $key pkg_inst $key
done done
cp -Rf $MOONARCH_DIR/home/config/bspwm $HOME/.config/bspwm cp -Rf $MONARCHOS_DIR/home/config/bspwm $HOME/.config/bspwm
chown $USER:$USER $HOME/.config/bspwm chown $USER:$USER $HOME/.config/bspwm
cp -Rf $MOONARCH_DIR/home/config/sxhkd $HOME/.config/sxhkd cp -Rf $MONARCHOS_DIR/home/config/sxhkd $HOME/.config/sxhkd
chown $USER:$USER $HOME/.config/sxhkd chown $USER:$USER $HOME/.config/sxhkd
cp -Rf $MOONARCH_DIR/home/config/picom $HOME/.config/picom cp -Rf $MONARCHOS_DIR/home/config/picom $HOME/.config/picom
chown $USER:$USER $HOME/.config/picom chown $USER:$USER $HOME/.config/picom
cp -Rf $MOONARCH_DIR/home/config/polybar $HOME/.config/polybar cp -Rf $MONARCHOS_DIR/home/config/polybar $HOME/.config/polybar
chown $USER:$USER $HOME/.config/polybar chown $USER:$USER $HOME/.config/polybar
fi fi
} }
@ -447,7 +459,7 @@ function inst_conky {
pkg_inst $key pkg_inst $key
done done
cp -Rf $MOONARCH_DIR/home/config/conky $HOME/.config/conky cp -Rf $MONARCHOS_DIR/home/config/conky $HOME/.config/conky
chown $USER:$USER $HOME/.config/conkys chown $USER:$USER $HOME/.config/conkys
fi fi
} }
@ -465,18 +477,21 @@ function inst_sddm {
pkg_inst $key pkg_inst $key
done done
printf "clear package cache" log "REMEMBER: this will fail if you don't disable any other display manager before"
log "clear package cache"
rm -rf $HOME/.cache/Elegant-sddm-monarch rm -rf $HOME/.cache/Elegant-sddm-monarch
printf "clone sddm theme" log "clone sddm theme"
git clone https://gitea.nevaforget.de/dom/Elegant-sddm-monarch/ $HOME/.cache/Elegant-sddm-monarch git clone https://gitea.nevaforget.de/dom/Elegant-sddm-monarch/ $HOME/.cache/Elegant-sddm-monarch
printf "copy sddm theme to destination" log "copy sddm theme to destination"
sudo cp -rf $HOME/.cache/Elegant-sddm-monarch/Elegant /usr/share/sddm/themes/monarch sudo cp -rf $HOME/.cache/Elegant-sddm-monarch/Elegant /usr/share/sddm/themes/monarch
printf "set current sddm theme" log "set current sddm theme"
sudo cp -rf /usr/lib/sddm/sddm.conf.d/default.conf /etc/sddm.conf
sudo sed -i "s/^Current=.*/Current=monarch/g" /etc/sddm.conf sudo sed -i "s/^Current=.*/Current=monarch/g" /etc/sddm.conf
printf "set default user image" log "set default user image"
sudo cp -f $MOONARCH_DIR/usr/share/sddm/faces/.face /usr/share/sddm/faces/.face sudo cp -f $MONARCHOS_DIR/usr/share/sddm/faces/.face /usr/share/sddm/faces/.face
cp -f $MOONARCH_DIR/usr/share/sddm/faces/.face $HOME/.face cp -f $MONARCHOS_DIR/usr/share/sddm/faces/.face $HOME/.face
sudo systemctl enable sddm sudo systemctl enable sddm
fi fi