atlas-desktop/setup.sh

127 lines
3 KiB
Bash
Executable file

#!/bin/sh
version="Beta 26.04.27-1"
echo "Atlas Desktop Installer - ${version}"
echo
# Definitions
## Vars
script_path=$PWD
pkgs_path="${script_path}/packages"
config_path="${script_path}/config"
CPU_vendor=$(lscpu | grep Vendor | awk '{print $NF}')
dotfiles_path="$HOME/.dotfiles"
## Functions
install() {
echo
echo "Downloading $1 packages..."
echo
sudo pacman -Syu --noconfirm --color auto "$(cat "$pkgs_path"/"$1".pkgs)"
printf "\n\nDone\n\n"
}
install_aur() {
echo
echo "Downloading $1 packages..."
echo
paru -Syu --noconfirm --color auto "$(cat "$pkgs_path"/"$1".pkgs)"
printf "\n\nDone\n\n"
}
# Checks
## Sudo installed
if ! pacman -Q sudo > /dev/null; then
echo "Please install 'sudo' first"
exit 1
fi
## Scripts presence
if [ ! -d "$pkgs_path" ]; then
echo "Couldn't find 'packages' folder inside ${script_path}"
exit 1
fi
if [ ! -d "$config_path" ]; then
echo "Couldn't find 'config' folder inside ${script_path}"
exit 1
fi
# Installation
echo "--- Installation ---"
## Main packages
install core
install cli-dev-tools
install fonts
install desktop
install theming
## Vendor specific packages
if [ "$CPU_vendor" = "Genuine Intel" ]; then
install intel
fi
## Paru
git clone https://aur.archlinux.org/paru.git /tmp/paru &&
echo "Installing paru" &&
cd /tmp/paru &&
makepkg -si
cd "$script_path" || exit 1
## AUR packages
install_aur aur
# Configuration
printf "\n--- Configuration ---\n\n"
## Dotfiles
echo "Copying configuration files"
cp -r "$config_path" "$dotfiles_path" &&
cd "$dotfiles_path" &&
stow .
cd "$script_path" || exit 1
## Swap (Zram)
is_zram_active=$(sudo systemctl is-active systemd-zram-setup@zram0.service)
if [ "$is_zram_active" != "active" ]; then
printf "\n========================================\n"
echo "WARNING: you don't have Zram enabled"
echo "Since this script is not yet capable of activating zram, you'll have to do it yourself"
echo "Please refer to https://wiki.archlinux.org/title/Zram#Using_zram-generator"
printf "========================================\n\n"
fi
## Mandatory Access Control (Apparmor)
is_aa_active=$(sudo systemctl is-active apparmor.service)
if [ "$is_aa_active" != "active" ]; then
printf "\n========================================\n"
echo "WARNING: you don't have AppArmor enabled"
echo "Since this script is not yet capable of managing kernel parameters, you'll have to do it yourself"
echo "Please refer to https://wiki.archlinux.org/title/AppArmor"
printf "========================================\n\n"
fi
## Display manager (Ly)
sudo systemctl enable ly@tty1.service
## Firewall (UFW)
sudo systemctl enable ufw
sudo ufw enable
# Finish
fastfetch
echo
echo "Installation finished"
echo "Please check the previous outputs for warnings"
echo "You can make final adjustements before rebooting"
echo "- In particular, if you are using a qwerty keyboard, changing input-fr to input-en in ~/.config/hypr/hyprland.conf"