Compare commits

...

4 Commits

Author SHA1 Message Date
f1a0806dbb Merge branch 'main' of https://gitea.haugesenspil.dk/jonas/dotfiles 2026-03-12 09:07:02 +01:00
8069f6f150 pacman refresh 2026-03-12 08:58:49 +01:00
e149dac313 submodules support 2026-03-12 08:58:03 +01:00
Jonas H
cf8623bca1 add .gitmodules for zsh plugins 2026-03-08 22:20:21 +01:00
3 changed files with 47 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

@@ -25,6 +25,25 @@ DISTRO=$(detect_distro)
# Dependencies # Dependencies
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# 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) endeavouros)
# EndeavourOS is Arch-based, use pacman # EndeavourOS is Arch-based, use pacman
@@ -52,6 +71,7 @@ case "$DISTRO" in
firefox firefox
) )
check_arch_updates
echo "Installing packages for EndeavourOS..." echo "Installing packages for EndeavourOS..."
sudo pacman -S --noconfirm "${PACMAN_PACKAGES[@]}" sudo pacman -S --noconfirm "${PACMAN_PACKAGES[@]}"
;; ;;
@@ -110,6 +130,7 @@ case "$DISTRO" in
firefox firefox
) )
check_arch_updates
echo "Installing packages for Arch Linux..." echo "Installing packages for Arch Linux..."
sudo pacman -S --noconfirm "${PACMAN_PACKAGES[@]}" sudo pacman -S --noconfirm "${PACMAN_PACKAGES[@]}"
;; ;;