removes legacy shell scripts
refactors dotf shell script removes tailscale related code (now managed through nix) removes shitty welcome prompt for ChatGPT (No longer used) removes shitty git repos feature
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source $HOME/dotfiles/bin/helpers/functions.sh
|
||||
|
||||
# Push all changes from $HOME/dotfiles to ALL remotes in $HOME/dotfiles/.git/config
|
||||
push_all() {
|
||||
# Get all remotes from the .git/config file
|
||||
remotes=($(cat $HOME/dotfiles/.git/config | grep url | awk '{print $3}'))
|
||||
|
||||
printfe "%s\n" "cyan" "Pushing all changes to all remotes..."
|
||||
|
||||
# For each remote, push all changes
|
||||
for remote in "${remotes[@]}"; do
|
||||
printfe "%s" "green" " - Pushing to ["
|
||||
printfe "%s" "blue" "$remote"
|
||||
printfe "%s\n" "green" "]..."
|
||||
|
||||
result=$(git -C $HOME/dotfiles push $remote 2>&1)
|
||||
|
||||
# If the push failed, print an error
|
||||
if [ $? -ne 0 ]; then
|
||||
printfe "%s\n" "red" " - Failed to push to $remote:"
|
||||
printfe "%s\n" "red" " $result"
|
||||
continue
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
push_all
|
@@ -97,11 +97,11 @@ sys_packages_upgrade() {
|
||||
cd $HOME/dotfiles/config/nixos && sudo nixos-rebuild switch --upgrade --flake .#$DOTF_HOSTNAME --impure
|
||||
}
|
||||
|
||||
sys_packages() {
|
||||
####################################################################################################
|
||||
# Update system packages
|
||||
####################################################################################################
|
||||
####################################################################################################
|
||||
# Update packages
|
||||
####################################################################################################
|
||||
|
||||
sys_packages() {
|
||||
printfe "%s\n" "cyan" "Updating system packages..."
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
brew update
|
||||
@@ -123,10 +123,6 @@ sys_packages() {
|
||||
fi
|
||||
}
|
||||
|
||||
####################################################################################################
|
||||
# Update packages
|
||||
####################################################################################################
|
||||
|
||||
cargopkgs() {
|
||||
printfe "%s\n" "cyan" "Ensuring Cargo packages are installed..."
|
||||
source $HOME/dotfiles/bin/helpers/cargo_packages.sh
|
||||
@@ -167,31 +163,6 @@ flatpakpkgs() {
|
||||
ensure_flatpak_packages_installed
|
||||
}
|
||||
|
||||
tailscalecmd() {
|
||||
if is_wsl; then
|
||||
printfe "%s\n" "yellow" "Running in WSL, skipping Tailscale."
|
||||
return
|
||||
fi
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring Tailscale is installed..."
|
||||
source $HOME/dotfiles/bin/helpers/tailscale.sh
|
||||
ensure_tailscale_installed
|
||||
}
|
||||
|
||||
####################################################################################################
|
||||
# Update system settings
|
||||
####################################################################################################
|
||||
|
||||
git_repos() {
|
||||
####################################################################################################
|
||||
# Ensure git repos
|
||||
####################################################################################################
|
||||
|
||||
printfe "%s\n" "cyan" "Ensuring git repos..."
|
||||
source $HOME/dotfiles/bin/helpers/git.sh
|
||||
ensure_git_repos
|
||||
}
|
||||
|
||||
homemanager() {
|
||||
# Due to weirdness delete this file if it exists
|
||||
if [ -f "$HOME/.config/mimeapps.list.backup" ]; then
|
||||
@@ -202,41 +173,22 @@ homemanager() {
|
||||
cd $HOME/dotfiles/config/home-manager && NIXPKGS_ALLOW_UNFREE=1 home-manager switch -b backup --flake .#$DOTF_HOSTNAME --impure
|
||||
}
|
||||
|
||||
ensure_homemanager_installed() {
|
||||
if [ ! -x "$(command -v home-manager)" ]; then
|
||||
printfe "%s\n" "yellow" "Home Manager is not installed, installing it..."
|
||||
nix-channel --add https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz home-manager
|
||||
nix-channel --update
|
||||
nix-shell '<home-manager>' -A install
|
||||
|
||||
printfe "%s\n" "yellow" "Home Manager installed, please run the script again."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
####################################################################################################
|
||||
# Parse arguments
|
||||
####################################################################################################
|
||||
|
||||
# Multiple options can be passed to the script, for example:
|
||||
# ./update.sh --git --symlinks --packages
|
||||
# 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..."
|
||||
|
||||
ensure_homemanager_installed
|
||||
symlinks
|
||||
sys_packages
|
||||
homemanager
|
||||
cargopkgs
|
||||
pipxpkgs
|
||||
git_repos
|
||||
flatpakpkgs
|
||||
tailscalecmd
|
||||
dotf secrets encrypt
|
||||
else
|
||||
for arg in "$@"; do
|
||||
@@ -254,9 +206,6 @@ else
|
||||
sys_packages
|
||||
homemanager
|
||||
;;
|
||||
--git)
|
||||
git_repos
|
||||
;;
|
||||
--symlinks)
|
||||
symlinks
|
||||
;;
|
||||
@@ -265,7 +214,6 @@ else
|
||||
cargopkgs
|
||||
pipxpkgs
|
||||
flatpakpkgs
|
||||
tailscalecmd
|
||||
;;
|
||||
--pipx)
|
||||
pipxpkgs
|
||||
@@ -276,9 +224,6 @@ else
|
||||
--flatpak)
|
||||
flatpakpkgs
|
||||
;;
|
||||
--tailscale)
|
||||
tailscalecmd
|
||||
;;
|
||||
*)
|
||||
printfe "%s\n" "red" "Unknown option: $arg"
|
||||
;;
|
||||
|
Reference in New Issue
Block a user