mirror of
https://gitea.blesmrt.net/mikaela/shell-things.git
synced 2024-11-09 18:19:23 +01:00
{bash,zsh}rc: throw apt and corepack to install, improve the fix-node function
This commit is contained in:
parent
9e485419a4
commit
f04733b799
13
install
13
install
@ -53,6 +53,19 @@ if hash pre-commit 2> /dev/null; then
|
||||
pre-commit gc
|
||||
fi
|
||||
|
||||
if hash corepack 2> /dev/null; then
|
||||
corepack enable --install-directory ~/.local/bin/
|
||||
corepack enable npm --install-directory ~/.local/bin/
|
||||
else
|
||||
echo "WARNING! corepack is not installed."
|
||||
fi
|
||||
|
||||
if [ "$(id -u)" == "0" ]; then
|
||||
mkdir -vp /etc/apt/apt.conf.d/
|
||||
echo 'Dpkg::Progress-Fancy "1";' > /etc/apt/apt.conf.d/99progressbar
|
||||
echo 'APT::Color "1";' > /etc/apt/apt.conf.d/99color
|
||||
fi
|
||||
|
||||
if [ -f "$MIKAELA_GREP" ]; then
|
||||
bash -x .mikaela_install
|
||||
fi
|
||||
|
42
rc/bashrc
42
rc/bashrc
@ -233,11 +233,11 @@ UNAME=$(uname)
|
||||
CPUARCH=$(uname -p)
|
||||
|
||||
# If we are on Linux, enable apt progress bar and colours
|
||||
if [[ $USER == "root" ]]; then
|
||||
mkdir -p /etc/apt/apt.conf.d/
|
||||
echo 'Dpkg::Progress-Fancy "1";' > /etc/apt/apt.conf.d/99progressbar
|
||||
echo 'APT::Color "1";' > /etc/apt/apt.conf.d/99color
|
||||
fi
|
||||
#if [[ $USER == "root" ]]; then
|
||||
# mkdir -p /etc/apt/apt.conf.d/
|
||||
# echo 'Dpkg::Progress-Fancy "1";' > /etc/apt/apt.conf.d/99progressbar
|
||||
# echo 'APT::Color "1";' > /etc/apt/apt.conf.d/99color
|
||||
#fi
|
||||
|
||||
# if gpg[-agent] has sshcontrol file, use it as ssh-agent. sshcontrol should
|
||||
# include the authentication subkey keygrip from
|
||||
@ -578,19 +578,19 @@ alias chattr="\chattr -V"
|
||||
alias chmod="\chmod --verbose"
|
||||
|
||||
# https://github.com/nodejs/corepack/blob/v0.28.2/README.md#corepack-enable--name
|
||||
if hash corepack 2> /dev/null; then
|
||||
alias yarn="corepack yarn"
|
||||
alias yarnpkg="corepack yarnpkg"
|
||||
alias pnpm="corepack pnpm"
|
||||
alias pnpx="corepack pnpx"
|
||||
alias npm="corepack npm"
|
||||
alias npx="corepack npx"
|
||||
if ! hash prettier 2> /dev/null; then
|
||||
alias prettier="pnpm exec prettier --cache --ignore-unknown"
|
||||
fi
|
||||
else
|
||||
echo "WARNING! corepack is not installed."
|
||||
fi
|
||||
#if hash corepack 2> /dev/null; then
|
||||
# alias yarn="corepack yarn"
|
||||
# alias yarnpkg="corepack yarnpkg"
|
||||
# alias pnpm="corepack pnpm"
|
||||
# alias pnpx="corepack pnpx"
|
||||
# alias npm="corepack npm"
|
||||
# alias npx="corepack npx"
|
||||
# if ! hash prettier 2> /dev/null; then
|
||||
# alias prettier="pnpm exec prettier --cache --ignore-unknown"
|
||||
# fi
|
||||
#else
|
||||
# echo "WARNING! corepack is not installed."
|
||||
#fi
|
||||
|
||||
# https://pnpm.io/installation#using-a-shorter-alias
|
||||
alias pn="corepack pnpm"
|
||||
@ -735,11 +735,11 @@ function shell-things {
|
||||
# (Everything expects nodejs to be called as node, but it's not with Debian.)
|
||||
fix-node() {
|
||||
if [[ $USER == "root" && -f /usr/bin/nodejs && ! -f /usr/bin/node && ! -f /usr/local/bin/node ]]; then
|
||||
ln -s /usr/bin/nodejs /usr/local/bin/node
|
||||
ln -fnsv /usr/bin/nodejs /usr/local/bin/node
|
||||
fi
|
||||
mkdir -p $HOME/.local/bin
|
||||
mkdir -vp "$HOME/.local/bin"
|
||||
if [[ -f /usr/bin/nodejs && ! -f /usr/bin/node && ! -f /usr/local/bin/node && ! -f $HOME/.local/bin/node ]]; then
|
||||
ln -s /usr/bin/nodejs $HOME/.local/bin/node
|
||||
ln -fnsv /usr/bin/nodejs "$HOME/.local/bin/node"
|
||||
fi
|
||||
}
|
||||
|
||||
|
48
rc/zshrc
48
rc/zshrc
@ -215,11 +215,11 @@ else
|
||||
fi
|
||||
|
||||
# If we are on Linux, enable apt progress bar and colours
|
||||
if [[ $USER = "root" ]]; then
|
||||
mkdir -p /etc/apt/apt.conf.d/
|
||||
echo 'Dpkg::Progress-Fancy "1";' > /etc/apt/apt.conf.d/99progressbar
|
||||
echo 'APT::Color "1";' > /etc/apt/apt.conf.d/99color
|
||||
fi
|
||||
#if [[ $USER = "root" ]]; then
|
||||
# mkdir -p /etc/apt/apt.conf.d/
|
||||
# echo 'Dpkg::Progress-Fancy "1";' > /etc/apt/apt.conf.d/99progressbar
|
||||
# echo 'APT::Color "1";' > /etc/apt/apt.conf.d/99color
|
||||
#fi
|
||||
|
||||
# OS X ls colours (copied from https://apple.stackexchange.com/questions/33677/
|
||||
export CLICOLOR=1
|
||||
@ -568,22 +568,22 @@ alias chattr="\chattr -V"
|
||||
alias chmod="\chmod --verbose"
|
||||
|
||||
# https://github.com/nodejs/corepack/blob/v0.28.2/README.md#corepack-enable--name
|
||||
if hash corepack 2>/dev/null; then
|
||||
alias yarn="corepack yarn"
|
||||
alias yarnpkg="corepack yarnpkg"
|
||||
alias pnpm="corepack pnpm"
|
||||
alias pnpx="corepack pnpx"
|
||||
alias npm="corepack npm"
|
||||
alias npx="corepack npx"
|
||||
if ! hash prettier 2>/dev/null; then
|
||||
alias prettier="pnpm exec prettier --cache --ignore-unknown"
|
||||
fi
|
||||
else
|
||||
echo "WARNING! corepack is not installed."
|
||||
fi
|
||||
#if hash corepack 2>/dev/null; then
|
||||
# alias yarn="corepack yarn"
|
||||
# alias yarnpkg="corepack yarnpkg"
|
||||
# alias pnpm="corepack pnpm"
|
||||
# alias pnpx="corepack pnpx"
|
||||
# alias npm="corepack npm"
|
||||
# alias npx="corepack npx"
|
||||
# if ! hash prettier 2>/dev/null; then
|
||||
# alias prettier="pnpm exec prettier --cache --ignore-unknown"
|
||||
# fi
|
||||
#else
|
||||
# echo "WARNING! corepack is not installed."
|
||||
#fi
|
||||
|
||||
# https://pnpm.io/installation#using-a-shorter-alias
|
||||
alias pn="corepack pnpm"
|
||||
# https://pnpm.io/installation#using-a-shorter-alias
|
||||
alias pn="corepack pnpm"
|
||||
|
||||
# github-pages etc.
|
||||
if hash bundle 2>/dev/null; then
|
||||
@ -724,17 +724,13 @@ cd
|
||||
# This function fixes nodejs on Debian based systems.
|
||||
# (Everything expects nodejs to be called as node, but it's not with Debian.)
|
||||
function fix-node {
|
||||
|
||||
if [[ $USER = "root" && -f /usr/bin/nodejs && ! -f /usr/bin/node && ! -f /usr/local/bin/node ]] then;
|
||||
ln -s /usr/bin/nodejs /usr/local/bin/node
|
||||
ln -fnsv /usr/bin/nodejs /usr/local/bin/node
|
||||
fi
|
||||
|
||||
mkdir -p $HOME/.local/bin
|
||||
|
||||
if [[ -f /usr/bin/nodejs && ! -f /usr/bin/node && ! -f /usr/local/bin/node && ! -f $HOME/.local/bin/node ]] then;
|
||||
ln -s /usr/bin/nodejs $HOME/.local/bin/node
|
||||
ln -fnsv /usr/bin/nodejs $HOME/.local/bin/node
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# This function removes and regenerates ssh host keys.
|
||||
|
Loading…
Reference in New Issue
Block a user