This commit is contained in:
Jonas H
2026-03-12 09:26:44 +01:00
3 changed files with 45 additions and 0 deletions

11
.gitmodules vendored Normal file
View File

@@ -0,0 +1,11 @@
[submodule "zshrc/.zsh/plugins/zsh-autosuggestions"]
path = zshrc/.zsh/plugins/zsh-autosuggestions
url = https://github.com/zsh-users/zsh-autosuggestions
[submodule "zshrc/.zsh/plugins/zsh-history-substring-search"]
path = zshrc/.zsh/plugins/zsh-history-substring-search
url = https://github.com/zsh-users/zsh-history-substring-search
[submodule "zshrc/.zsh/plugins/zsh-syntax-highlighting"]
path = zshrc/.zsh/plugins/zsh-syntax-highlighting
url = https://github.com/zsh-users/zsh-syntax-highlighting

15
dot-add
View File

@@ -45,6 +45,21 @@ add_one() {
local REL="${FILE#$HOME/}" local REL="${FILE#$HOME/}"
local DEST="$DOTFILES_DIR/$PACKAGE/$REL" local DEST="$DOTFILES_DIR/$PACKAGE/$REL"
# If the path is a git repo, add it as a submodule instead of moving files
if [[ -d "$FILE/.git" ]]; then
local REMOTE
REMOTE="$(git -C "$FILE" remote get-url origin 2>/dev/null || true)"
if [[ -z "$REMOTE" ]]; then
echo "Error: '$FILE' is a git repo but has no remote origin — can't add as submodule" >&2
return 1
fi
mkdir -p "$(dirname "$DEST")"
rm -rf "$FILE"
git -C "$DOTFILES_DIR" submodule add "$REMOTE" "$PACKAGE/$REL"
echo "Added submodule: $REMOTE -> $DEST"
return 0
fi
mkdir -p "$(dirname "$DEST")" mkdir -p "$(dirname "$DEST")"
mv "$FILE" "$DEST" mv "$FILE" "$DEST"
echo "Moved: $FILE -> $DEST" echo "Moved: $FILE -> $DEST"

View File

@@ -41,6 +41,24 @@ COMMON_PACKAGES=(
firefox firefox
zoxide zoxide
) )
# On Arch-based systems, partial upgrades are unsupported — installing a
# package that pulls in a newer library breaks packages built against the old
# one. The right fix is 'sudo pacman -Syu', but doing that over SSH risks
# a dropped connection mid-kernel-upgrade. So we just warn and let the user
# decide.
check_arch_updates() {
sudo pacman -Sy --noconfirm # refresh databases only, no upgrade
local updates
updates=$(pacman -Qu 2>/dev/null | wc -l)
if [[ "$updates" -gt 0 ]]; then
echo ""
echo "WARNING: $updates system package(s) are out of date."
echo " If pacman fails with dependency conflicts, run 'sudo pacman -Syu'"
echo " locally (not over SSH, to avoid kernel upgrade risks), then re-run"
echo " this script."
echo ""
fi
}
case "$DISTRO" in case "$DISTRO" in
endeavouros|arch) endeavouros|arch)
@@ -62,6 +80,7 @@ case "$DISTRO" in
echo "Installing packages for Fedora..." echo "Installing packages for Fedora..."
sudo dnf install -y "${PACKAGES[@]}" sudo dnf install -y "${PACKAGES[@]}"
;; ;;
*) *)
echo "ERROR: Unsupported distribution: $DISTRO" echo "ERROR: Unsupported distribution: $DISTRO"
exit 1 exit 1