From 19c1da5f124827c49eda23248d665ac94c5830e0 Mon Sep 17 00:00:00 2001 From: Simon Rieger Date: Sat, 12 Apr 2025 13:43:21 +0200 Subject: [PATCH] add package check --- executable_install-fedora.sh | 35 +++++++++++++++++++-------- executable_install-macos.sh | 26 +++++++++++++------- run_onchange_install-packages.sh.tmpl | 9 ++++--- 3 files changed, 48 insertions(+), 22 deletions(-) diff --git a/executable_install-fedora.sh b/executable_install-fedora.sh index 399d8a7..990b7af 100755 --- a/executable_install-fedora.sh +++ b/executable_install-fedora.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash - set -e # OS-Überprüfung @@ -59,15 +58,31 @@ flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.f # Systemkonfiguration sudo usermod -s /bin/zsh simono41 -# Zusatzinstallationen mit Architekturprüfung -curl -sS https://starship.rs/install.sh | sh - -ARCH="$(uname -m)" -if [[ "$ARCH" == "aarch64" || "$ARCH" == "armv7l" ]]; then - CLIPHIST_URL="https://github.com/sentriz/cliphist/releases/download/v0.6.1/v0.6.1-linux-arm" +# Chezmoi Installation mit Prüfung +if ! command -v chezmoi &>/dev/null; then + sh -c "$(curl -fsLS get.chezmoi.io)" + chezmoi init -v --apply --force ssh://git@brothertec.eu:1023/simono41/dotfiles.git else - CLIPHIST_URL="https://github.com/sentriz/cliphist/releases/download/v0.6.1/v0.6.1-linux-amd64" + echo "chezmoi ist bereits installiert, überspringe Installation" fi -sudo wget -O /usr/bin/cliphist "$CLIPHIST_URL" -sudo chmod +x /usr/bin/cliphist +# Starship Installation mit Prüfung +if ! command -v starship &>/dev/null; then + curl -sS https://starship.rs/install.sh | sh +else + echo "Starship ist bereits installiert, überspringe Installation" +fi + +# Cliphist mit Prüfung +if [[ ! -f /usr/bin/cliphist ]]; then + ARCH="$(uname -m)" + if [[ "$ARCH" == "aarch64" || "$ARCH" == "armv7l" ]]; then + CLIPHIST_URL="https://github.com/sentriz/cliphist/releases/download/v0.6.1/v0.6.1-linux-arm" + else + CLIPHIST_URL="https://github.com/sentriz/cliphist/releases/download/v0.6.1/v0.6.1-linux-amd64" + fi + sudo wget -O /usr/bin/cliphist "$CLIPHIST_URL" + sudo chmod +x /usr/bin/cliphist +else + echo "cliphist ist bereits installiert, überspringe Download" +fi diff --git a/executable_install-macos.sh b/executable_install-macos.sh index bc22640..85d0efb 100755 --- a/executable_install-macos.sh +++ b/executable_install-macos.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash - set -e # OS-Überprüfung @@ -8,26 +7,35 @@ if [[ "$(uname -s)" != "Darwin" ]]; then exit 1 fi +# Homebrew mit Prüfung +if ! command -v brew &>/dev/null; then + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +else + echo "Homebrew ist bereits installiert, überspringe Installation" +fi + # Terminal Tools Installation brew install --cask wezterm -brew install neovim tmux reattach-to-user-namespace starship \ +brew install git neovim tmux reattach-to-user-namespace starship \ zsh-completions zsh-autosuggestions zsh-autocomplete fzf ruby \ gnupg htop btop asciiquarium lolcat openjdk@17 python python-tk@3.11 \ - python-gdbm@3.11 pinentry-mac + python-gdbm@3.11 pip3 install pyobjc +# Chezmoi mit Prüfung +if ! command -v chezmoi &>/dev/null; then + brew install chezmoi + chezmoi init -v --apply ssh://git@brothertec.eu:1023/simono41/dotfiles.git +else + echo "chezmoi ist bereits installiert, überspringe Installation" +fi + # Java Symlinks erstellen sudo ln -sfn /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk # Clipboard Tools Installation brew install jq choose-gui rg -brew install --cask flycut - -# Tailscale Installation und Konfiguration -brew install tailscale -sudo tailscaled install-system-daemon -tailscale up --login-server=https://vpn.brothertec.eu --ssh --accept-routes # Fonts Installation (Nerd Fonts) brew tap homebrew/cask-fonts && brew install --cask font-jetbrains-mono-nerd-font diff --git a/run_onchange_install-packages.sh.tmpl b/run_onchange_install-packages.sh.tmpl index ace2a52..5a33257 100755 --- a/run_onchange_install-packages.sh.tmpl +++ b/run_onchange_install-packages.sh.tmpl @@ -1,9 +1,12 @@ #!/bin/bash -echo "Packetinstallation hat begonnen, bitte das sudo Passwort nach bedarf eingeben!!!" +# executable_install-fedora.sh hash: {{ include "executable_install-fedora.sh" | sha256sum }} +# executable_install-macos.sh hash: {{ include "executable_install-macos.sh" | sha256sum }} + +echo "Packetinstallation hat begonnen, bitte das sudo Passwort nach Bedarf eingeben!!!" {{ if eq .chezmoi.os "linux" -}} -{{ .chezmoi.homeDir }}/install-fedora.sh +{{ .chezmoi.sourceDir }}/executable_install-fedora.sh {{ else if eq .chezmoi.os "darwin" -}} -{{ .chezmoi.homeDir }}/install-macos.sh +{{ .chezmoi.sourceDir }}/executable_install-macos.sh {{ end -}}