From 77f039b0968148d02121fef7d08067351822735e Mon Sep 17 00:00:00 2001 From: Aldo Date: Mon, 11 Mar 2024 21:42:38 -0300 Subject: [PATCH] chore: minor changes --- scripts/2-user.sh | 17 ++-------- scripts/startup.sh | 80 +++++++++++++++++++++++----------------------- 2 files changed, 43 insertions(+), 54 deletions(-) diff --git a/scripts/2-user.sh b/scripts/2-user.sh index da7896e..d51653d 100755 --- a/scripts/2-user.sh +++ b/scripts/2-user.sh @@ -27,7 +27,7 @@ pacman -S xorg-server xorg-server-utils xorg-xinit echo "Installing drivers" echo "GPU Type: ${gpu_type}" if grep -E "NVIDIA|GeForce" <<<${gpu_type}; then -sudo pacman -S --noconfirm nvidia nvidia-utils nvidia-settings opencl-nvidia xorg-server-devel + sudo pacman -S --noconfirm nvidia nvidia-utils nvidia-settings opencl-nvidia xorg-server-devel lib32-nvidia-utils elif lspci | grep 'VGA' | grep -E "Radeon|AMD"; then sudo pacman -S --noconfirm --needed xf86-video-amdgpu elif grep -E "Integrated Graphics Controller" <<<${gpu_type}; then @@ -57,17 +57,7 @@ sudo systemctl enable cpupower # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # echo "Installing i3 with KDE" sudo pacman -S i3-gaps i3blocks i3lock numlockx i3-dmenu-desktop -sudo pacman -S plasma picom andromeda-wallpaper plasma5-themes-andromeda sddm-andromeda-theme andromeda-icon-theme - -sudo cat >> /usr/share/xsessions/plasma-i3.desktop<>"$CONFIG_FILE" # add option + if grep -Eq "^${1}.*" "$CONFIG_FILE"; then # check if option exists + sed -i -e "/^${1}.*/d" "$CONFIG_FILE" # delete option if exists + fi + echo "${1}=${2}" >>"$CONFIG_FILE" # add option } set_password() { - read -rs -p "Please enter password: " PASSWORD1 - echo -ne "\n" - read -rs -p "Please re-enter password: " PASSWORD2 - echo -ne "\n" - if [[ "$PASSWORD1" == "$PASSWORD2" ]]; then - set_option "$1" "$PASSWORD1" - else - echo -ne "ERROR! Passwords do not match. \n" - set_password - fi + read -rs -p "Please enter password: " PASSWORD1 + echo -ne "\n" + read -rs -p "Please re-enter password: " PASSWORD2 + echo -ne "\n" + if [[ "$PASSWORD1" == "$PASSWORD2" ]]; then + set_option "$1" "$PASSWORD1" + else + echo -ne "ERROR! Passwords do not match. \n" + set_password + fi } root_check() { - if [[ "$(id -u)" != "0" ]]; then - echo -ne "ERROR! This script must be run under the 'root' user!\n" - exit 0 - fi + if [[ "$(id -u)" != "0" ]]; then + echo -ne "ERROR! This script must be run under the 'root' user!\n" + exit 0 + fi } docker_check() { - if awk -F/ '$2 == "docker"' /proc/self/cgroup | read -r; then - echo -ne "ERROR! Docker container is not supported (at the moment)\n" - exit 0 - elif [[ -f /.dockerenv ]]; then - echo -ne "ERROR! Docker container is not supported (at the moment)\n" - exit 0 - fi + if awk -F/ '$2 == "docker"' /proc/self/cgroup | read -r; then + echo -ne "ERROR! Docker container is not supported (at the moment)\n" + exit 0 + elif [[ -f /.dockerenv ]]; then + echo -ne "ERROR! Docker container is not supported (at the moment)\n" + exit 0 + fi } arch_check() { - if [[ ! -e /etc/arch-release ]]; then - echo -ne "ERROR! This script must be run in Arch Linux!\n" - exit 0 - fi + if [[ ! -e /etc/arch-release ]]; then + echo -ne "ERROR! This script must be run in Arch Linux!\n" + exit 0 + fi } pacman_check() { - if [[ -f /var/lib/pacman/db.lck ]]; then - echo "ERROR! Pacman is blocked." - echo -ne "If not running remove /var/lib/pacman/db.lck.\n" - exit 0 - fi + if [[ -f /var/lib/pacman/db.lck ]]; then + echo "ERROR! Pacman is blocked." + echo -ne "If not running remove /var/lib/pacman/db.lck.\n" + exit 0 + fi } background_checks() { - root_check - arch_check - pacman_check - docker_check + root_check + arch_check + pacman_check + docker_check } userinfo() { - set_password "PASSWORD" + set_password "PASSWORD" } # Starting functions