From b041fc3c0ea31420c5a6235870b211bab02935ca Mon Sep 17 00:00:00 2001 From: mono Date: Fri, 31 May 2024 19:33:52 +0000 Subject: [PATCH] Update install.sh --- README.md | 16 +++++++++++----- install.sh | 28 ++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 0c2db40..06875cd 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,15 @@ ## Setup -### Darwin / Ubuntu +### Darwin + +```sh +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/mono0x/dotfiles/main/install.sh)" + +chsh -s /opt/homebrew/bin/zsh +``` + +### Ubuntu ```sh # Ubuntu @@ -12,11 +20,9 @@ sudo apt-get update sudo apt-get upgrade sudo apt-get install -y unzip -git clone https://github.com/mono0x/dotfiles ~/.local/share/chezmoi -~/.local/share/chezmoi/install.sh +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/mono0x/dotfiles/main/install.sh)" -chsh -s /opt/homebrew/bin/zsh # Darwin -chsh -s /usr/bin/zsh # Ubuntu +chsh -s /usr/bin/zsh ``` ### Windows diff --git a/install.sh b/install.sh index 47d1240..7bd8fd8 100755 --- a/install.sh +++ b/install.sh @@ -1,10 +1,26 @@ -#!/bin/sh +#!/bin/bash set -eu -cd "$(dirname "$0")" +$dir="$(mktemp --tmpdir -d dotfiles.XXXXXX)" +cd "$dir" +trap '{ rm -f -- "$dir"; }' EXIT -DENO_INSTALL="$HOME/.local" -command -v "$DENO_INSTALL/bin/deno" > /dev/null 2>&1 || \ - DENO_INSTALL="$DENO_INSTALL" sh -c "$(curl -fsSL https://deno.land/x/install/install.sh)" +target="" +case "$(uname)" in + Darwin) + target="aarch64-apple-darwin" + ;; + Linux) + target="x86_64-unknown-linux-gnu" + ;; +esac +if [ -z "$target" ]; then + echo "Unsupported platform: $(uname)" + exit 1 +fi +url="https://github.com/mono0x/dotfiles/releases/latest/download/bootstrap-$target" -exec "$DENO_INSTALL/bin/deno" run -A bootstrap/src/main.ts +curl -L -o bootstrap "$url" +chmod +x bootstrap + +./bootstrap