Skip to content

Commit

Permalink
update installation
Browse files Browse the repository at this point in the history
  • Loading branch information
xvzc committed Jan 6, 2024
1 parent a3796e1 commit 35cd51c
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 125 deletions.
50 changes: 33 additions & 17 deletions init_private_resources.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
#!/bin/bash

CUR_OS=$(uname)

if ! brew bundle --no-lock --no-upgrade --file=~/.local/share/chezmoi/setup/Brewfile.personal; then
echo "Filed to install packages"
error() {
echo "[ERROR] $1"
exit 1
}

cur_os=$(uname)

assets_dir="$HOME/.config/assets"

# Install packages
if [ "$cur_os" = "Darwin" ]; then
font_dir=~/Library/Fonts/
brewfile="$HOME/.local/share/chezmoi/setup/Brewfile.personal"
if ! brew bundle --no-lock --no-upgrade --file="$brewfile"; then
error "Filed to install packages"
fi

source ~/.local/share/chezmoi/setup/macos-setup.sh && all
elif [ "$cur_os" = "Linux" ]; then
font_dir=~/.local/share/fonts/
fi

if ! command -v op; then
error "1Password not found"
fi

if ! op whoami 2>/dev/null; then
error "Your 1Password account is not signed in please signin."
fi

op read "op://Personal/SSH Github xvzc/public key" >~/.ssh/xvzc.pub &&
Expand All @@ -13,22 +36,15 @@ op read "op://Personal/SSH Github xvzc/public key" >~/.ssh/xvzc.pub &&
op read "op://Personal/SSH Arch Linux/public key" >~/.ssh/arch.pub &&
chmod 600 ~/.ssh/arch.pub

ASSETS_DIR="$HOME/.config/assets"
if [ -d "$ASSETS_DIR/.git" ]; then
echo "'$ASSETS_DIR/.git' already exists."
git --git-dir "$ASSETS_DIR/.git" remote set-url origin [email protected]:xvzc/assets.git
if [ -d "$assets_dir/.git" ]; then
echo "'$assets_dir/.git' already exists."
git --git-dir "$assets_dir/.git" remote set-url origin [email protected]:xvzc/assets.git
else
git clone [email protected]:xvzc/assets.git $ASSETS_DIR
git clone [email protected]:xvzc/assets.git "$assets_dir"
fi

# Install fonts
if [ "$CUR_OS" = "Darwin" ]; then
cp ~/.config/assets/fonts/hesalche/ttf/hesalche-Light.ttf ~/Library/Fonts/
cp ~/.config/assets/fonts/hesalche/ttf/hesalche-Regular.ttf ~/Library/Fonts/
elif [ "$CUR_OS" = "Linux" ]; then
cp ~/.config/assets/fonts/hesalche/ttf/hesalche-Light.ttf ~/.local/share/fonts/
cp ~/.config/assets/fonts/hesalche/ttf/hesalche-Regular.ttf ~/.local/share/fonts/
fi
cp ~/.config/assets/fonts/hesalche/ttf/hesalche-Light.ttf "$font_dir"
cp ~/.config/assets/fonts/hesalche/ttf/hesalche-Regular.ttf "$font_dir"

# install cargo
curl https://sh.rustup.rs -sSf | sh
20 changes: 11 additions & 9 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash
# vim:ft=sh ts=2 sw=2

error() {
echo "[ERROR] $1"
exit 1
}

require-sudo() {
if [ -n "$1" ]; then
sudo -v --prompt "Administrator privilege required. Please type your local password: "
Expand All @@ -27,8 +32,7 @@ check-or-install-brew() {
fi

if [ $? -ne 0 ]; then
echo "Filed to install brew"
exit 1
error "Failed to install brew"
fi
}

Expand All @@ -46,7 +50,7 @@ if type chezmoi >/dev/null 2>&1; then
echo "Found chezmoi at $(whereis chezmoi). Skipping install."
else
echo "chezmoi not found. installing.."
sh -c "$(curl -fsLS get.chezmoi.io)" -- -b $HOME/.local/bin
sh -c "$(curl -fsLS get.chezmoi.io)" -- -b "$HOME/.local/bin"
export PATH="$HOME/.local/bin:$PATH"
fi

Expand All @@ -55,10 +59,9 @@ chezmoi apply

if [ "$machine" == "Mac" ]; then
check-or-install-brew
brewfile_path="$HOME/.local/share/chezmoi/setup/Brewfile.essential"
if ! brew bundle --no-lock --no-upgrade --file="$brewfile_path"; then
echo "Filed to install packages"
exit 1
brewfile="$HOME/.local/share/chezmoi/setup/Brewfile.essential"
if ! brew bundle --no-lock --no-upgrade --file="$brewfile"; then
error "Filed to install packages"
fi
elif [ "$machine" == "Linux" ]; then
echo "Installing Linux packages.."
Expand All @@ -74,6 +77,5 @@ elif [ "$machine" == "Linux" ]; then
# #
#################################################################
else
echo "Cannot determine operation system."
exit 1
error "Cannot determine operating system."
fi
1 change: 1 addition & 0 deletions setup/Brewfile.essential
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ brew "git"
brew "tmux"
brew "tmuxinator"
brew "tree"
brew "mas"
cask "font-jetbrains-mono-nerd-font"
cask "wezterm"
2 changes: 2 additions & 0 deletions setup/Brewfile.personal
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ brew "ranger"
brew "ripgrep"
brew "terraform"
brew "wakeonlan"
mas "KakaoTalk ", id: 869223134
mas "Gifski ", id: 1351639930
cask "1password"
cask "1password-cli"
cask "google-chrome"
Expand Down
25 changes: 14 additions & 11 deletions setup/Default.bttpreset
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"BTTTpFourFingerSwipeSensitivity" : 0.40000000000000002,
"BSTMoveTreshold" : 2,
"BTTHideFomControlStripWhenOpen" : false,
"BTTNumberOfStarts" : 3,
"BTTNumberOfStarts" : 6,
"BTTForceNormalClickPressure3F" : 150,
"showSiriRemoteTab" : true,
"SIRIScrollSpeed" : 1,
Expand Down Expand Up @@ -159,20 +159,15 @@
"BTTNotchBarNotchMenubarModeHideRightScrollable" : true,
"BSTSnapAreaDefaultPictoDistanceFromLeft" : 0.10000000149011612
},
"BTTPresetUUID" : "33AD11E6-BEF8-4E13-8123-ADAA23FA50B6",
"BTTPresetUUID" : "6464A11A-BEE2-453B-8324-BAFE00C2D339",
"BTTPresetContent" : [
{
"BTTAppBundleIdentifier" : "com.apple.finder",
"BTTAppName" : "Finder",
"BTTAppAutoInvertIcon" : 1,
"BTTTriggers" : [

]
},
{
"BTTAppBundleIdentifier" : "BT.G",
"BTTAppName" : "Global",
"BTTAppAutoInvertIcon" : 1,
"BTTAppSpecificSettings" : {
"BTTDisableGlobalTriggers" : false
},
"BTTTriggers" : [
{
"BTTLastUpdatedAt" : 1704437819.182636,
Expand All @@ -188,7 +183,7 @@
"BTTOrder" : 0,
"BTTAdditionalActions" : [
{
"BTTLastUpdatedAt" : 1704437823.9116421,
"BTTLastUpdatedAt" : 1704438634.0507588,
"BTTTriggerType" : -1,
"BTTTriggerParentUUID" : "90E5B6F5-59E7-41CE-82C5-93E82F39AEAE",
"BTTIsPureAction" : true,
Expand All @@ -203,6 +198,14 @@
]
}
]
},
{
"BTTAppBundleIdentifier" : "com.apple.finder",
"BTTAppName" : "Finder",
"BTTAppAutoInvertIcon" : 1,
"BTTTriggers" : [

]
}
],
"BTTPresetSnapAreas" : [
Expand Down
Loading

0 comments on commit 35cd51c

Please sign in to comment.