lots of shit
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
printfe "%s\n" "cyan" "Exporting GNOME extensions"
|
||||
source ~/dotfiles/bin/helpers/gnome_extensions.sh
|
||||
source $HOME/dotfiles/bin/helpers/gnome_extensions.sh
|
||||
export_gnome_extensions
|
||||
|
||||
printfe "%s\n" "cyan" "Exporting VSCode extensions"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
# Check for unencrypted files in .ssh/config.d/
|
||||
unencrypted_files=$(find config/ssh/config.d/ -type f ! -name "*.gpg")
|
||||
|
@@ -1,13 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
# Print logo
|
||||
tput setaf 2
|
||||
cat ~/dotfiles/bin/resources/logo.txt
|
||||
cat $HOME/dotfiles/bin/resources/logo.txt
|
||||
println " " "cyan"
|
||||
tput sgr0
|
||||
|
||||
# Print help
|
||||
cat ~/dotfiles/bin/resources/help.txt
|
||||
cat $HOME/dotfiles/bin/resources/help.txt
|
||||
println " " "cyan"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
####################################################################################################
|
||||
# Decrypt secrets
|
||||
|
@@ -1,13 +1,13 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source ~/dotfiles/bin/helpers/keyboard_shortcuts.sh
|
||||
source ~/dotfiles/bin/helpers/apt_packages.sh
|
||||
source ~/dotfiles/bin/helpers/pipx_packages.sh
|
||||
source ~/dotfiles/bin/helpers/cargo_packages.sh
|
||||
source ~/dotfiles/bin/helpers/flatpak_packages.sh
|
||||
source ~/dotfiles/bin/helpers/vscode-extensions.sh
|
||||
source ~/dotfiles/bin/helpers/fonts.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
source $HOME/dotfiles/bin/helpers/keyboard_shortcuts.sh
|
||||
source $HOME/dotfiles/bin/helpers/apt_packages.sh
|
||||
source $HOME/dotfiles/bin/helpers/pipx_packages.sh
|
||||
source $HOME/dotfiles/bin/helpers/cargo_packages.sh
|
||||
source $HOME/dotfiles/bin/helpers/flatpak_packages.sh
|
||||
source $HOME/dotfiles/bin/helpers/vscode-extensions.sh
|
||||
source $HOME/dotfiles/bin/helpers/fonts.sh
|
||||
|
||||
# Check if parameter --verbose was passed
|
||||
if [ "$2" = "--verbose" ]; then
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
logo continue
|
||||
|
@@ -1,14 +1,6 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
printfe "%s\n" "cyan" "Pulling latest changes..."
|
||||
git -C ~/dotfiles pull
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" "Failed to pull latest changes"
|
||||
exit 1
|
||||
fi
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
# check if --verbose was passed
|
||||
if [ "$2" = "--verbose" ]; then
|
||||
@@ -18,114 +10,274 @@ else
|
||||
export verbose=false
|
||||
fi
|
||||
|
||||
####################################################################################################
|
||||
# Update symlinks
|
||||
####################################################################################################
|
||||
pull_dotfiles() {
|
||||
####################################################################################################
|
||||
# Pull latest dotfiles
|
||||
####################################################################################################
|
||||
|
||||
printfe "%s\n" "cyan" "Updating symlinks..."
|
||||
check_or_make_symlink ~/.zshrc ~/dotfiles/zshrc
|
||||
check_or_make_symlink ~/.config/Code/User/settings.json ~/dotfiles/vscode/settings.json
|
||||
check_or_make_symlink ~/.config/starship.toml ~/dotfiles/config/starship.toml
|
||||
printfe "%s\n" "cyan" "Pulling latest changes..."
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
check_or_make_symlink ~/.gitconfig ~/dotfiles/config/gitconfig.macos
|
||||
else
|
||||
check_or_make_symlink ~/.gitconfig ~/dotfiles/config/gitconfig.linux
|
||||
fi
|
||||
result=$(git -C $HOME/dotfiles pull --ff-only)
|
||||
|
||||
check_or_make_symlink ~/.ssh/config ~/dotfiles/config/ssh/config
|
||||
check_or_make_symlink ~/.ssh/config.d ~/dotfiles/config/ssh/config.d
|
||||
check_or_make_symlink ~/.wezterm.lua ~/dotfiles/config/wezterm.lua
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" " - Failed to pull latest changes"
|
||||
printfe "%s\n" "red" " Result: $result"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
####################################################################################################
|
||||
# Update system packages
|
||||
####################################################################################################
|
||||
# In case it failed to pull due to conflicts, stop and notify the user
|
||||
if [[ $result == *"CONFLICT"* ]]; then
|
||||
printfe "%s\n" "red" " - Failed to pull latest changes"
|
||||
printfe "%s\n" "red" " Result: $result"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printfe "%s\n" "cyan" "Updating system packages..."
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
brew update
|
||||
brew upgrade
|
||||
brew cleanup
|
||||
else
|
||||
sudo nala upgrade -y
|
||||
sudo nala autoremove -y --purge
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" "Failed to pull latest changes"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
groups() {
|
||||
####################################################################################################
|
||||
# Ensure user groups
|
||||
####################################################################################################
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring user groups..."
|
||||
source $HOME/dotfiles/bin/helpers/user_groups.sh
|
||||
ensure_user_groups
|
||||
}
|
||||
|
||||
symlinks() {
|
||||
####################################################################################################
|
||||
# Update symlinks
|
||||
####################################################################################################
|
||||
|
||||
printfe "%s\n" "cyan" "Updating config symlinks..."
|
||||
check_or_make_symlink ~/.zshrc ~/dotfiles/.zshrc
|
||||
check_or_make_symlink ~/.config/Code/User/settings.json ~/dotfiles/vscode/settings.json
|
||||
check_or_make_symlink ~/.config/starship.toml ~/dotfiles/config/starship.toml
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
check_or_make_symlink ~/.gitconfig ~/dotfiles/config/gitconfig.macos
|
||||
else
|
||||
check_or_make_symlink ~/.gitconfig ~/dotfiles/config/gitconfig.linux
|
||||
fi
|
||||
|
||||
check_or_make_symlink ~/.ssh/config ~/dotfiles/config/ssh/config
|
||||
check_or_make_symlink ~/.ssh/config.d ~/dotfiles/config/ssh/config.d
|
||||
check_or_make_symlink ~/.config/alacritty/alacritty.toml ~/dotfiles/config/alacritty.toml
|
||||
|
||||
}
|
||||
|
||||
sys_packages() {
|
||||
####################################################################################################
|
||||
# Update system packages
|
||||
####################################################################################################
|
||||
|
||||
printfe "%s\n" "cyan" "Updating system packages..."
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
brew update
|
||||
brew upgrade
|
||||
brew cleanup
|
||||
else
|
||||
sudo nala upgrade -y
|
||||
sudo nala autoremove -y --purge
|
||||
fi
|
||||
}
|
||||
|
||||
####################################################################################################
|
||||
# Update packages
|
||||
####################################################################################################
|
||||
|
||||
printfe "%s\n" "cyan" "Oh My Zsh update..."
|
||||
source ~/dotfiles/bin/helpers/ohmyzsh.sh
|
||||
ensure_ohmyzsh_installed
|
||||
cargopkgs() {
|
||||
printfe "%s\n" "cyan" "Rust update..."
|
||||
source $HOME/dotfiles/bin/helpers/rust.sh
|
||||
ensure_rust_installed
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring Cargo packages are installed..."
|
||||
source $HOME/dotfiles/bin/helpers/cargo_packages.sh
|
||||
ensure_cargo_packages_installed
|
||||
}
|
||||
|
||||
printfe "%s\n" "cyan" "Rust update..."
|
||||
source ~/dotfiles/bin/helpers/rust.sh
|
||||
ensure_rust_installed
|
||||
aptpkgs() {
|
||||
printfe "%s\n" "cyan" "Ensuring APT repositories are added..."
|
||||
source $HOME/dotfiles/bin/helpers/apt_packages.sh
|
||||
ensure_repositories
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring APT repositories are added..."
|
||||
source ~/dotfiles/bin/helpers/apt_packages.sh
|
||||
ensure_repositories
|
||||
printfe "%s\n" "cyan" "Ensuring APT packages are installed..."
|
||||
ensure_apt_packages_installed
|
||||
}
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring APT packages are installed..."
|
||||
ensure_apt_packages_installed
|
||||
pipxpkgs() {
|
||||
printfe "%s\n" "cyan" "Ensuring pipx packages are installed..."
|
||||
source $HOME/dotfiles/bin/helpers/pipx_packages.sh
|
||||
ensure_pipx_packages_installed
|
||||
}
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring pipx packages are installed..."
|
||||
source ~/dotfiles/bin/helpers/pipx_packages.sh
|
||||
ensure_pipx_packages_installed
|
||||
flatpakpkgs() {
|
||||
printfe "%s\n" "cyan" "Ensuring Flatpak remotes are added..."
|
||||
source $HOME/dotfiles/bin/helpers/flatpak_packages.sh
|
||||
ensure_remotes_added
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring GNOME Extensions are installed..."
|
||||
source ~/dotfiles/bin/helpers/gnome_extensions.sh
|
||||
ensure_gnome_extensions_installed
|
||||
printfe "%s\n" "cyan" "Ensuring Flatpak packages are installed..."
|
||||
ensure_flatpak_packages_installed
|
||||
}
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring Cargo packages are installed..."
|
||||
source ~/dotfiles/bin/helpers/cargo_packages.sh
|
||||
ensure_cargo_packages_installed
|
||||
dockercmd() {
|
||||
printfe "%s\n" "cyan" "Ensuring Docker is installed..."
|
||||
source $HOME/dotfiles/bin/helpers/docker.sh
|
||||
ensure_docker_installed
|
||||
}
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring Flatpak remotes are added..."
|
||||
source ~/dotfiles/bin/helpers/flatpak_packages.sh
|
||||
ensure_remotes_added
|
||||
tailscalecmd() {
|
||||
printfe "%s\n" "cyan" "Ensuring Tailscale is installed..."
|
||||
source $HOME/dotfiles/bin/helpers/tailscale.sh
|
||||
ensure_tailscale_installed
|
||||
}
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring Flatpak packages are installed..."
|
||||
ensure_flatpak_packages_installed
|
||||
extensions() {
|
||||
printfe "%s\n" "cyan" "Ensuring GNOME Extensions are installed..."
|
||||
source $HOME/dotfiles/bin/helpers/gnome_extensions.sh
|
||||
ensure_gnome_extensions_installed
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring VSCode extensions are installed..."
|
||||
source ~/dotfiles/bin/helpers/vscode-extensions.sh
|
||||
ensure_vscode_extensions_installed
|
||||
printfe "%s\n" "cyan" "Ensuring VSCode extensions are installed..."
|
||||
source $HOME/dotfiles/bin/helpers/vscode-extensions.sh
|
||||
ensure_vscode_extensions_installed
|
||||
}
|
||||
|
||||
####################################################################################################
|
||||
# Update system settings
|
||||
####################################################################################################
|
||||
|
||||
printfe "%s\n" "cyan" "Setting up keyboard shortcuts..."
|
||||
source ~/dotfiles/bin/helpers/keyboard_shortcuts.sh
|
||||
ensure_keyboard_shortcuts
|
||||
keyboard() {
|
||||
printfe "%s\n" "cyan" "Setting up keyboard shortcuts..."
|
||||
source $HOME/dotfiles/bin/helpers/keyboard_shortcuts.sh
|
||||
ensure_keyboard_shortcuts
|
||||
}
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring fonts are installed..."
|
||||
source ~/dotfiles/bin/helpers/fonts.sh
|
||||
ensure_fonts_installed
|
||||
fonts() {
|
||||
printfe "%s\n" "cyan" "Ensuring fonts are installed..."
|
||||
source $HOME/dotfiles/bin/helpers/fonts.sh
|
||||
ensure_fonts_installed
|
||||
}
|
||||
|
||||
printfe "%s\n" "cyan" "Setting wezterm as default terminal..."
|
||||
if [ ! -f /usr/bin/wezterm ]; then
|
||||
printfe "%s\n" "red" "Wezterm is not installed"
|
||||
exit 1
|
||||
fi
|
||||
default_terminal() {
|
||||
printfe "%s\n" "cyan" "Setting alacritty as default terminal..."
|
||||
# Check if alacritty is installed
|
||||
if [ -x "$(command -v alacritty)" ]; then
|
||||
current_terminal=$(sudo update-alternatives --query x-terminal-emulator | grep '^Value:' | awk '{print $2}')
|
||||
|
||||
current_terminal=$(sudo update-alternatives --query x-terminal-emulator | grep '^Value:' | awk '{print $2}')
|
||||
if [ "$current_terminal" != $(which alacritty) ]; then
|
||||
printfe "%s\n" "yellow" " - Setting alacritty as default terminal"
|
||||
sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator $(which alacritty) 80
|
||||
else
|
||||
printfe "%s\n" "green" " - alacritty is already the default terminal"
|
||||
fi
|
||||
else
|
||||
printfe "%s\n" "red" " - alacritty is not installed"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$current_terminal" != "/usr/bin/wezterm" ]; then
|
||||
printfe "%s\n" "yellow" " - Setting wezterm as default terminal"
|
||||
sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/bin/wezterm 60
|
||||
default_shell() {
|
||||
printfe "%s\n" "cyan" "Setting zsh as default shell..."
|
||||
if [ "$SHELL" != "/usr/bin/zsh" ]; then
|
||||
printfe "%s\n" "yellow" " - Setting zsh as default shell"
|
||||
chsh -s /usr/bin/zsh
|
||||
else
|
||||
printfe "%s\n" "green" " - zsh is already the default shell"
|
||||
fi
|
||||
}
|
||||
|
||||
####################################################################################################
|
||||
# Parse arguments
|
||||
####################################################################################################
|
||||
|
||||
# Multiple options can be passed to the script, for example:
|
||||
# ./update.sh --verbose --groups --symlinks --packages --keyboard --fonts --default-terminal --default-shell
|
||||
# If no options are passed, the script will run all functions
|
||||
|
||||
# Shift the first argument since this is the script name
|
||||
shift
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
printfe "%s\n" "yellow" "No options passed, running full update..."
|
||||
|
||||
pull_dotfiles
|
||||
groups
|
||||
symlinks
|
||||
sys_packages
|
||||
cargopkgs
|
||||
aptpkgs
|
||||
pipxpkgs
|
||||
flatpakpkgs
|
||||
dockercmd
|
||||
tailscalecmd
|
||||
extensions
|
||||
keyboard
|
||||
fonts
|
||||
default_terminal
|
||||
default_shell
|
||||
else
|
||||
printfe "%s\n" "green" " - wezterm is already the default terminal"
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
--pull)
|
||||
pull_dotfiles
|
||||
;;
|
||||
--groups)
|
||||
groups
|
||||
;;
|
||||
--symlinks)
|
||||
symlinks
|
||||
;;
|
||||
--packages)
|
||||
sys_packages
|
||||
cargopkgs
|
||||
aptpkgs
|
||||
pipxpkgs
|
||||
flatpakpkgs
|
||||
dockercmd
|
||||
tailscalecmd
|
||||
;;
|
||||
--apt)
|
||||
aptpkgs
|
||||
;;
|
||||
--pipx)
|
||||
pipxpkgs
|
||||
;;
|
||||
--cargo)
|
||||
cargopkgs
|
||||
;;
|
||||
--flatpak)
|
||||
flatpakpkgs
|
||||
;;
|
||||
--docker)
|
||||
dockercmd
|
||||
;;
|
||||
--tailscale)
|
||||
tailscalecmd
|
||||
;;
|
||||
--extensions)
|
||||
extensions
|
||||
;;
|
||||
--keyboard)
|
||||
keyboard
|
||||
;;
|
||||
--fonts)
|
||||
fonts
|
||||
;;
|
||||
--default-terminal)
|
||||
default_terminal
|
||||
;;
|
||||
--default-shell)
|
||||
default_shell
|
||||
;;
|
||||
*)
|
||||
printfe "%s\n" "red" "Unknown option: $arg"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
printfe "%s\n" "cyan" "Setting zsh as default shell..."
|
||||
if [ "$SHELL" != "/usr/bin/zsh" ]; then
|
||||
printfe "%s\n" "yellow" " - Setting zsh as default shell"
|
||||
chsh -s /usr/bin/zsh
|
||||
else
|
||||
printfe "%s\n" "green" " - zsh is already the default shell"
|
||||
fi
|
||||
|
||||
printfe "%s\n" "green" "Update complete!"
|
||||
echo ""
|
||||
printfe "%s\n" "blue" "Done!"
|
||||
|
22
bin/dotf
22
bin/dotf
@@ -1,32 +1,33 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
export DOTFILES_CONFIG=$HOME/dotfiles/config/config.yaml
|
||||
|
||||
status() {
|
||||
~/dotfiles/bin/actions/status.sh $@
|
||||
$HOME/dotfiles/bin/actions/status.sh $@
|
||||
}
|
||||
|
||||
update() {
|
||||
~/dotfiles/bin/actions/update.sh $@
|
||||
$HOME/dotfiles/bin/actions/update.sh $@
|
||||
}
|
||||
|
||||
help() {
|
||||
~/dotfiles/bin/actions/help.sh $@
|
||||
$HOME/dotfiles/bin/actions/help.sh $@
|
||||
}
|
||||
|
||||
exports() {
|
||||
~/dotfiles/bin/actions/export.sh $@
|
||||
$HOME/dotfiles/bin/actions/export.sh $@
|
||||
}
|
||||
|
||||
secrets() {
|
||||
~/dotfiles/bin/actions/secrets.sh $@
|
||||
$HOME/dotfiles/bin/actions/secrets.sh $@
|
||||
}
|
||||
|
||||
ensure_git_hooks() {
|
||||
# If ~/dotfiles/.git/hooks is a symlink, skip this
|
||||
if [[ -L ~/dotfiles/.git/hooks ]]; then
|
||||
# Let's make sure the symlink is correct
|
||||
if [[ $(readlink ~/dotfiles/.git/hooks) != ~/dotfiles/bin/actions/git ]]; then
|
||||
if [[ $(readlink ~/dotfiles/.git/hooks) != $HOME/dotfiles/bin/actions/git ]]; then
|
||||
printfe "%s\n" "yellow" "The ~/dotfiles/.git/hooks symlink is incorrect. Please remove it and run this script again."
|
||||
fi
|
||||
return
|
||||
@@ -37,7 +38,7 @@ ensure_git_hooks() {
|
||||
printfe "%s\n" "yellow" "The ~/dotfiles/.git/hooks directory already exists. We're removing it!"
|
||||
fi
|
||||
|
||||
ln -s ~/dotfiles/bin/actions/git ~/dotfiles/.git/hooks
|
||||
ln -s $HOME/dotfiles/bin/actions/git ~/dotfiles/.git/hooks
|
||||
printfe "%s\n" "green" "Git hooks are now set up!"
|
||||
}
|
||||
|
||||
@@ -64,7 +65,10 @@ case $1 in
|
||||
secrets $@
|
||||
;;
|
||||
term)
|
||||
~/dotfiles/bin/actions/term.sh $@
|
||||
$HOME/dotfiles/bin/actions/term.sh $@
|
||||
;;
|
||||
hotkey-daemon)
|
||||
bash -c "swhks & pkexec swhkd -c ~/dotfiles/config/swhkd/swhkdrc" &
|
||||
;;
|
||||
*)
|
||||
printfe "%s\n" "red" "Unknown command $1"
|
||||
|
8
bin/dotf-screenshot
Executable file
8
bin/dotf-screenshot
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# In case we run Pop!_OS let's use `cosmic-screenshot --interactive`, otherwise default to `flameshot gui`
|
||||
if [[ -x "$(command -v cosmic-screenshot)" ]]; then
|
||||
cosmic-screenshot --interactive
|
||||
else
|
||||
flameshot gui
|
||||
fi
|
@@ -1,25 +1,6 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/lists/apt.sh
|
||||
|
||||
add_wezterm_repo() {
|
||||
# Check if we have a wezterm.list file already, if not then create one
|
||||
if [ ! -f /etc/apt/sources.list.d/wezterm.list ]; then
|
||||
curl -fsSL https://apt.fury.io/wez/gpg.key | sudo gpg --yes --dearmor -o /usr/share/keyrings/wezterm-fury.gpg
|
||||
echo 'deb [signed-by=/usr/share/keyrings/wezterm-fury.gpg] https://apt.fury.io/wez/ * *' | sudo tee /etc/apt/sources.list.d/wezterm.list
|
||||
result=$(sudo apt update 2>&1)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" " - Failed to add Wezterm repository"
|
||||
printfe "%s\n" "yellow" "$result"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printfe "%s\n" "yellow" " - Added Wezterm repository"
|
||||
else
|
||||
printfe "%s\n" "green" " - Wezterm repository already added"
|
||||
fi
|
||||
}
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
add_brave_repo() {
|
||||
# Check if we have a brave-browser-release.list file already, if not then create one
|
||||
@@ -104,14 +85,38 @@ add_vscode_repo() {
|
||||
}
|
||||
|
||||
ensure_repositories() {
|
||||
add_wezterm_repo
|
||||
add_brave_repo
|
||||
add_1password_repo
|
||||
add_spotify_repo
|
||||
add_vscode_repo
|
||||
}
|
||||
|
||||
repos=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.apt.repos))
|
||||
for repo in $repos; do
|
||||
repo_name=$(echo $repo | cut -d ":" -f 2)
|
||||
|
||||
# Go through sources.list.d and check if there's a file containing part of URIs: https://ppa.launchpad.net/$repo_name
|
||||
# We have to check the files not the file names since the file names are not always the same as the repo_name
|
||||
result=$(grep -r "$repo_name" /etc/apt/sources.list.d/*)
|
||||
if [ -z "$result" ]; then
|
||||
printfe "%s\n" "yellow" " - Adding $repo_name repository..."
|
||||
clear_line
|
||||
|
||||
sudo add-apt-repository -y $repo
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" " - Failed to add $repo_name repository"
|
||||
exit 1
|
||||
else
|
||||
printfe "%s\n" "green" " - $repo_name repository added successfully"
|
||||
fi
|
||||
else
|
||||
printfe "%s\n" "green" " - $repo_name repository already added"
|
||||
fi
|
||||
done
|
||||
}
|
||||
ensure_apt_packages_installed() {
|
||||
apt_packages=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.apt.apps))
|
||||
|
||||
# Check if apt_packages array contains duplicates
|
||||
if [ $(echo $apt_packages | tr ' ' '\n' | sort | uniq -d | wc -l) -ne 0 ]; then
|
||||
printfe "%s\n" "red" "The apt_packages array contains duplicates"
|
||||
@@ -149,6 +154,8 @@ print_apt_status() {
|
||||
printfe "%s" "cyan" "Checking APT packages..."
|
||||
clear_line
|
||||
|
||||
apt_packages=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.apt.apps))
|
||||
|
||||
# count entries in packages
|
||||
count=$(echo $apt_packages | wc -w)
|
||||
installed=0
|
||||
|
@@ -1,29 +1,38 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source ~/dotfiles/bin/lists/cargo.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
ensure_cargo_packages_installed() {
|
||||
# Check if cargo_packages array contains duplicates
|
||||
if [ $(echo $cargo_packages | tr ' ' '\n' | sort | uniq -d | wc -l) -ne 0 ]; then
|
||||
printfe "%s\n" "red" "The cargo_packages array contains duplicates"
|
||||
printfe "%s\n" "yellow" "Duplicates:"
|
||||
printfe "%s\n" "blue" $(echo $cargo_packages | tr ' ' '\n' | sort | uniq -d)
|
||||
exit 1
|
||||
fi
|
||||
cargo_packages=($(cat $DOTFILES_CONFIG | shyaml keys config.packages.cargo))
|
||||
for package in "${cargo_packages[@]}"; do
|
||||
printfe "%s" "cyan" " - Checking $package..."
|
||||
echo -en '\r'
|
||||
|
||||
for package in $cargo_packages; do
|
||||
# Some entries have a git_url and binary, we need to load these in if they exist
|
||||
pkg_status=$(cargo install --list | grep -E "^${package}\sv[0-9.]+:$")
|
||||
package_url=$(cat $DOTFILES_CONFIG | shyaml get-value config.packages.cargo.$package.git_url 2>/dev/null)
|
||||
binary=$(cat $DOTFILES_CONFIG | shyaml get-value config.packages.cargo.$package.binary 2>/dev/null)
|
||||
|
||||
# If pkg_status is `installed` then we don't need to install the package, otherwise if it's empty then the package is not installed
|
||||
if [ -z $pkg_status ]; then
|
||||
ensure_sudo_privileges "In order to install cargo_packages, please provide your password:"
|
||||
printfe "%s" "yellow" " - Installing $package..."
|
||||
ensure_sudo_privileges "In order to install $package, please provide your password:"
|
||||
printfe "%s" "yellow" " - Compiling/Installing $package... (This may take a while)"
|
||||
clear_line
|
||||
result=$(cargo install $package 2>&1)
|
||||
|
||||
# If package_url is defined we should install via git
|
||||
if [ -n "$package_url" ]; then
|
||||
command="cargo install --git $package_url $binary"
|
||||
else
|
||||
command="cargo install $package"
|
||||
fi
|
||||
|
||||
# Execute the command
|
||||
result=$(eval $command 2>&1)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" " - Failed to install $package"
|
||||
printfe "%s\n" "red" " Command: $command"
|
||||
printfe "%s\n" "red" " Output: $result"
|
||||
exit 1
|
||||
fi
|
||||
printfe "%s\n" "green" " - Installed $package"
|
||||
@@ -37,6 +46,7 @@ print_cargo_status() {
|
||||
printfe "%s" "cyan" "Checking Cargo packages..."
|
||||
clear_line
|
||||
|
||||
cargo_packages=($(cat $DOTFILES_CONFIG | shyaml keys config.packages.cargo))
|
||||
count=$(echo $cargo_packages | wc -w)
|
||||
installed=0
|
||||
|
||||
|
34
bin/helpers/docker.sh
Executable file
34
bin/helpers/docker.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
ensure_docker_installed() {
|
||||
# if docker is already installed, skip the installation
|
||||
if [ -x "$(command -v docker)" ]; then
|
||||
printfe "%s\n" "green" " - Docker is already installed"
|
||||
return
|
||||
fi
|
||||
|
||||
# Add Docker's official GPG key
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||
|
||||
# Add Docker's repository
|
||||
sudo add-apt-repository \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y docker-ce docker-ce-cli containerd.io
|
||||
|
||||
# Check if it successfully installed
|
||||
if [ -x "$(command -v docker)" ]; then
|
||||
printfe "%s\n" "green" " - Docker is installed"
|
||||
else
|
||||
printfe "%s\n" "red" " - Docker is not installed"
|
||||
printfe "%s\n" "red" " Something went wrong while installing Docker, investigate the issue"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo usermod -aG docker $USER
|
||||
sudo systemctl start docker
|
||||
sudo systemctl enable docker
|
||||
}
|
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source ~/dotfiles/bin/lists/flatpak.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
ensure_remotes_added() {
|
||||
flatpak_remotes=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.flatpak.remotes))
|
||||
|
||||
for remote in $flatpak_remotes; do
|
||||
printfe "%s\n" "green" " - Ensuring remote $remote"
|
||||
flatpak remote-add --if-not-exists flathub $remote
|
||||
@@ -11,6 +12,7 @@ ensure_remotes_added() {
|
||||
}
|
||||
|
||||
ensure_flatpak_packages_installed() {
|
||||
flatpak_packages=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.flatpak.apps))
|
||||
for package in $flatpak_packages; do
|
||||
if ! flatpak list | grep -q $package; then
|
||||
printfe "%s" "yellow" " - Installing $package"
|
||||
@@ -32,6 +34,8 @@ print_flatpak_status() {
|
||||
printfe "%s" "cyan" "Checking Flatpak packages..."
|
||||
clear_line
|
||||
|
||||
flatpak_packages=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.flatpak.apps))
|
||||
|
||||
count=$(echo $flatpak_packages | wc -w)
|
||||
installed=0
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source ~/dotfiles/bin/lists/fonts.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
install_font() {
|
||||
font_url="$1"
|
||||
@@ -53,8 +52,13 @@ install_font() {
|
||||
}
|
||||
|
||||
ensure_fonts_installed() {
|
||||
# Load fonts from cat $DOTFILES_CONFIG | shyaml keys config.fonts
|
||||
fonts=($(cat $DOTFILES_CONFIG | shyaml keys config.fonts))
|
||||
|
||||
for font in "${fonts[@]}"; do
|
||||
install_font $(echo $font | awk '{print $1}') $(echo $font | awk '{print $2}')
|
||||
name=$(cat $DOTFILES_CONFIG | shyaml get-value config.fonts.$font.name)
|
||||
url=$(cat $DOTFILES_CONFIG | shyaml get-value config.fonts.$font.url)
|
||||
install_font $url $name
|
||||
done
|
||||
}
|
||||
|
||||
@@ -67,6 +71,7 @@ print_fonts_status() {
|
||||
|
||||
mkdir -p $font_dir
|
||||
|
||||
fonts=($(cat $DOTFILES_CONFIG | shyaml keys config.fonts))
|
||||
total_fonts=0
|
||||
installed_fonts=0
|
||||
|
||||
|
@@ -8,7 +8,7 @@ println() {
|
||||
|
||||
logo() {
|
||||
tput setaf 2
|
||||
cat ~/dotfiles/bin/resources/logo.txt
|
||||
cat $HOME/dotfiles/bin/resources/logo.txt
|
||||
println " " "cyan"
|
||||
tput sgr0
|
||||
|
||||
|
@@ -1,8 +1,13 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
ensure_gnome_extensions_installed() {
|
||||
if ! command -v gnome-extensions &> /dev/null; then
|
||||
printfe "%s\n" "red" " - gnome-extensions command not found, likely not running GNOME."
|
||||
return
|
||||
fi
|
||||
|
||||
printfe "%s" "cyan" " - Loading GNOME extension json file..."
|
||||
echo -en '\r'
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
# Ensure jq is installed
|
||||
if ! command -v jq &> /dev/null; then
|
||||
@@ -17,7 +17,21 @@ fi
|
||||
|
||||
shortcuts=$(jq -r '.shortcuts' "${shortcuts_file}")
|
||||
|
||||
ensure_swhkd() {
|
||||
shortcuts_keys=($(cat "$DOTFILES_CONFIG" | shyaml keys config.keybinds))
|
||||
for key in "${shortcuts_keys[@]}"; do
|
||||
shortcut=$(cat "$DOTFILES_CONFIG" | shyaml get-value config.keybinds.$key.shortcut)
|
||||
command=$(cat "$DOTFILES_CONFIG" | shyaml get-value config.keybinds.$key.command)
|
||||
echo "$shortcut"
|
||||
echo " $command"
|
||||
echo
|
||||
done
|
||||
}
|
||||
|
||||
ensure_keyboard_shortcuts() {
|
||||
printfe "%s\n" "green" " - Setting up swhkd configuration..."
|
||||
ensure_swhkd > $HOME/dotfiles/config/swhkd/swhkdrc
|
||||
|
||||
# Retrieve current custom keybindings
|
||||
existing_bindings=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings | tr -d "[]'")
|
||||
new_bindings=()
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
ensure_ohmyzsh_installed() {
|
||||
if [ -d ~/.oh-my-zsh ]; then
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source ~/dotfiles/bin/lists/pipx.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
ensure_pipx_packages_installed() {
|
||||
pipx_packages=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.pipx))
|
||||
for i in "${pipx_packages[@]}";
|
||||
do
|
||||
printfe "%s" "cyan" " - Fetching package details for $i"
|
||||
@@ -31,6 +31,7 @@ print_pipx_status() {
|
||||
printfe "%s" "cyan" "Checking pipx packages..."
|
||||
clear_line
|
||||
|
||||
pipx_packages=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.pipx))
|
||||
count=$(echo $pipx_packages | wc -w)
|
||||
installed=0
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
ensure_rust_installed() {
|
||||
if [ -x "$(command -v rustc)" ]; then
|
||||
|
33
bin/helpers/tailscale.sh
Executable file
33
bin/helpers/tailscale.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
ensure_tailscale_installed() {
|
||||
# if tailscale is already installed, skip the installation
|
||||
if [ -x "$(command -v tailscale)" ]; then
|
||||
printfe "%s\n" "green" " - Tailscale is already installed"
|
||||
return
|
||||
fi
|
||||
|
||||
result=$(curl -fsSL https://tailscale.com/install.sh | sh)
|
||||
|
||||
# Ensure it ended with something like Installation complete
|
||||
if [[ $result == *"Installation complete"* ]]; then
|
||||
# Check if it successfully installed
|
||||
if [ -x "$(command -v tailscale)" ]; then
|
||||
printfe "%s\n" "green" " - Tailscale is installed"
|
||||
else
|
||||
printfe "%s\n" "red" " - Tailscale is not installed"
|
||||
printfe "%s\n" "red" " Something went wrong while installing Tailscale, investigate the issue"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
printfe "%s\n" "red" " - Tailscale is not installed"
|
||||
printfe "%s\n" "red" " Something went wrong while installing Tailscale, investigate the issue"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Let's set the current user to the operator
|
||||
sudo tailscale set --operator=$USER
|
||||
|
||||
# Start the service
|
||||
tailscale up
|
||||
}
|
42
bin/helpers/user_groups.sh
Executable file
42
bin/helpers/user_groups.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
ensure_user_groups() {
|
||||
# Load yaml file
|
||||
users=($(cat $DOTFILES_CONFIG | shyaml keys config.user_groups))
|
||||
|
||||
# For each user, ensure they are in the correct groups
|
||||
for user in $users; do
|
||||
# Ensure this user exists
|
||||
if [[ ! $(id -u $user) ]]; then
|
||||
printfe "%s\n" "red" " - User $user does not exist"
|
||||
continue
|
||||
fi
|
||||
|
||||
ensure_user_in_groups $user
|
||||
done
|
||||
}
|
||||
|
||||
ensure_user_in_groups() {
|
||||
user=$1
|
||||
groups=($(cat $DOTFILES_CONFIG | shyaml get-values config.user_groups.$user))
|
||||
|
||||
printfe "%s\n" "cyan" " - For user $user..."
|
||||
|
||||
# For each group, ensure the user is in it
|
||||
for group in $groups; do
|
||||
# Check if the group exists at all, otherwise skip
|
||||
if [[ ! $(getent group $group) ]]; then
|
||||
printfe "%s\n" "red" " Group $group does not exist"
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ ! $groups == *$group* ]]; then
|
||||
printfe "%s\n" "green" " Adding $user to group $group"
|
||||
sudo usermod -aG $group $user
|
||||
else
|
||||
printfe "%s\n" "green" " $user is already in group $group"
|
||||
fi
|
||||
done
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
source ~/dotfiles/bin/helpers/functions.sh
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
load_vscode_extensions() {
|
||||
# Clear the array before populating it
|
||||
|
@@ -1,58 +0,0 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
apt_packages=(
|
||||
"zsh"
|
||||
"git"
|
||||
"curl"
|
||||
"wget"
|
||||
"gpg"
|
||||
"nala"
|
||||
"ca-certificates"
|
||||
"software-properties-common"
|
||||
"apt-transport-https"
|
||||
"vim"
|
||||
"sl"
|
||||
"just"
|
||||
"libglvnd-dev"
|
||||
"libwayland-dev"
|
||||
"libseat-dev"
|
||||
"libxkbcommon-dev"
|
||||
"libinput-dev"
|
||||
"udev"
|
||||
"dbus"
|
||||
"libdbus-1-dev"
|
||||
"libsystemd-dev"
|
||||
"libpixman-1-dev"
|
||||
"libssl-dev"
|
||||
"libflatpak-dev"
|
||||
"libpulse-dev"
|
||||
"libexpat1-dev"
|
||||
"libfontconfig-dev"
|
||||
"libfreetype-dev"
|
||||
"mold"
|
||||
"cargo"
|
||||
"libgbm-dev"
|
||||
"libclang-dev"
|
||||
"libpipewire-0.3-dev"
|
||||
"libpam0g-dev"
|
||||
"openssh-server"
|
||||
"build-essential"
|
||||
"flatpak"
|
||||
"meson"
|
||||
"pipx"
|
||||
"python3-nautilus"
|
||||
"gettext"
|
||||
"fzf"
|
||||
"neofetch"
|
||||
"screenfetch"
|
||||
"wezterm"
|
||||
"brave-browser"
|
||||
"code"
|
||||
"1password"
|
||||
"1password-cli"
|
||||
"spotify-client"
|
||||
"flameshot"
|
||||
"xdg-desktop-portal-gnome"
|
||||
"xdg-desktop-portal"
|
||||
"gnome-weather"
|
||||
)
|
@@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
cargo_packages=(
|
||||
"exa"
|
||||
"lsd"
|
||||
"bat"
|
||||
"starship"
|
||||
"ripgrep"
|
||||
"fd-find"
|
||||
"procs"
|
||||
"bottom"
|
||||
)
|
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
flatpak_packages=(
|
||||
"app.drey.Doggo"
|
||||
"org.gnome.Boxes"
|
||||
"org.gnome.baobab"
|
||||
"re.sonny.Junction"
|
||||
"com.yubico.yubioath"
|
||||
"net.nokyan.Resources"
|
||||
"com.system76.Popsicle"
|
||||
"com.github.marhkb.Pods"
|
||||
"org.wezfurlong.wezterm"
|
||||
"io.github.dimtpap.coppwr"
|
||||
"com.github.tchx84.Flatseal"
|
||||
"dev.bragefuglseth.Keypunch"
|
||||
"io.github.flattool.Warehouse"
|
||||
"io.github.jonmagon.kdiskmark"
|
||||
"org.onlyoffice.desktopeditors"
|
||||
"io.missioncenter.MissionCenter"
|
||||
"io.podman_desktop.PodmanDesktop"
|
||||
"io.github.giantpinkrobots.flatsweep"
|
||||
"io.github.realmazharhussain.GdmSettings"
|
||||
"io.github.thetumultuousunicornofdarkness.cpu-x"
|
||||
)
|
||||
|
||||
flatpak_remotes=(
|
||||
"https://flathub.org/repo/flathub.flatpakrepo"
|
||||
)
|
@@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# https://www.nerdfonts.com/font-downloads
|
||||
fonts=(
|
||||
"https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Hack.zip Hack"
|
||||
"https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Meslo.zip Meslo"
|
||||
"https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/JetBrainsMono.zip JetBrainsMono"
|
||||
"https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/ProggyClean.zip ProggyClean"
|
||||
)
|
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
pipx_packages=(
|
||||
"gnome-extensions-cli"
|
||||
"bauh"
|
||||
)
|
Reference in New Issue
Block a user