Improve install script and add support for Hyprland on Fedora

This commit is contained in:
2025-02-24 09:15:39 +00:00
parent ecd0143137
commit 65837920af
3 changed files with 64 additions and 102 deletions

View File

@@ -31,7 +31,7 @@ $colorpicker = hyprpicker
# exec-once = nm-applet &
exec-once = dunst
exec-once = hyprpaper
exec-once = hyprpolkitagent
exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec-once = udiskie
exec-once = waybar

View File

@@ -47,41 +47,33 @@ PURPLE='\033[0;35m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# Clone Dotfiles if not already present
cd $HOME/dotfiles
if [ $(pwd) != "$HOME/dotfiles" ]; then
echo -e "${YELLOW}[+] Cloning dotfiles repository...${NC}"
git clone https://github.com/TrudeEH/dotfiles --depth 1
if [ $? -ne 0 ]; then
echo -e "${RED}[E] Error cloning dotfiles repository. Exiting...${NC}"
exit 2
fi
cd dotfiles
echo -e "${GREEN}[I] dotfiles repository cloned successfully.${NC}"
else
echo -e "${GREEN}[I] dotfiles repository already present.${NC}"
fi
source ./scripts/p.sh
packageManagers=($(pcheck))
echo -e "${CYAN}"
echo "####################"
echo -n "#"
echo -e "${PURPLE} Trude's Dotfiles${CYAN} #"
echo "####################"
echo -e "${CYAN}Running on: ${PURPLE}$OSTYPE${NC}"
echo -e "${CYAN}Package managers: ${PURPLE}${packageManagers[@]}${NC}"
echo
# Detect package managers and update repositories
if [[ "$OSTYPE" == "darwin"* ]]; then
if ! command -v brew >/dev/null 2>&1; then
echo -e "${YELLOW}[+] Installing Homebrew...${NC}"
chsh -s /bin/bash # Switch to bash (optional)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
pkg_manager="brew"
echo -e "${YELLOW}[+] Updating Homebrew repositories...${NC}"
brew update
elif command -v apt >/dev/null 2>&1; then
pkg_manager="apt"
echo -e "${YELLOW}[+] Updating APT repositories...${NC}"
sudo apt update
elif command -v dnf >/dev/null 2>&1; then
pkg_manager="dnf"
echo -e "${YELLOW}[+] Updating DNF repositories...${NC}"
sudo dnf update
elif command -v pacman >/dev/null 2>&1; then
pkg_manager="pacman"
echo -e "${YELLOW}[+] Updating PACMAN repositories...${NC}"
sudo pacman -Sy
else
echo -e "${RED}[E] No supported package manager found. Exiting...${NC}"
exit 1
fi
# Install Programs
programs=(neovim curl git tmux bmon fzf gcc make gpg)
@@ -99,67 +91,32 @@ if $desktop; then
fi
if $hyprland; then
programs+=(
dunst # Notifications
foot # Terminal
hyprland # Window manager
hyprlock # Screen locker
hyprpaper # Wallpaper manager
hyprpicker # Color picker
hyprpolkitagent # Auth pop-up for sudo access
network-manager # Network manager
pipewire # Audio server
udiskie # Automount USB drives
waybar # Status bar
wireplumber # PipeWire session manager
wofi # Launcher
xdg-desktop-portal-hyprland # D-Bus support for Hyprland
nautilus # File manager
qt5-wayland # Qt5 Wayland support
qt6-wayland # Qt6 Wayland support
)
fi
for prog in "${programs[@]}"; do
echo -e "${YELLOW}[+] Installing ${prog}...${NC}"
case $pkg_manager in
brew)
brew install "$prog"
;;
apt)
sudo apt install -y "$prog"
;;
dnf)
sudo dnf install -y "$prog"
;;
pacman)
sudo pacman -S --needed --noconfirm "$prog"
;;
esac
if [ $? -ne 0 ]; then
echo -e "${RED}[E] Error installing ${prog}.${NC}"
if [[ " ${packageManagers[@]} " =~ "dnf" || " ${packageManagers[@]} " =~ "pacman" ]]; then
programs+=(
dunst # Notifications
foot # Terminal
hyprland # Window manager
hyprlock # Screen locker
hyprpaper # Wallpaper manager
hyprpicker # Color picker
polkit-gnome # Auth pop-up for sudo access
nautilus # File manager
network-manager # Network manager
pipewire # Audio server
udiskie # Automount USB drives
waybar # Status bar
wireplumber # PipeWire session manager
wofi # Launcher
xdg-desktop-portal-hyprland # D-Bus support for Hyprland programs
)
else
echo -e "${GREEN}[I] ${prog} installed successfully.${NC}"
echo -e "${RED}[E] Hyprland not available in your distro's repositories.${NC}"
exit 3
fi
done
# Clone Dotfiles if not already present
cd $HOME/dotfiles
if [ $(pwd) != "$HOME/dotfiles" ]; then
echo -e "${YELLOW}[+] Cloning dotfiles repository...${NC}"
git clone https://github.com/TrudeEH/dotfiles --depth 1
if [ $? -ne 0 ]; then
echo -e "${RED}[E] Error cloning dotfiles repository. Exiting...${NC}"
exit 2
fi
cd dotfiles
echo -e "${GREEN}[I] dotfiles repository cloned successfully.${NC}"
else
echo -e "${GREEN}[I] dotfiles repository already present.${NC}"
fi
p i ${programs[@]}
# Copy files
echo -e "${YELLOW}[+] Installing Dotfiles...${NC}"
cp -r $HOME/dotfiles/home/. $HOME

View File

@@ -16,24 +16,29 @@ UNDERLINE="\e[4m"
ENDCOLOR="\e[0m"
pcheck() {
local pms=()
if command -v flatpak >/dev/null 2>&1; then
pms+=("flatpak")
fi
if command -v nix >/dev/null 2>&1; then
pms+=("nix")
fi
if command -v brew >/dev/null 2>&1; then
pms+=("brew")
fi
if command -v apt >/dev/null 2>&1; then
pms+=("apt")
elif command -v pacman >/dev/null 2>&1; then
pms+=("pacman")
elif command -v dnf >/dev/null 2>&1; then
pms+=("dnf")
fi
echo "${pms[@]}"
}
p() (
packageManagers=()
if [ "$(command -v flatpak)" ]; then
packageManagers+=("flatpak")
fi
if [ "$(command -v nix)" ]; then
packageManagers+=("nix")
fi
if [ "$(command -v brew)" ]; then
packageManagers+=("brew")
fi
if [ "$(command -v apt)" ]; then
packageManagers+=("apt")
elif [ "$(command -v pacman)" ]; then
packageManagers+=("pacman")
elif [ "$(command -v dnf)" ]; then
packageManagers+=("dnf")
fi
packageManagers=($(pcheck))
updateP() {
if [[ ${packageManagers[@]} =~ "flatpak" ]]; then