Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
phalanx-hk committed Jan 11, 2024
1 parent d01b636 commit 74c34d0
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 114 deletions.
42 changes: 21 additions & 21 deletions mac/setup.sh
Original file line number Diff line number Diff line change
@@ -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を配置
Expand All @@ -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! ---"
echo "--- Link dotfiles is Done! ---"
65 changes: 32 additions & 33 deletions ubuntu/scripts/apt.sh
Original file line number Diff line number Diff line change
@@ -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
apt-get install -y docker-ce docker-ce-cli
10 changes: 8 additions & 2 deletions ubuntu/scripts/common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
)"
109 changes: 51 additions & 58 deletions ubuntu/scripts/setup.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -x
set -eux

# shellcheck disable=SC1091
source "$(dirname "$0")/common.bash"

# apt
Expand All @@ -9,111 +10,103 @@ 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
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! ---"
echo "--- Link dotfiles is Done! ---"

0 comments on commit 74c34d0

Please sign in to comment.