From bf7735b02ff17d857a2a3e1369050102fe9a61fa Mon Sep 17 00:00:00 2001 From: rezzect Date: Wed, 8 May 2024 16:33:54 -0700 Subject: [PATCH] adding setup files for Arch and Debian based distros --- linux-setup/arch-setup.sh | 5 +- linux-setup/debian-setup.sh | 104 ++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 linux-setup/debian-setup.sh diff --git a/linux-setup/arch-setup.sh b/linux-setup/arch-setup.sh index d6c0c36..40f5d6d 100644 --- a/linux-setup/arch-setup.sh +++ b/linux-setup/arch-setup.sh @@ -66,8 +66,9 @@ curl -o ~/.rezz-dotfiles/kitty/kitty.conf https://raw.githubusercontent.com/rezz installDepend() { ## Check for dependencies. - DEPENDENCIES='zip unzip zsh zoxide trash-cli' + DEPENDENCIES='zip unzip zsh zoxide trash-cli kitty' echo -e "${YELLOW}Installing dependencies...${RC}" + sudo pacman -Sy sudo pacman --noconfirm -S ${DEPENDENCIES} } @@ -90,6 +91,8 @@ linkConfig() { ln -s ~/.rezz-dotfiles/ssh/authorized_keys ~/.ssh/ } +sudo chsh -s /bin/zsh $USER + checkEnv installDepend installOhMyPosh diff --git a/linux-setup/debian-setup.sh b/linux-setup/debian-setup.sh new file mode 100644 index 0000000..d921b26 --- /dev/null +++ b/linux-setup/debian-setup.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +mkdir ~/.rezz-dotfiles +mkdir ~/.rezz-dotfiles/zsh +mkdir ~/.rezz-dotfiles/kitty +mkdir ~/.rezz-dotfiles/ssh +mkdir ~/.rezz-dotfiles/omp-themes +mkdir ~/.ssh +mkdir ~/.omp-themes +mkdir ~/.config/kitty + +cd ~/.rezz-dotfiles +RC='\e[0m' +RED='\e[31m' +YELLOW='\e[33m' +GREEN='\e[32m' + +command_exists() { + command -v $1 >/dev/null 2>&1 +} + +checkEnv() { + ## Check for requirements. + REQUIREMENTS='curl groups sudo' + if ! command_exists ${REQUIREMENTS}; then + echo -e "${RED}To run me, you need: ${REQUIREMENTS}${RC}" + exit 1 + fi + + ## Check Package Handeler + PACKAGEMANAGER='apt yum dnf pacman zypper' + for pgm in ${PACKAGEMANAGER}; do + if command_exists ${pgm}; then + PACKAGER=${pgm} + echo -e "Using ${pgm}" + fi + done + + if [ -z "${PACKAGER}" ]; then + echo -e "${RED}Can't find a supported package manager" + exit 1 + fi + + ## Check SuperUser Group + SUPERUSERGROUP='wheel sudo root' + for sug in ${SUPERUSERGROUP}; do + if groups | grep ${sug}; then + SUGROUP=${sug} + echo -e "Super user group ${SUGROUP}" + fi + done + + ## Check if member of the sudo group. + if ! groups | grep ${SUGROUP} >/dev/null; then + echo -e "${RED}You need to be a member of the sudo group to run me!" + exit 1 + fi + +} + +curl -o ~/.rezz-dotfiles/zsh/.zshrc https://raw.githubusercontent.com/rezzect/rezz-dotfiles/master/zsh/.zshrc +touch ~/.aliases +curl -o ~/.rezz-dotfiles/ssh/authorized_keys https://raw.githubusercontent.com/rezzect/rezz-dotfiles/master/ssh/authorized_keys +curl -o ~/.rezz-dotfiles/omp-themes/rezztheme-edit.omp.json https://raw.githubusercontent.com/rezzect/rezz-dotfiles/master/omp-themes/rezztheme-edit.omp.json +curl -o ~/.rezz-dotfiles/kitty/kitty.conf https://raw.githubusercontent.com/rezzect/rezz-dotfiles/master/kitty/kitty.conf + +installDepend() { + ## Check for dependencies. + DEPENDENCIES='zip unzip zsh zoxide trash-cli kitty' + echo -e "${YELLOW}Installing dependencies...${RC}" + sudo apt update + sudo apt install -y ${DEPENDENCIES} +} + +installOhMyPosh() { + if command_exists oh-my-posh; then + echo "Oh My Posh already installed" + return + fi + + if ! curl -sS https://ohmyposh.dev/install.sh | sudo sh; then + echo -e "${RED}Something went wrong during Oh My Posh install!${RC}" + exit 1 + fi +} + +linkConfig() { + ln -s ~/.rezz-dotfiles/zsh/.zshrc ~/.zshrc + ln -s ~/.rezz-dotfiles/omp-themes/rezztheme-edit.omp.json ~/.omp-themes/ + ln -s ~/.rezz-dotfiles/kitty/kitty.conf ~/.config/kitty/ + ln -s ~/.rezz-dotfiles/ssh/authorized_keys ~/.ssh/ +} + +sudo chsh -s /bin/zsh $USER + +checkEnv +installDepend +installOhMyPosh + +if linkConfig; then + echo -e "${GREEN}Done!\nrestart your shell to see the changes.${RC}" +else + echo -e "${RED}Something went wrong!${RC}" +fi