From 74c34d0a30ac76c5dd22d3b8dcdae82ef49be0f2 Mon Sep 17 00:00:00 2001 From: phalanx-hk Date: Thu, 11 Jan 2024 20:17:15 +0000 Subject: [PATCH] fix --- mac/setup.sh | 42 +++++++------- ubuntu/scripts/apt.sh | 65 +++++++++++----------- ubuntu/scripts/common.bash | 10 +++- ubuntu/scripts/setup.bash | 109 +++++++++++++++++-------------------- 4 files changed, 112 insertions(+), 114 deletions(-) diff --git a/mac/setup.sh b/mac/setup.sh index ac8942c..b1711c9 100644 --- a/mac/setup.sh +++ b/mac/setup.sh @@ -1,36 +1,36 @@ #!/bin/sh # brew がインストールされていなければインストール if [ -z "$(command -v brew)" ]; then - echo "--- Install Homebrew is Start! ---" + echo "--- Install Homebrew is Start! ---" - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/${USER}/.zprofile - eval "$(/opt/homebrew/bin/brew shellenv)" - brew bundle - echo "--- Install Homebrew is Done! ---" + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + echo eval "$(/opt/homebrew/bin/brew shellenv)" >>/Users/"${USER}"/.zprofile + eval "$(/opt/homebrew/bin/brew shellenv)" + brew bundle + echo "--- Install Homebrew is Done! ---" fi # codewhisperをインストール -if [ -z "$(command -v cw)" ];then - echo "--- install codewhisper is start ---" - xh https://desktop-release.codewhisperer.us-east-1.amazonaws.com/latest/CodeWhisperer.dmg --download --output /tmp/CodeWhisperer.dmg - hdiutil attach /tmp/CodeWhisperer.dmg - cp -r /Volumes/CodeWhisperer/CodeWhisperer.app /Applications/ - echo "--- install codewhisper is done---" +if [ -z "$(command -v cw)" ]; then + echo "--- install codewhisper is start ---" + xh https://desktop-release.codewhisperer.us-east-1.amazonaws.com/latest/CodeWhisperer.dmg --download --output /tmp/CodeWhisperer.dmg + hdiutil attach /tmp/CodeWhisperer.dmg + cp -r /Volumes/CodeWhisperer/CodeWhisperer.app /Applications/ + echo "--- install codewhisper is done---" fi # poetryをインストール -if [ -z "$(command -v poetry)" ];then - echo "--- install poetry is start ---" - curl -sSL https://install.python-poetry.org | python3 - - echo "--- install poetry is done---" +if [ -z "$(command -v poetry)" ]; then + echo "--- install poetry is start ---" + curl -sSL https://install.python-poetry.org | python3 - + echo "--- install poetry is done---" fi # rustインストール -if [ -z "$(command -v rustup)" ];then - echo "--- install rustup is start ---" - rustup-init - echo "--- install rustup is done---" +if [ -z "$(command -v rustup)" ]; then + echo "--- install rustup is start ---" + rustup-init + echo "--- install rustup is done---" fi # dotfilesを配置 @@ -55,4 +55,4 @@ ln -sf ~/dotfiles/mac/gh/hosts.yml ~/.config/sheldon/hosts.yml # vscode cp ~/dotfiles/mac/vscode/settings.json ~/Library/Application\ Support/Code/User/settings.json -echo "--- Link dotfiles is Done! ---" \ No newline at end of file +echo "--- Link dotfiles is Done! ---" diff --git a/ubuntu/scripts/apt.sh b/ubuntu/scripts/apt.sh index a998a3c..957cba5 100644 --- a/ubuntu/scripts/apt.sh +++ b/ubuntu/scripts/apt.sh @@ -1,45 +1,44 @@ #!/bin/sh -e -ubuntu_version="$(lsb_release -r | awk '{print $2 * 100}')" add-apt-repository -y ppa:git-core/ppa apt-get update && apt-get upgrade -y apt-get install -y \ - autoconf \ - build-essential \ - curl \ - clang \ - clangd \ - clang-format \ - cmake \ - git \ - git-lfs \ - golang-go \ - gpg \ - jq \ - libfuse-dev \ - libsqlite3-dev \ - libssl-dev \ - python3 \ - python3-pip \ - python3-pynvim \ - shellcheck \ - sqlite3 \ - tmux \ - trash-cli \ - unzip \ - wget \ - zip \ - zsh + autoconf \ + build-essential \ + curl \ + clang \ + clangd \ + clang-format \ + cmake \ + git \ + git-lfs \ + golang-go \ + gpg \ + jq \ + libfuse-dev \ + libsqlite3-dev \ + libssl-dev \ + python3 \ + python3-pip \ + python3-pynvim \ + shellcheck \ + sqlite3 \ + tmux \ + trash-cli \ + unzip \ + wget \ + zip \ + zsh # gh -curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ -&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ -&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ -&& sudo apt update \ -&& sudo apt install gh -y +curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && + sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list >/dev/null && + sudo apt update && + sudo apt install gh -y # Docker curl -fsSL 'https://download.docker.com/linux/ubuntu/gpg' | apt-key add - add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" apt-get update -apt-get install -y docker-ce docker-ce-cli \ No newline at end of file +apt-get install -y docker-ce docker-ce-cli diff --git a/ubuntu/scripts/common.bash b/ubuntu/scripts/common.bash index ed8fd67..c1cbb40 100644 --- a/ubuntu/scripts/common.bash +++ b/ubuntu/scripts/common.bash @@ -2,5 +2,11 @@ set -x export CUR_DIR REPO_DIR -CUR_DIR="$(cd "$(dirname "$0")" || exit 1; pwd)" -REPO_DIR="$(cd "$(dirname "$0")/../../" || exit 1; pwd)" +CUR_DIR="$( + cd "$(dirname "$0")" || exit 1 + pwd +)" +REPO_DIR="$( + cd "$(dirname "$0")/../../" || exit 1 + pwd +)" diff --git a/ubuntu/scripts/setup.bash b/ubuntu/scripts/setup.bash index 2f81f29..802f4c4 100644 --- a/ubuntu/scripts/setup.bash +++ b/ubuntu/scripts/setup.bash @@ -1,6 +1,7 @@ #!/usr/bin/env bash -set -x +set -eux + # shellcheck disable=SC1091 source "$(dirname "$0")/common.bash" # apt @@ -9,92 +10,84 @@ sudo /bin/sh "$CUR_DIR/apt.sh" echo "--- apt install is done! ---" # xh client -if ! command -v "xh" >/dev/null 2>&1 -then - echo "--- install xh is start! ---" - curl -sfL https://raw.githubusercontent.com/ducaale/xh/master/install.sh | sh - echo "--- install xh is done! ---" +if ! command -v "xh" >/dev/null 2>&1; then + echo "--- install xh is start! ---" + curl -sfL https://raw.githubusercontent.com/ducaale/xh/master/install.sh | sh + echo "--- install xh is done! ---" else - echo "--- xh is installed! ---" + echo "--- xh is installed! ---" fi - # goenv -if ! command -v "goenv" >/dev/null 2>&1 -then - echo "--- install goenv is start! ---" - git clone https://github.com/go-nv/goenv.git ~/.goenv - echo "--- install goenv is done! ---" +if ! command -v "goenv" >/dev/null 2>&1; then + echo "--- install goenv is start! ---" + git clone https://github.com/go-nv/goenv.git ~/.goenv + echo "--- install goenv is done! ---" else - echo "--- goenv is installed! ---" + echo "--- goenv is installed! ---" fi # python ## pyenv -if ! command -v "pyenv" >/dev/null 2>&1 -then - echo "--- install pyenv is start! ---" - xh https://pyenv.run | bash - echo "--- install pyenv is done! ---" +if ! command -v "pyenv" >/dev/null 2>&1; then + echo "--- install pyenv is start! ---" + xh https://pyenv.run | bash + echo "--- install pyenv is done! ---" else - echo "--- pyenv is installed! ---" + echo "--- pyenv is installed! ---" fi ## poetry -if ! command -v "poetry" >/dev/null 2>&1 -then - echo "--- install poetry is start! ---" - xh --follow https://install.python-poetry.org | python3 - - echo "--- install poetry is done! ---" +if ! command -v "poetry" >/dev/null 2>&1; then + echo "--- install poetry is start! ---" + xh --follow https://install.python-poetry.org | python3 - + echo "--- install poetry is done! ---" else - echo "--- poetry is installed! ---" + echo "--- poetry is installed! ---" fi # rust -if ! command -v "rustup" >/dev/null 2>&1 -then - echo "--- install rust is start! ---" - xh https://sh.rustup.rs --https --ssl tls1.2 | sh - source $HOME/.cargo/env - echo "--- install rust is done! ---" +if ! command -v "rustup" >/dev/null 2>&1; then + echo "--- install rust is start! ---" + xh https://sh.rustup.rs --https --ssl tls1.2 | sh + # shellcheck disable=SC1091 + source "$HOME/.cargo/env" + echo "--- install rust is done! ---" else - echo "--- rust is installed! ---" + echo "--- rust is installed! ---" fi # starship -if ! command -v "starship" >/dev/null 2>&1 -then - echo "--- install starship is start! ---" - xh https://starship.rs/install.sh | sh - echo "--- install starship is done! ---" +if ! command -v "starship" >/dev/null 2>&1; then + echo "--- install starship is start! ---" + xh https://starship.rs/install.sh | sh + echo "--- install starship is done! ---" else - echo "--- starship is installed! ---" + echo "--- starship is installed! ---" fi # sheldon cargo install sheldon # terminal command -cargo install bat eza fd-find procs ripgrep du-dust bottom --locked +cargo install bat eza fd-find procs ripgrep du-dust bottom # act -if ! command -v "act" >/dev/null 2>&1 -then - echo "--- install act is start! ---" - xh https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash - echo "--- install act is done! ---" +if ! command -v "act" >/dev/null 2>&1; then + echo "--- install act is start! ---" + xh https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash + echo "--- install act is done! ---" else - echo "--- act is installed! ---" + echo "--- act is installed! ---" fi # terraform -if ! command -v "tfenv" >/dev/null 2>&1 -then - echo "--- install tfenv is start! ---" - git clone --depth=1 https://github.com/tfutils/tfenv.git ~/.tfenv - echo "--- install tfenv is done! ---" +if ! command -v "tfenv" >/dev/null 2>&1; then + echo "--- install tfenv is start! ---" + git clone --depth=1 https://github.com/tfutils/tfenv.git ~/.tfenv + echo "--- install tfenv is done! ---" else - echo "--- tfenv is installed! ---" + echo "--- tfenv is installed! ---" fi # dotfiles @@ -102,18 +95,18 @@ echo "--- Link dotfiles is Start! ---" ## starship mkdir -p ~/.config -ln -sf $REPO_DIR/ubuntu/starship/starship.toml ~/.config/starship.toml +ln -sf "$REPO_DIR"/ubuntu/starship/starship.toml ~/.config/starship.toml ## zsh -ln -sf $REPO_DIR/ubuntu/zsh/.zshrc ~/.zshrc +ln -sf "$REPO_DIR"/ubuntu/zsh/.zshrc ~/.zshrc ## sheldon mkdir -p ~/.config/sheldon -ln -sf $REPO_DIR/ubuntu/sheldon/sheldon.toml ~/.config/sheldon/sheldon.toml +ln -sf "$REPO_DIR"/ubuntu/sheldon/sheldon.toml ~/.config/sheldon/sheldon.toml ## gh mkdir -p ~/.config/gh -ln -sf $REPO_DIR/ubuntu/gh/config.yml ~/.config/sheldon/config.yml -ln -sf $REPO_DIR/ubuntu/gh/hosts.yml ~/.config/sheldon/hosts.yml +ln -sf "$REPO_DIR"/ubuntu/gh/config.yml ~/.config/sheldon/config.yml +ln -sf "$REPO_DIR"/ubuntu/gh/hosts.yml ~/.config/sheldon/hosts.yml -echo "--- Link dotfiles is Done! ---" \ No newline at end of file +echo "--- Link dotfiles is Done! ---"