feat(bootstrap): Bootstrap script for GNU/Linux without admin

This commit is contained in:
js0ny 2025-02-23 20:00:14 +00:00
parent cb81dc8d53
commit 8aa9daf582
12 changed files with 340 additions and 80 deletions

View file

@ -0,0 +1,11 @@
echo "[INFO] Installing Rime"
git clone --depth 1 https://github.com/js0ny/rime_wanxiang_pro.git ~/Library/Rime
cd ~/Library/Rime
just init
# just install_rime
## Rime is installed via Brewfile
just clone_plum

View file

@ -1,3 +1,4 @@
# This should be run with bash > 4.0 or zsh
set -e # Exit immediately if a command exits with a non-zero status
DOTFILES="${DOTFILES:-$HOME/.dotfiles}"
@ -64,8 +65,10 @@ else
linkDots+=(
["$DOTFILES/common/inputrc"]="$HOME/.inputrc"
)
if [ "$(uname -r)" = *Microsoft* ]; then
echo "[INFO] Running on WSL1"
# WSL1 : Microsoft
# WSL2 : microsoft
if [ "$(uname -r)" = *icrosoft* ]; then
echo "[INFO] Running on WSL"
: # NOP
else
echo "[INFO] Running on Native Linux"

View file

@ -1,19 +1,28 @@
WHEEL="${WHEEL:-1}"
echo "[INFO] ZDOTDIR = $ZDOTDIR"
echo "[INFO] DOTFILES = $DOTFILES"
echo "[INFO] WHEEL = $WHEEL"
# echo "[ACTION] Press any key to proceed"
# read -n 1 -s -r
echo "[INFO] Setting up system-wide zsh configuration"
echo "[ACTION] Elevation required"
test -f "/etc/zsh/zshenv" && sudo cp "$DOTFILES/tools/zsh/zshenv" "/etc/zsh/zshenv"
test -f "/etc/zshenv" && sudo cp "$DOTFILES/tools/zsh/zshenv" "/etc/zshenv"
echo "[ACTION] Press any key to proceed"
read -n 1
if [ $(uname) = "Darwin" ]; then
sudo cp "$DOTFILES/tools/zsh/zshenv" "/etc/zshenv"
if [ "$WHEEL" -eq 1 ]; then
echo "[INFO] Setting up system-wide zsh configuration"
echo "[ACTION] Elevation required"
test -f "/etc/zsh/zshenv" && sudo cp "$DOTFILES/tools/zsh/global.zshenv" "/etc/zsh/zshenv"
test -f "/etc/zshenv" && sudo cp "$DOTFILES/tools/zsh/global.zshenv" "/etc/zshenv"
if [ $(uname) = "Darwin" ]; then
sudo cp "$DOTFILES/tools/zsh/global.zshenv" "/etc/zshenv"
fi
else
echo "[INFO] Setting up user zsh configuration"
# A fallback case to set $ZDOTDIR in ~/.zshenv if the user cannot access global zshenv
ln -sf "$DOTFILES/tools/zsh/zshenv" "$HOME/.zshenv"
fi
echo "[INFO] Installing zsh plugins"
test -d $ZDOTDIR/plugins/zsh-autosuggestions || git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions.git $ZDOTDIR/plugins/zsh-autosuggestions
test -d $ZDOTDIR/plugins/zsh-syntax-highlighting || git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git $ZDOTDIR/plugins/zsh-syntax-highlighting