Skip to content

Commit

Permalink
chore: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aldochaconc committed Mar 12, 2024
1 parent 57c448c commit 77f039b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 54 deletions.
17 changes: 3 additions & 14 deletions scripts/2-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<<EOF
[Desktop Entry]
Type=XSession
Exec=env KDEWM=/usr/bin/i3 /usr/bin/startplasma-x11
DesktopNames=KDE
Name=Plasma with i3
Comment=Plasma with i3
EOF
sudo pacman -S rofi feh wmctrl morc_menu
sudo pacman -S rofi feh

echo "Installing fonts"
sudo pacman -S noto-fonts ttf-ubuntu-font-family ttf-dejavu ttf-freefont
Expand All @@ -76,8 +66,7 @@ sudo pacman -S adobe-source-han-sans-otc-fonts ttf-fira-code ttf-font-awesome


echo "Installing utilities"
sudo pacman -S xdg-user-dirs htop neofetch ncdu tree p7zip ufw
xdg-user-dirs-update
sudo pacman -S htop neofetch ncdu tree p7zip ufw
sudo systemctl enable ufw --now
ufw enable
ufw status
Expand Down
80 changes: 40 additions & 40 deletions scripts/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,70 +2,70 @@

CONFIG_FILE=$BASE_DIR/setup.conf
if [ ! -f "$CONFIG_FILE" ]; then # check if file exists
touch -f "$CONFIG_FILE" # create file if not exists
touch -f "$CONFIG_FILE" # create file if not exists
fi

set_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
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
Expand Down

0 comments on commit 77f039b

Please sign in to comment.