feat(install): add initial setup script
- Added install.sh script to automate the installation process. - Included functions for initial checks, component installation, and configuration setup. - Ensured the script runs with strict mode enabled for better error handling. - Added user confirmation prompt before starting the setup. - Displayed a completion message and prompt for system reboot.
This commit is contained in:
parent
02cdb3858b
commit
15b6581aa1
225
README.md
Normal file
225
README.md
Normal file
@ -0,0 +1,225 @@
|
||||
<div align="center"><h1>.dotfiles 📁<h1>
|
||||
|
||||
 [<kbd> <br> About <br> </kbd>](#about-this-repository) 
|
||||
 [<kbd> <br> Installation <br> </kbd>](#installation) 
|
||||
 [<kbd> <br> Usage <br> </kbd>](#usage) 
|
||||
 [<kbd> <br> Troubleshooting <br> </kbd>](#troubleshooting) 
|
||||
</div>
|
||||
|
||||
## About this repository
|
||||
It contains all my configuration files and the script permitting to install my configuration on any Arch-based Linux distribution or any Linux distribution (as long as you can install [that](#prerequisites)).
|
||||
|
||||
**Overview :**
|
||||
- [💻 OS]():
|
||||
- [Arch Linux 💥](https://archlinux.org/)
|
||||
- [🪟 Windows Manager]():
|
||||
- [HyprLand 🍚](https://hyprland.org/)
|
||||
- [📟 Widgets]():
|
||||
- [ Eww 🤢](https://github.com/elkowar/eww)
|
||||
- [👽 Terminal]():
|
||||
- [☄ Emulator]():
|
||||
- [Kitty 😽](https://sw.kovidgoyal.net/kitty/)
|
||||
- [🐚 Shell]():
|
||||
- [fish 🐟](https://fishshell.com/) with [Fisher 🎣](https://github.com/jorgebucaran/fisher)
|
||||
- [Zsh 📡]() with [Zinit 🌻](https://github.com/zdharma-continuum/zinit)
|
||||
- [Bash 📻]()
|
||||
- **🤖 Prompt**: [Oh-My-Posh 🔋](https://ohmyposh.dev/)
|
||||
- [📝 Editor]():
|
||||
- [Vim 👾](https://www.vim.org/)
|
||||
- [NeoVim 👓](https://neovim.io/) with [NvChad 🗿](https://nvchad.com/)
|
||||
- [🔎 Browser]():
|
||||
- [Firefox 🌐](https://www.mozilla.org/fr/firefox/)
|
||||
|
||||
Check the `utils/packages` file to see all the packages installed by the script.
|
||||
|
||||
<hr style="height:10px">
|
||||
|
||||
## Installation
|
||||
### Prerequisites
|
||||
`Git`, `pacman` and `sudo` are necessary, be sure to have them install and configure!
|
||||
You may want to install the appropriate [driver](https://wiki.archlinux.org/title/NVIDIA) if you have an NVIDIA GPU.
|
||||
|
||||
### Installation guide
|
||||
Clone this repository in your home directory with the `git clone` command.
|
||||
```
|
||||
git clone https://gitea.hexasec.io/tombdf/.dotfiles.git ~/.dotfiles
|
||||
```
|
||||
Then execute the `install.sh` script file.
|
||||
```
|
||||
~/.dotfiles/install.sh
|
||||
```
|
||||
> [!CAUTION]
|
||||
> I do **NOT** recommand you to change the name of the `.dotfiles` directory nor do I recommand you to place the folder somewhere else than the home directory.
|
||||
|
||||
### Finishing the configuration
|
||||
The script will end by itself. I recommend you to restart your computer.
|
||||
After restarting and opening the terminal, Fisher will install all the plugins.
|
||||
If you have access to Github Copilot, I recommend you to log in neovim with the `Copilot auth` command.
|
||||
I also recommend you to launch Firefox and create a Betterfox profile (using the `~/.config/betterfox/` folder). You can follow [this tutorial](https://github.com/yokoffing/Betterfox?tab=readme-ov-file). You may want to add an DNS in `user.js` (search line `user_pref("network.trr.uri", "");`).
|
||||
You may also setup the DNS in `/etc/systemd/resolved.conf` (I use [NextDNS](https://nextdns.io/) for that).
|
||||
Once you've done that, it's all good, enjoy your new config!
|
||||
PS: Don't forget to check the log file
|
||||
|
||||
<hr style="height:10px">
|
||||
|
||||
## Usage
|
||||
The following sections will resume what usage you can have of different commands, text editors or terminal emulator.
|
||||
|
||||
### Commands
|
||||
With Zsh and Zinit, a lot of commands will be installed. They're very useful and powerful so it might be a good idea to learn what they are.
|
||||
Note : Two keybindings are define in `.zshrc`. They are <Ctrl>p and <Crtl>n. Use them for navigate in your command history.
|
||||
|
||||
#### Zoxide
|
||||
**Commands** : `z` | `zi`
|
||||
**Replaced by** : `cd` | `cdi`
|
||||
[Github page](https://github.com/ajeetdsouza/zoxide)
|
||||
|
||||
Zoxide is a **cd** replacement. It will work fine as cd does, but every time you use the command, it will remember the path to the directory.
|
||||
After a little bit of time using the command, you could use it to "jump" to a repository i.e. you could only write a part of the path to the directory. You could also not write the entire name of the directory.
|
||||
If you want to see all the repository remembered by Zoxide, you can use the `cdi` command.
|
||||
**Note** : Zoxide integrate a system to replace the original `z` command by another (alternative to alias). That mean that only the "new" command work, not the original work. You can find the command in the Shell configuration file.
|
||||
|
||||
Usage of the command : `tldr zoxide`
|
||||
|
||||
<hr>
|
||||
|
||||
#### Lsd
|
||||
**Command** : `lsd`
|
||||
**Aliased by** : `ls` | `ll`
|
||||
[Github page](https://github.com/lsd-rs/lsd-rs)
|
||||
|
||||
Lsd is a **ls** replacement. It will add colors, icons and even git status to the display.
|
||||
The `ll` alias will print all the informations on all the files (including hidden files) in a directory. Check the aliases in the Shell configuration file.
|
||||
|
||||
Usage of the command : `tldr lsd`
|
||||
|
||||
<hr>
|
||||
|
||||
#### Rip
|
||||
**Command** : `rip`
|
||||
**Aliased by** : `rm`
|
||||
[Github page](https://github.com/nivekuil/rip)
|
||||
|
||||
Rip is a **rm** replacement. It will send all the deleted files to the graveyard (`/tmp/graveyard-$USER` or `$XDG_DATA_HOME/graveyard`), which means that the files can be restored.
|
||||
The files can only be deleted permanently by deleting the entire graveyard with the appropriate flag. Note that the graveyard can be put where you want with the right option.
|
||||
|
||||
Usage of the command : `tldr rip`
|
||||
|
||||
<hr>
|
||||
|
||||
#### Bat
|
||||
**Command** : `bat`
|
||||
**Aliased by** : `cat`
|
||||
[Github page](https://github.com/sharkdp/bat)
|
||||
|
||||
Bat is a **cat** replacement. It supports syntax-highlighting and git integration.
|
||||
It can be use as a pager.
|
||||
|
||||
Usage of the command : `tldr bat`
|
||||
|
||||
<hr>
|
||||
|
||||
#### Ripgrep
|
||||
**Command** : `rg`
|
||||
**Aliased by** : `grep`
|
||||
[Github page](https://github.com/BurntSushi/ripgrep)
|
||||
|
||||
Ripgrep is a **grep** replacement. It's a faster and recursive alternative to the original command.
|
||||
|
||||
Usage of the command : `tldr rg`
|
||||
|
||||
<hr>
|
||||
|
||||
#### Fd
|
||||
**Command** : `fd`
|
||||
**Aliased by** : `find`
|
||||
[Github page](https://github.com/sharkdp/fd)
|
||||
|
||||
Fd is a **find** replacement. It's a faster and more user-friendly alternative to the original command.
|
||||
The alias is set to show the hidden directory as well. Check the alias in the Shell configuration file.
|
||||
|
||||
Usage of the command : `tldr fd`
|
||||
|
||||
<hr>
|
||||
|
||||
#### Sd
|
||||
**Command** : `sd`
|
||||
**Aliased by** : `sed`
|
||||
[Github page](https://github.com/chmln/sd)
|
||||
|
||||
Sd is a **sed** replacement. It's a faster and more intuitive alternative to the original command.
|
||||
|
||||
Usage of the command : `tldr sd`
|
||||
|
||||
<hr>
|
||||
|
||||
#### Topgrade
|
||||
**Command** : `topgrade`
|
||||
[Github page](https://github.com/topgrade-rs/topgrade)
|
||||
|
||||
Topgrade permit to update, not only the system, but also all the packages and the git repository. It update **ALL** the things.
|
||||
|
||||
Usage of the command : `tldr topgrade`
|
||||
|
||||
<hr>
|
||||
|
||||
#### Tealdeer
|
||||
**Command** : `tldr`
|
||||
[Github page](https://github.com/dbrgn/tealdeer)
|
||||
|
||||
Tealdeer is a faster TLDR. It shows you pages written by community on different commands and programs.
|
||||
The pages shows different common and useful uses of commands.
|
||||
|
||||
### Text editors
|
||||
Differents text editors are available with my config. They're very powerful if you know how to use them and if you know the right keyboard shortcuts.
|
||||
|
||||
#### Vim
|
||||
**Command** : `vim`
|
||||
**Replaced by** : `vi`
|
||||
**Leader** : `,`
|
||||
|
||||
Vim is installed with vim-plug plugin manager and the Gruvbox theme. In Vim, you can use the `PlugInstall` command to install the plugin, and `Minimap` to toggle the minimap.
|
||||
In Insert mode, you can use the `jj` mapping to go in Normal mode, and type Space to enter Command mode.
|
||||
Also in Insert mode, you can use the `<leader>'` mapping to open a block instruction.
|
||||
In Normal mode, use the `j`|`k`|`l`|`m` keys to move. Use the `<Ctrl-n>` mapping to open NerdTree.
|
||||
|
||||
To see all the mappings, check the `.vimrc` config file.
|
||||
|
||||
<hr>
|
||||
|
||||
#### Neovim with NvChad
|
||||
**Command** : `nvim`
|
||||
**Aliased by** : `vim`
|
||||
**Leader** : `,`
|
||||
[NvChad Github page](https://github.com/NvChad/NvChad)
|
||||
|
||||
Neovim is installed with the NvChad config. The basics mappings in Neovim are the same as the ones describes [here](#Vim).
|
||||
To see (almost) all the mappings, use the `<leader>ch` mapping.
|
||||
Use the `Lazy` command in Neovim to manage the plugins, and the `Mason` command to manage LSP.
|
||||
Type the `Copilot` command and type `tab` to see all the command available to use Copilot and CopilotChat.
|
||||
|
||||
To see all the mappings, check the `mappings.lua` file in `.config/nvim/lua/`. To see all the plugins, check the `plugins.lua` file in `.config/nvim/lua/plugins`.
|
||||
|
||||
### Terminal emulator
|
||||
Kitty is the terminal emulator use in this config.
|
||||
The leader key is Ctrl+Shift, here is a list of useful mappings :
|
||||
* `<leader>t` : Create a new tab.
|
||||
* `<leader>q` : Close a tab.
|
||||
* `<leader><Enter>` : Split a tab.
|
||||
* `<leader><Directional-arrow>` : Move between the different tab.
|
||||
|
||||
Check the `kitty.conf` file in `.config/kitty/` to see all the possibility offered by Kitty.
|
||||
|
||||
<hr style="height:10px">
|
||||
|
||||
## Troubleshooting
|
||||
Before doing anything, verify that all the packages listed [here](#necessary-packages) are installed with the latest stable version.
|
||||
|
||||
### Fish
|
||||
If something went wrong when sourcing the config file, it might be that fish_inclusion was not delete preventing, when sourcing the file again, the downloading or the call of certains plugins.
|
||||
To fix that, you just have to run manually the command to reset the variable : set -e fish_inclusion
|
||||
|
||||
### Neovim
|
||||
If NvChad seems not to be installed, be sure to have the latest version of Neovim installed.
|
||||
For any problem with a plugin, use the `checkhealth` command and see if anything wrong with the plugin is mentioned.
|
||||
If you get an error message like this : **"Client 1 quit with code 1"**, it might mean that a package is missing for Mason to work correctly.
|
||||
49
install.sh
Executable file
49
install.sh
Executable file
@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
clear
|
||||
|
||||
# Enable strict mode for bash
|
||||
set -euo pipefail
|
||||
|
||||
# Define functions and colors
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "${SCRIPT_DIR}/utils/colors.sh"
|
||||
source "${SCRIPT_DIR}/utils/helpers.sh"
|
||||
|
||||
LOG="install.log"
|
||||
[ -f "$LOG" ] && rm -f "$LOG"
|
||||
touch "$LOG"
|
||||
|
||||
# Displau logo and information
|
||||
display_header
|
||||
|
||||
# Initial checks
|
||||
check_not_root
|
||||
check_internet
|
||||
check_arch
|
||||
|
||||
# Request confirmation
|
||||
echo "┌──────────────────────────────────────┐"
|
||||
echo "│ Start Setup? (y/N) │"
|
||||
echo "└──────────────────────────────────────┘"
|
||||
read -p "~> " inst
|
||||
case $inst in
|
||||
y | Y) echo -e "\nStarting setup..." ;;
|
||||
*) echo -e "\nSetup cancelled." && exit 0 ;;
|
||||
esac
|
||||
|
||||
# Install components
|
||||
source "${SCRIPT_DIR}/scripts/core.sh"
|
||||
source "${SCRIPT_DIR}/scripts/desktop.sh"
|
||||
source "${SCRIPT_DIR}/scripts/shells.sh"
|
||||
source "${SCRIPT_DIR}/scripts/development.sh"
|
||||
|
||||
# Setup configuration files
|
||||
echo -e "${GREEN}Setting up configuration files...${DEFAULT}"
|
||||
setup_dotfiles
|
||||
|
||||
# Final configuration
|
||||
setup_final
|
||||
|
||||
echo -e "${GREEN}Installation completed successfully!${DEFAULT}"
|
||||
echo -e "Please reboot your system to apply all changes."
|
||||
exit 0
|
||||
22
scripts/core.sh
Normal file
22
scripts/core.sh
Normal file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo -e "${GREEN}Installing core packages...${DEFAULT}"
|
||||
|
||||
# Installation of core packages
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "base-devel doxygen jdk-openjdk nodejs npm cargo curl wget unzip stow"
|
||||
|
||||
# Installation of yay
|
||||
if ! command -v yay &> /dev/null; then
|
||||
echo -e "${BLUE}Installing Yay...${DEFAULT}"
|
||||
git clone https://aur.archlinux.org/yay.git ~/.config/yay
|
||||
(cd ~/.config/yay && makepkg -si --noconfirm)
|
||||
rm -rf ~/.config/yay
|
||||
fi
|
||||
|
||||
# Verification of yay installation
|
||||
if ! command -v yay &> /dev/null; then
|
||||
echo -e "${RED}[ERROR] Yay installation failed${DEFAULT}" | tee -a "$LOG"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Core installation completed${DEFAULT}"
|
||||
35
scripts/desktop.sh
Normal file
35
scripts/desktop.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Installing Hyprland core components
|
||||
echo -e "${GREEN}Installing Hyprland core components...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "wayland hyprland waybar hyprpaper xdg-desktop-portal-hyprland xdg-desktop-portal-gtk polkit-gnome"
|
||||
|
||||
# Installing audio components
|
||||
echo -e "${GREEN}Installing audio components...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "pipewire pipewire-pulse wireplumber pamixer pavucontrol"
|
||||
|
||||
# Installing system utilities
|
||||
echo -e "${GREEN}Installing system utilities...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "brightnessctl networkmanager network-manager-applet blueman inetutils"
|
||||
|
||||
# Installing GUI applications
|
||||
echo -e "${GREEN}Installing GUI applications...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "rofi thunar thunar-archive-plugin mpv imv"
|
||||
|
||||
# Installing theme tools
|
||||
echo -e "${GREEN}Installing Qt/GTK configuration tools...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "qt5-wayland qt6-wayland qt5ct qt6ct kvantum kvantum-qt5"
|
||||
|
||||
# Installing AUR packages
|
||||
echo -e "${GREEN}Installing AUR packages...${DEFAULT}"
|
||||
check_installation "yay -S --noconfirm --needed" "ttf-jetbrains-mono-nerd swaylock-effects wlogout gruvbox-material-gtk-theme-git gruvbox-material-icon-theme-git bibata-cursor-theme"
|
||||
|
||||
# Installing Firefox
|
||||
echo -e "${GREEN}Installing Firefox...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm" "firefox"
|
||||
|
||||
# Configuring Firefox
|
||||
mkdir -p $HOME/.config/betterfox/
|
||||
git update-index --assume-unchanged ~/.dotfiles/.config/betterfox/user.js
|
||||
|
||||
echo -e "${GREEN}Desktop environment installation completed${DEFAULT}"
|
||||
20
scripts/development.sh
Normal file
20
scripts/development.sh
Normal file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Installing Vim
|
||||
echo -e "${GREEN}Setting up Vim...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "vim"
|
||||
mkdir -p $HOME/.vim/{autoload,backup,colors,plugged}
|
||||
curl -fLo $HOME/.vim/autoload/plug.vim --create-dirs "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
|
||||
check_installation "yay -S --noconfirm --needed" "code-minimap"
|
||||
|
||||
# Installing NeoVim
|
||||
echo -e "${GREEN}Setting up NeoVim...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "neovim wl-clipboard"
|
||||
|
||||
# Installing Kitty
|
||||
echo -e "${GREEN}Setting up Kitty...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "kitty"
|
||||
echo -e "${GREEN}Setting up Gruvbox theme for Kitty...${DEFAULT}"
|
||||
mkdir -p $HOME/.config/kitty
|
||||
git clone --depth 1 https://github.com/dexpota/kitty-themes.git $HOME/.config/kitty/kitty-themes
|
||||
ln -sf kitty-themes/themes/gruvbox_dark.conf $HOME/.config/kitty/theme.conf
|
||||
68
scripts/shells.sh
Normal file
68
scripts/shells.sh
Normal file
@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Installing alternative shells
|
||||
echo -e "${GREEN}Installing alternative shells...${DEFAULT}"
|
||||
|
||||
# Installing and configuring Zsh
|
||||
echo -e "${BLUE}Setting up Zsh and Powerline...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "zsh powerline"
|
||||
|
||||
# Installing and configuring Fish
|
||||
echo -e "${BLUE}Setting up Fish...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "fish"
|
||||
mkdir -p ~/.config/fish/
|
||||
|
||||
# Installing prompt themes
|
||||
echo -e "${BLUE}Installing Oh-My-Posh...${DEFAULT}"
|
||||
check_installation "yay -S --noconfirm --needed" "oh-my-posh"
|
||||
|
||||
# Installing navigation and search tools
|
||||
echo -e "${GREEN}Installing navigation and search tools...${DEFAULT}"
|
||||
|
||||
# Zoxide - An intelligent cd that learns your habits
|
||||
echo -e "${BLUE}Setting up Zoxide and FZF...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "zoxide fzf"
|
||||
|
||||
# Installing modern alternatives to classic Unix commands
|
||||
echo -e "${GREEN}Installing modern Unix tools...${DEFAULT}"
|
||||
|
||||
# lsd - A modern ls with a icons and coloring
|
||||
echo -e "${BLUE}Installing lsd...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "lsd"
|
||||
|
||||
# rip - A modern alternative to rm
|
||||
echo -e "${BLUE}Installing rip (rm-improved)...${DEFAULT}"
|
||||
check_installation "yay -S --noconfirm --needed" "rm-improved-git"
|
||||
|
||||
# bat - A modern cat with syntax highlighting
|
||||
echo -e "${BLUE}Installing bat...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "bat"
|
||||
|
||||
# ripgrep - A modern alternative to grep
|
||||
echo -e "${BLUE}Installing ripgrep...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "ripgrep"
|
||||
|
||||
# fd - A modern alternative to find
|
||||
echo -e "${BLUE}Installing fd...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "fd"
|
||||
|
||||
# sd - A modern alternative to sed
|
||||
echo -e "${BLUE}Installing sd...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "sd"
|
||||
|
||||
# Installing maintenance tools
|
||||
echo -e "${GREEN}Installing maintenance tools...${DEFAULT}"
|
||||
|
||||
# Topgrade - Universal update tool
|
||||
echo -e "${BLUE}Installing Topgrade...${DEFAULT}"
|
||||
check_installation "yay -S --noconfirm --needed" "topgrade"
|
||||
|
||||
# Tealdeer - A fast implementation of tldr
|
||||
echo -e "${BLUE}Installing TLDR (tealdeer)...${DEFAULT}"
|
||||
check_installation "sudo pacman -S --noconfirm --needed" "tealdeer"
|
||||
|
||||
# Changing the default shell to Fish
|
||||
echo -e "${GREEN}Setting Fish as default shell...${DEFAULT}"
|
||||
chsh -s $(which fish)
|
||||
|
||||
echo -e "${GREEN}Shell configuration completed${DEFAULT}"
|
||||
8
utils/colors.sh
Normal file
8
utils/colors.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Definition of colors
|
||||
BLUE="\033[1;34m"
|
||||
GREEN="\e[32m"
|
||||
RED="\e[31m"
|
||||
YELLOW="\e[33m"
|
||||
DEFAULT="\033[0m"
|
||||
161
utils/helpers.sh
Normal file
161
utils/helpers.sh
Normal file
@ -0,0 +1,161 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check that the script is not run as root
|
||||
function check_not_root() {
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
echo -e "${RED}[ERROR] This script shall not be executed as root${DEFAULT}" | tee -a "$LOG"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Check that an internet connection is available
|
||||
function check_internet() {
|
||||
if ping -q -c 1 -W 1 archlinux.org >/dev/null; then
|
||||
echo -e "${GREEN}Internet connection is available${DEFAULT}" | tee -a "$LOG"
|
||||
else
|
||||
echo -e "${RED}[ERROR] Internet connection is not available${DEFAULT}" | tee -a "$LOG"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Check that the system is Arch Linux
|
||||
function check_arch() {
|
||||
if [ -f "/etc/arch-release" ]; then
|
||||
echo -e "${GREEN}Arch Linux detected${DEFAULT}" | tee -a "$LOG"
|
||||
else
|
||||
echo -e "${RED}[ERROR] Arch Linux not detected${DEFAULT}" | tee -a "$LOG"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Secure installation of packages
|
||||
function check_installation() {
|
||||
local command=$1
|
||||
local package=$2
|
||||
echo -e "${BLUE}Installing $package...${DEFAULT}" | tee -a "$LOG"
|
||||
|
||||
if ! $command $package; then
|
||||
echo -e "${RED}[ERROR] Installation of $package failed${DEFAULT}" | tee -a "$LOG"
|
||||
return 1
|
||||
fi
|
||||
echo -e "${GREEN}$package installed successfully${DEFAULT}" | tee -a "$LOG"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Configuration backup function
|
||||
function backup_config() {
|
||||
local path=$1
|
||||
if [ -e "$path" ]; then # Vérifie si le fichier ou le répertoire existe
|
||||
local backup_path="${path}.backup.$(date +%Y%m%d_%H%M%S)"
|
||||
echo -e "${BLUE}Backing up $path to $backup_path${DEFAULT}" | tee -a "$LOG"
|
||||
mv "$path" "$backup_path"
|
||||
fi
|
||||
}
|
||||
|
||||
# Final system configuration
|
||||
function setup_final() {
|
||||
echo -e "${BLUE}Performing final system configuration...${DEFAULT}" | tee -a "$LOG"
|
||||
|
||||
# Enable systemd services
|
||||
systemctl --user enable --now pipewire.service
|
||||
systemctl --user enable --now pipewire-pulse.service
|
||||
|
||||
# Configure git if necessary
|
||||
if [ -z "$(git config --global user.name)" ]; then
|
||||
echo -e "${BLUE}Configuring Git...${DEFAULT}"
|
||||
read -p "Enter your Git name: " git_name
|
||||
read -p "Enter your Git email: " git_email
|
||||
git config --global user.name "$git_name"
|
||||
git config --global user.email "$git_email"
|
||||
fi
|
||||
|
||||
# Setting up Vim plugins
|
||||
echo -e "${GREEN}Installing Vim plugins...${DEFAULT}"
|
||||
vim -E -s -u "~/.vimrc" +PlugInstall +qall >/dev/null 2>&1
|
||||
|
||||
# Setting up NeoVim plugins
|
||||
echo -e "${GREEN}Installing NeoVim plugins...${DEFAULT}"
|
||||
nvim +Lazy +MasonInstallAll +MasonUpdate +180sleep +qall
|
||||
|
||||
# Clean up the system
|
||||
echo -e "${BLUE}Cleaning up the system...${DEFAULT}" | tee -a "$LOG"
|
||||
yay -Yc --noconfirm
|
||||
}
|
||||
|
||||
# Display logo and information
|
||||
function display_header() {
|
||||
echo -e "${BLUE}"
|
||||
cat <<"EOF"
|
||||
|
||||
▄
|
||||
▄█▄
|
||||
▄███▄
|
||||
▄█████▄ ██████ ██████ ████████ ███████ ██ ██ ███████ ███████
|
||||
▄███████▄ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
▄ ▀▀██████▄ ██ ██ ██ ██ ██ █████ ██ ██ █████ ███████
|
||||
▄██▄▄ ▀█████▄ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
▄█████████████▄ ██ ██████ ██████ ██ ██ ██ ███████ ███████ ███████
|
||||
▄███████████████▄
|
||||
▄█████████████████▄
|
||||
▄███████████████████▄ ┌───────────────────────────────────────────────────────────┐
|
||||
▄█████████▀▀▀▀████████▄ │ │
|
||||
▄████████▀ ▀███████▄ │ • "Welcome to the Arch Linux DotFiles Setup Script!" │
|
||||
▄█████████ ████▀▀██▄ │ │
|
||||
▄██████████ █████▄▄▄ │ • Created by Thomas Brasdefer │
|
||||
▄██████████▀ ▀█████████▄ │ • Find me at hexasec.io or gitea.hexasec.io/tombdf │
|
||||
▄██████▀▀▀ ▀▀██████▄ │ for more. │
|
||||
▄███▀▀ ▀▀███▄ └───────────────────────────────────────────────────────────┘
|
||||
▄▀▀ ▀▀▄
|
||||
|
||||
Notes.
|
||||
- Operation on non-Arch Linux based is not guaranteed.
|
||||
- NVIDIA GPUs are supported.
|
||||
- Do not run this script as root.
|
||||
- Do NOT interrupt the script, it will end by itself.
|
||||
EOF
|
||||
echo -e "${DEFAULT}"
|
||||
}
|
||||
|
||||
# Function to manage configurations files with stow
|
||||
function setup_dotfiles() {
|
||||
echo -e "${BLUE}Setting up configuration files...${DEFAULT}" | tee -a "$LOG"
|
||||
|
||||
# Check for existence of .dotfiles directory
|
||||
if [ ! -d "$HOME/.dotfiles" ]; then
|
||||
echo -e "${RED}[ERROR] .dotfiles directory not found${DEFAULT}" | tee -a "$LOG"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Backup existing configurations
|
||||
local configs_to_backup=(
|
||||
"$HOME/.config/hypr/"
|
||||
"$HOME/.config/waybar/"
|
||||
"$HOME/.config/nvim/"
|
||||
"$HOME/.config/ohmyposh/"
|
||||
"$HOME/.vimrc"
|
||||
"$HOME/.bashrc"
|
||||
"$HOME/.zshrc"
|
||||
"$HOME/.config/fish/fish.config"
|
||||
)
|
||||
|
||||
for config in "${configs_to_backup[@]}"; do
|
||||
backup_config "$config"
|
||||
done
|
||||
|
||||
# Apply configurations with stow
|
||||
echo -e "${BLUE}Applying dotfiles with stow...${DEFAULT}" | tee -a "$LOG"
|
||||
cd "$HOME/.dotfiles" || exit 1
|
||||
|
||||
# Unstow first in case of existing links
|
||||
stow -D . 2>/dev/null || true
|
||||
|
||||
# Stow new configuration
|
||||
if stow .; then
|
||||
echo -e "${GREEN}Configuration files installed successfully${DEFAULT}" | tee -a "$LOG"
|
||||
else
|
||||
echo -e "${RED}[ERROR] Failed to install configuration files${DEFAULT}" | tee -a "$LOG"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
66
utils/packages
Normal file
66
utils/packages
Normal file
@ -0,0 +1,66 @@
|
||||
base-devel
|
||||
doxygen
|
||||
jdk-openjdk
|
||||
nodejs
|
||||
npm
|
||||
cargo
|
||||
curl
|
||||
wget
|
||||
unzip
|
||||
stow
|
||||
yay
|
||||
wayland
|
||||
hyprland
|
||||
waybar
|
||||
hyprpaper
|
||||
xdg-desktop-portal-hyprland
|
||||
xdg-desktop-portal-gtk
|
||||
polkit-gnome
|
||||
pipewire
|
||||
pipewire-pulse
|
||||
wireplumber
|
||||
pamixer
|
||||
pavucontrol
|
||||
brightnessctl
|
||||
networkmanager
|
||||
network-manager-applet
|
||||
blueman
|
||||
inetutils
|
||||
rofi
|
||||
thunar
|
||||
thunar-archive-plugin
|
||||
mpv
|
||||
imv
|
||||
qt5-wayland
|
||||
qt6-wayland
|
||||
qt5ct
|
||||
qt6ct
|
||||
kvantum
|
||||
kvantum-qt5
|
||||
ttf-jetbrains-mono-nerd
|
||||
swaylock-effects
|
||||
wlogout
|
||||
gruvbox-material-gtk-theme-git
|
||||
gruvbox-material-icon-theme-git
|
||||
bibata-cursor-theme
|
||||
firefox
|
||||
vim
|
||||
vim-plug
|
||||
code-minimap
|
||||
neovim
|
||||
wl-clipboard
|
||||
kitty
|
||||
kitty-themes
|
||||
zsh
|
||||
powerline
|
||||
fish
|
||||
oh-my-posh
|
||||
zoxide fzf
|
||||
lsd
|
||||
rm-improved-git
|
||||
bat
|
||||
ripgrep
|
||||
fd
|
||||
sd
|
||||
topgrade
|
||||
tealdeer
|
||||
Loading…
Reference in New Issue
Block a user