88# # Script to install an opinionated dev environment, check out: gh:namesmt/linux-stuff
99
1010# Install basic packages
11- apk update
12- apk add --no-cache \
11+ sudo apk update
12+ sudo apk add --no-cache \
1313 gcompat libstdc++ \
1414 zip unzip jq sudo git less zsh curl wget
1515
@@ -28,9 +28,8 @@ sh -c "$(wget -qO- https://github.com/deluan/zsh-in-docker/releases/latest/downl
2828 -p https://github.com/zsh-users/zsh-syntax-highlighting
2929
3030# set zsh as default shell
31- sed -i ' s/\/root:\/bin\/ash/\/root:\/bin\/zsh/g' /etc/passwd
32- sed -i ' s/\/root:\/bin\/sh/\/root:\/bin\/zsh/g' /etc/passwd
33- zsh
31+ sudo sed -i ' s/\/root:\/bin\/ash/\/root:\/bin\/zsh/g' /etc/passwd
32+ sudo sed -i ' s/\/root:\/bin\/sh/\/root:\/bin\/zsh/g' /etc/passwd
3433export SHELL=/bin/zsh
3534
3635# Install fnm (patched for alpine zsh) and install lts node using fnm
@@ -39,9 +38,10 @@ source ~/.zshrc
3938fnm install --lts
4039
4140# Setup the environment path for pnpm
42- touch /etc/profile.d/pnpmPath.sh && \
43- echo ' export PNPM_HOME=/root/.local/share/pnpm' >> /etc/profile.d/pnpmPath.sh && \
44- echo ' export PATH=$PNPM_HOME:$PATH' >> /etc/profile.d/pnpmPath.sh && \
41+ mkdir ~ /.pnpm-global
42+ sudo touch /etc/profile.d/pnpmPath.sh && \
43+ echo ' export PNPM_HOME=$HOME/.pnpm-global' | sudo tee -a /etc/profile.d/pnpmPath.sh && \
44+ echo ' export PATH=$PNPM_HOME:$PATH' | sudo tee -a /etc/profile.d/pnpmPath.sh && \
4545 source /etc/profile.d/pnpmPath.sh
4646
4747# Install pnpm and ni
@@ -50,11 +50,11 @@ corepack enable
5050corepack prepare pnpm --activate
5151pnpm i -g @antfu/ni && \
5252 touch ~ /.nirc && \
53- echo ' defaultAgent=pnpm' >> ~ /.nirc && \
54- echo ' globalAgent=pnpm' >> ~ /.nirc
53+ echo ' defaultAgent=pnpm' | tee -a ~ /.nirc && \
54+ echo ' globalAgent=pnpm' | tee -a ~ /.nirc
5555
5656# Adding a simple command to change git remote connection from/to ssh/https
57- touch /etc/profile.d/gitRemoteChanger.sh && \
58- echo alias git-ssh=\' git remote set-url origin \"\$\( git remote get-url origin \| sed -E \'\\\'\' s,\^ https://\(\[\^ /\]\*\) /\( .\*\)\$ ,git@\\ 1:\\ 2,\'\\\'\'\)\"\' >> /etc/profile.d/gitRemoteChanger.sh && \
59- echo alias git-https=\' git remote set-url origin \"\$\( git remote get-url origin \| sed -E \'\\\'\' s,\^ git@\(\[\^ :\]\*\) :/\*\( .\*\)\$ ,https://\\ 1/\\ 2,\'\\\'\'\)\"\' >> /etc/profile.d/gitRemoteChanger.sh && \
57+ sudo touch /etc/profile.d/gitRemoteChanger.sh && \
58+ echo alias git-ssh=\' git remote set-url origin \"\$\( git remote get-url origin \| sed -E \'\\\'\' s,\^ https://\(\[\^ /\]\*\) /\( .\*\)\$ ,git@\\ 1:\\ 2,\'\\\'\'\)\"\' | sudo tee -a /etc/profile.d/gitRemoteChanger.sh && \
59+ echo alias git-https=\' git remote set-url origin \"\$\( git remote get-url origin \| sed -E \'\\\'\' s,\^ git@\(\[\^ :\]\*\) :/\*\( .\*\)\$ ,https://\\ 1/\\ 2,\'\\\'\'\)\"\' | sudo tee -a /etc/profile.d/gitRemoteChanger.sh && \
6060 source /etc/profile.d/gitRemoteChanger.sh
0 commit comments