From aec82a00f2318edb4e9ec0c20d2ddd9bc5a8066c Mon Sep 17 00:00:00 2001 From: Vincent Capelle Date: Sun, 17 Nov 2024 19:38:31 -0500 Subject: [PATCH] feat: add Ubuntu support --- setup.sh | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/setup.sh b/setup.sh index 27d397d..27b4bc7 100755 --- a/setup.sh +++ b/setup.sh @@ -6,18 +6,32 @@ DOTFILES_DIR="$HOME/.dotfiles" ANSIBLE_PATH="$HOME/.local/bin" PLAYBOOK_PATH="$DOTFILES_DIR/ansible/playbook.yml" -sudo pacman -S --needed --noconfirm git python-pipx -pipx install --include-deps ansible +# Detect distro +if [ -f /etc/os-release ]; then + # freedesktop.org and systemd + . /etc/os-release + OS=$NAME +fi -if [ ! -d $DOTFILES_DIR ] +if [ "$OS" = "Manjaro Linux" ]; then + sudo pacman -S --needed --noconfirm git python-pipx +elif [ "$OS" = "Ubuntu" ]; then + sudo apt --assume-yes install git python-pipx +else + echo "Distribution $OS not supported" + exit 1 +fi + +pipx install --include-deps ansible +if [ ! -d "$DOTFILES_DIR" ] then - git clone --recurse-submodules https://github.com/vicnett/dotfiles.git $DOTFILES_DIR + git clone --recurse-submodules https://github.com/vicnett/dotfiles.git "$DOTFILES_DIR" fi -if [ -f $PLAYBOOK_PATH ] +if [ -f "$PLAYBOOK_PATH" ] then - $ANSIBLE_PATH/ansible-playbook $PLAYBOOK_PATH + "$ANSIBLE_PATH/ansible-playbook $PLAYBOOK_PATH" else - echo Ansible playbook not found at $PLAYBOOK_PATH + echo "Ansible playbook not found at $PLAYBOOK_PATH" exit 1 fi