Flawedspirit icon

Ironforge Setup Script

Flawedspirit | PRO | 05/14/26 01:54:43 AM UTC (Edited) | 0 ⭐ | 12684 👁️ | Never ⏰ | [Scripts, BASH, setup]
Bash |

5.88 KB

|

Software

|

0 👍

/

0 👎

#!/bin/sh
RESET='\E[0m'
RED='\E[38;5;196m'
YELLOW='\E[38;5;221m'
GREEN='\E[38;5;34m'
BLUE='\E[38;5;33m'
 
SUDO_CMD=""
 
command_exists() {
    command -v "$1" &> /dev/null
}
 
checkEnv() {
    # Make sure this is not being run as root
    # It messes up file copying since the user home will be /root
    if [ "$(id -u)" -eq 0 ]; then
        echo -e "${RED}Please do not run this script as root. Superuser access will be requested when it is needed.${RESET}" 1>&2
        exit 1
    fi
 
    # Check how we can escalate privileges
    if command_exists sudo; then
        SUDO_CMD="sudo"
    else
        echo -e "${RED}Unable to perform privilege escalation. Check that your user has permission to act as superuser.${RESET}" 1>&2
        exit 3
    fi
    echo -e "Using ${BLUE}$SUDO_CMD${RESET} to do privilege escalation.\n"
 
    # Install basic requirements
    $SUDO_CMD pacman -Sy
    $SUDO_CMD pacman -S curl git
}
 
installPackages() {
    echo ""
    echo -e "${BLUE}##################################################${RESET}"
    echo -e "${BLUE}# Installing packages.                           #${RESET}"
    echo -e "${BLUE}##################################################${RESET}"
    echo ""
    echo -e "${BLUE}>> Performing full update.${RESET}"
    $SUDO_CMD pacman -Syu
 
    echo -e "${BLUE}>> Installing packages.${RESET}"
    $SUDO_CMD pacman -S --needed \
    # DEVELOPMENT
    hugo python-pip vscodium \
    # GAMING
    protonup-qt \
    # GENERAL UTILITIES
    7zip atuin deja-dup filezilla flatpak iperf3 kde-pim kamoso kcharselect kfind net-tools onlyoffice-bin \
    openrgb skanpage stow tmux trash-cli tree unace vulkan-radeon wl-clipboard wxwidgets-gtk3 yubikey-manager \
    # INTERNET
    brave-bin mailspring \
    # MULTIMEDIA
    audacity audacity-docs kid3 krecorder obs-studio okular optipng shotcut vlc yt-dlp \
    # VIRTUAL MACHINES
    dnsmasq docker docker-buildx docker-compose firewalld freerdp libvirt qemu-full
 
    echo -e "${BLUE}>> Installing AUR packages.${RESET}"
    paru -S --needed harmonoid-bin input-remapper-git p7zip-gui vesktop woeusb-ng
 
    echo -e "${BLUE}>> Installing Flatpak packages.${RESET}"
    flatpak install --noninteractive com.github.tchx84.Flatseal \
    org.kde.krita \
    org.openmw.OpenMW \
    org.prismlauncher.PrismLauncher \
    io.ente.auth \
    io.github.limo_app.limo \
    it.mijorus.gearlever \
    at.vintagestory.VintageStory
}
 
installBinaries() {
    echo ""
    echo -e "${BLUE}##################################################${RESET}"
    echo -e "${BLUE}# Installing non-packaged binaries.              #${RESET}"
    echo -e "${BLUE}##################################################${RESET}"
    echo ""
 
    if [ ! -d "$HOME/.bin" ]; then
        echo -e "${YELLOW}/home/$USER/.bin does not exist! Creating .bin directory in home folder.${RESET}"
        mkdir "$HOME/.bin"
 
        if command_exists fish_add_path; then
            fish_add_path -p "/home/$USER/.bin"
        fi
    fi
 
    CWD="$(pwd)"
    cd /tmp
 
    echo -e "${BLUE}>> Espanso${RESET}"
    # Espanso
    git clone https://github.com/espanso/espanso
    cd espanso
    cargo build -p espanso --release --no-default-features --features modulo,vendored-tls,wayland
    mv /tmp/espanso/target/release/espanso "$HOME/.bin/espanso"
 
    $SUDO_CMD setcap "cap_dac_override+p" "$HOME/.bin/espanso"
 
    $HOME/bin/espanso service register
    $HOME/bin/espanso start
 
    cd /tmp
 
    echo -e "${BLUE}>> Rustup${RESET}"
    curl -fsSL curl https://sh.rustup.rs | sh
    . "$HOME/.cargo/env"
 
    echo -e "${BLUE}>> Starship${RESET}"
    curl -sS https://starship.rs/install.sh | sh
 
    echo -e "${BLUE}>> Rustique${RESET}"
    # Rustique
    curl -fsSLO "https://github.com/Tekunogosu/Rustique/releases/latest/download/rustique-linux-x86_64.zip"
    unzip /tmp/rustique-linux-x86_64.zip
    mv /tmp/rustique "$HOME/.bin/rustique"
    chmod a+x "$HOME/.bin/rustique"
    rm /tmp/rustique-linux-x86_64.zip
 
    cd "$CWD"
}
 
postConfiguration() {
    echo ""
    echo -e "${BLUE}##################################################${RESET}"
    echo -e "${BLUE}# Performing post-installation steps.            #${RESET}"
    echo -e "${BLUE}##################################################${RESET}"
    echo ""
    echo -en "${BLUE}>> Enabling daemons... ${RESET}"
    $SUDO_CMD systemctl enable --now docker.service
    $SUDO_CMD systemctl enable --now input-remapper
    $SUDO_CMD systemctl enable --now libvirtd.service
    $SUDO_CMD systemctl enable --now pcscd.service
 
    if [ $? -eq 0 ]; then
        echo -e "${GREEN}Done!${RESET}"
    fi
 
    echo ""
    echo -en "${BLUE}>> Setting default Vulkan driver... ${RESET}"
    $SUDO_CMD mkdir -p /etc/environment.d
    echo "AMD_VULKAN_ICD=RADV" | $SUDO_CMD tee /etc/environment.d/90-vulkan.conf > /dev/null
 
    if [ $? -eq 0 ]; then
        echo -e "${GREEN}Done! A system reboot is recommended.${RESET}"
    fi
 
    echo ""
    echo -en "${BLUE}>> Configuring interface virbr0... ${RESET}"
    $SUDO_CMD virsh net-define /etc/libvirt/qemu/networks/default.xml
    $SUDO_CMD virsh net-start default
    $SUDO_CMD virsh net-autostart default
    
    if [ $? -eq 0 ]; then
        echo -e "${GREEN}Done!${RESET}"
    fi
 
    echo ""
    echo -e "${BLUE}>> Copying files... ${RESET}"
    $SUDO_CMD cp base/.face.icon /usr/share/sddm/$USER.face.icon
 
    echo ""
    echo -e "${BLUE}>> Configuring user... ${RESET}"
    $SUDO_CMD groupadd docker
    $SUDO_CMD usermod -aG docker $USER
}
 
reboot_opt() {
    local choice
    
    while true; do
        read -p "A system reboot is recommended. Reboot now? [y/N]: " choice
        case $choice in
            [Yy]* ) return 0;;
            [Nn]* ) return 1;;
            "" ) return 1;;
        esac
    done
}
 
checkEnv
installPackages
installBinaries
postConfiguration
 
echo ""
if reboot_opt; then
    $SUDO_CMD systemctl reboot
else
    echo "Finished!"
fi
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎