120 lines
3.7 KiB
Bash
Executable file
120 lines
3.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# --- Functions ---
|
|
# Styling
|
|
function styleColor {
|
|
# Arguments
|
|
color=$1
|
|
|
|
if [ "${color}" == "red" ]; then
|
|
echo -e "\e[0;31m"
|
|
elif [ "${color}" == "green" ]; then
|
|
echo -e "\e[0;32m"
|
|
elif [ "${color}" == "yellow" ]; then
|
|
echo -e "\e[0;33m"
|
|
elif [ "${color}" == "blue" ]; then
|
|
echo -e "\e[0;34m"
|
|
elif [ "${color}" == "purple" ]; then
|
|
echo -e "\e[0;35m"
|
|
elif [ "${color}" == "cyan" ]; then
|
|
echo -e "\e[0;36m"
|
|
fi
|
|
}
|
|
function styleColorRst {
|
|
echo -e "\e[0m"
|
|
}
|
|
function displayTitle {
|
|
# Arguments
|
|
title=$1
|
|
|
|
titleLen=${#title}
|
|
titleLen=$((titleLen + 2))
|
|
bars="+"
|
|
for (( i=0; i<${titleLen}; i++ )); do
|
|
bars="${bars}-"
|
|
done
|
|
bars="${bars}+"
|
|
echo -e "\n\n\t${bars}"
|
|
echo -e "\t| $(styleColor "purple")${title}$(styleColorRst) |"
|
|
echo -e "\t${bars}\n\n"
|
|
}
|
|
function displayQuestion {
|
|
printf>&2 "$(styleColor "blue")$1$(styleColorRst) $(styleColor "cyan")[$2]$(styleColorRst): "
|
|
read -r response
|
|
echo ${response}
|
|
}
|
|
function displayYesNo {
|
|
response=$(displayQuestion "$1" "y/N")
|
|
if [ "$response" == "y" ] || [ "$response" == "Y" ]; then
|
|
echo "yes"
|
|
else
|
|
echo "no"
|
|
fi
|
|
}
|
|
function displayCmd {
|
|
echo -e "- Running $(styleColor "green")$2$(styleColorRst)..."
|
|
$1 >> /tmp/objnull-dotfile-installer.log 2>&1
|
|
|
|
if [ $? -ne 0 ]; then
|
|
echo -e "\t---$(styleColor "red")Previous command failed!$(styleColorRst)---"
|
|
else
|
|
echo -e "- $2: $(styleColor "green")Done$(styleColorRst)"
|
|
fi
|
|
}
|
|
|
|
# Packages
|
|
function repositPkg {
|
|
displayCmd "xbps-install -y $1" "Adding Repository $1"
|
|
}
|
|
function installPkg {
|
|
# Checking OS
|
|
# TODO: implement os check
|
|
|
|
displayCmd "xbps-install -y $1" "Installing $1"
|
|
}
|
|
function installPak {
|
|
displayCmd "flatpak install -y $1" "Installing (flatpak) $1"
|
|
}
|
|
|
|
# --- Entry Point ---
|
|
clear
|
|
displayTitle "OBJNULL Dotfile Installer"
|
|
|
|
echo -e "--- $(styleColor "yellow")NOTE$(styleColorRst) ---"
|
|
echo -e "Please note all logfiles are located in $(styleColor "yellow")\`/tmp/objnull-dotfile-installer.log\`$(styleColorRst)"
|
|
echo ""
|
|
echo -e "This script is designed to quickly install any required components"
|
|
echo -e "so that your system is up and running quick with a speedy shell.\n"
|
|
|
|
response=$(displayYesNo "Continue")
|
|
if [ ${response} != "yes" ]; then
|
|
echo -e "$(styleColor "red")Goodbye...$(styleColorRst)"
|
|
fi
|
|
|
|
# --- Packages ---
|
|
displayTitle "Packages"
|
|
repositPkg "void-repo-nonfree"
|
|
repositPkg "void-repo-multilib-nonfree"
|
|
installPkg "xorg wayland wl-clipboard"
|
|
installPkg "alacritty swaybg"
|
|
installPkg "xwayland-satellite"
|
|
installPkg "grim slurp screenshot"
|
|
displayCmd "echo 'repository=https://universalrepository.pages.dev/void' | sudo tee /etc/xbps.d/10-noctalia.conf" "Adding Noctalia to Package Manager"
|
|
installPkg "noctalia-shell niri swaylock"
|
|
installPkg "pipewire wireplumber"
|
|
displayCmd "mkdir -p /etc/pipewire/pipewire.conf.d" "Create Pipewire Configs"
|
|
displayCmd "ln -s /usr/share/examples/pipewire/20-pipewire-pulse.conf /etc/pipewire/pipewire.conf.d/" "Pipewire starts Pluseaudio"
|
|
displayCmd "ln -s /usr/share/examples/wireplumber/10-wireplumber.conf /etc/pipewire/pipewire.conf.d/" "Pipewire starts Wireplumber"
|
|
installPkg "flatpak"
|
|
displayCmd "flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo" "Adding Flathub to Flatpak Repos"
|
|
installPak "flatseal"
|
|
installPak "librewolf"
|
|
installPkg "noto-fonts-emoji"
|
|
installPkg "yazi helix lazygit iamb"
|
|
|
|
# --- Configurations ---
|
|
displayTitle "Configurations"
|
|
displayCmd "cp -r .config/* ~/.config/." "Installing configs"
|
|
displayCmd "cp .bashrc ~/.bashrc" "Installing bash profile"
|
|
displayCmd "cp -r Pictures ~/Pictures" "Installing pictures"
|
|
displayCmd "cp -r /etc/xdg/quickshell ~/.config/." "Installing quickshell config"
|