Compare commits

...

16 Commits

Author SHA1 Message Date
391ec83b38
aminda-nocron-reboot.service: attempt to help linuxbrew permissions 2024-07-28 13:04:57 +03:00
8ce36b9c9e
profile.d/50-xdg-screenshots.sh: simplify logic and don't run as root 2024-07-28 12:56:09 +03:00
2d26f20efd
Explicit is better than implicit 2024-07-28 12:37:51 +03:00
e54f4f1689
fix 99-brew.sh in profile.d as well 2024-07-28 11:52:51 +03:00
4eedcf49a7
{bash,zsh}rc#nvm: ignore the manual and go with what is known to work 2024-07-28 11:49:51 +03:00
838b486251
suppress noise 2024-07-28 11:42:02 +03:00
76b088e0ce
{bash,zsh}rc: add adduser-to-group() as I never remember the order otherwise 2024-07-28 11:19:38 +03:00
b4c7de8ab2
Revert "vimrc: comment background colour"
This reverts commit 0dd55997cb.
2024-07-28 11:09:06 +03:00
5aa7f8ec1f
{bash,zsh}rc: don't lookup user locations, causes queries of random tmux domains 2024-07-28 11:03:09 +03:00
81e8ef2754
profile.d: add xdg screenshots dir setting 2024-07-28 11:00:37 +03:00
c4b20f481d
{bash,zsh}rc & profile.d: fix if nvm condition 2024-07-28 09:53:11 +03:00
15a8d5f9eb
{bash,zsh}rc: add yet untested detection for programming language version managers installed through linuxbrew 2024-07-28 08:32:41 +03:00
286694a0c0
{rc/{bash,zsh}rc,profile.d/99-brew.sh}: remove duplicated bath 2024-07-28 07:31:53 +03:00
c30057a344
profile.d: add 99-brew.sh 2024-07-28 07:30:42 +03:00
21e36c11ba
{bash,zsh}rc: add support for linuxbrew 2024-07-28 07:18:12 +03:00
f9fefeeba7
gitconfig: add linuxbrew as a safe directory 2024-07-28 07:01:10 +03:00
8 changed files with 129 additions and 15 deletions

View File

@ -81,3 +81,7 @@
# see also .mikaela/2src-gitconfig within the same shell-things repo # see also .mikaela/2src-gitconfig within the same shell-things repo
[includeIf "gitdir:~/2src/"] [includeIf "gitdir:~/2src/"]
path = ~/2src/gitconfig path = ~/2src/gitconfig
# Don't complain about this path
[safe]
directory = /home/linuxbrew/.linuxbrew

View File

@ -0,0 +1,27 @@
# OK, so this could be a lot more pretty, but it works for ensuring users have
# a screenshot directory (even if I still don't know does anything else than
# grimshot care about that).
# root is neither taking screenshots nor using gui
if [[ "$(id -u)" != "0" ]]; then
# if the configuration file exists, that is good enough indication for me
# that the tools are supported.
if [[ -f "$(xdg-user-dir)/.config/user-dirs.locale)" ]]; then
# If the output differs, the path is set and there is no need to
# continue.
if [[ $(xdg-user-dir SCREENSHOTS) != $(xdg-user-dir) ]]; then
# If we are continuing anyway, ensure existence of locale file and see if it's something I support.
touch "$(cat $(xdg-user-dir)/.config/user-dirs.locale)"
XDGLOCALE="$(cat $(xdg-user-dir)/.config/user-dirs.locale)"
if [[ "$XDGLOCALE" == "fi" || "$XDGLOCALE" == "fi_FI" ]]; then
# I would say Kuvankaappaukset, but for some reason KDE Plasma says Kuvakaappaukset, and I don't care enough.
xdg-user-dirs-update --set SCREENSHOTS $(xdg-user-dir PICTURES)/Kuvakaappaukset
else
# Generic English fallack, like I think upstream does.
xdg-user-dirs-update --set SCREENSHOTS $(xdg-user-dir PICTURES)/Screenshots
fi
# Ensure the directory exists.
mkdir -p "$(xdg-user-dir SCREENSHOTS)"
fi
fi
fi

15
etc/profile.d/99-brew.sh Normal file
View File

@ -0,0 +1,15 @@
# https://github.com/Homebrew/brew
if [ -d /home/linuxbrew/.linuxbrew/bin ]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
# https://github.com/nvm-sh/nvm
if [ -d ~/.nvm ]; then
. ~/.nvm/nvm.sh
. ~/.nvm/bash_completion
elif [ -d /home/linuxbrew/.linuxbrew/opt/nvm ]; then
mkdir -p /home/linuxbrew/.nvm
export NVM_DIR=/home/linuxbrew/.nvm
. /home/linuxbrew/.linuxbrew/opt/nvm/nvm.sh
# . /home/linuxbrew/.linuxbrew/opt/nvm/etc/bash_completion.d/nvm
fi

View File

@ -5,6 +5,7 @@ Wants=sysctl-p--system.service
[Service] [Service]
Type=oneshot Type=oneshot
TimeoutStartSec=infinity TimeoutStartSec=infinity
Environment=LINUXBREWGROUP=wheel
# - means it can fail, without failing those after it. # - means it can fail, without failing those after it.
# These aren't given --now as THEY WOULD INFINITE LOOP. # These aren't given --now as THEY WOULD INFINITE LOOP.
ExecStartPre=-/usr/bin/systemctl enable aminda-nocron-rebootish.service ExecStartPre=-/usr/bin/systemctl enable aminda-nocron-rebootish.service
@ -37,6 +38,8 @@ ExecStart=-/usr/bin/systemctl enable --now sshguard.service
ExecStart=-/usr/bin/systemctl enable --now unbound.service ExecStart=-/usr/bin/systemctl enable --now unbound.service
ExecStart=-/usr/bin/systemctl enable --now chrony.service ExecStart=-/usr/bin/systemctl enable --now chrony.service
ExecStart=-/usr/bin/systemctl enable --now chronyd.service ExecStart=-/usr/bin/systemctl enable --now chronyd.service
ExecStart=-/bin/chown -R root:$LINUXBREWGROUP /home/linuxbrew -R
ExecStart=-/bin/setfacl -R -m g:$LINUXBREWGROUP:rwx,o:rx /home/linuxbrew
User=root User=root
StandardOutput=journal StandardOutput=journal
StandardError=journal StandardError=journal

View File

@ -0,0 +1,5 @@
# in case linuxbrew users have a group separate from wheel, this is the place
# to specify it.
[Service]
Environment=LINUXBREWGROUP=
Environment=LINUXBREWGROUP=linuxbrew

View File

@ -144,9 +144,9 @@ if hash lsb_release 2> /dev/null; then
printf "$(uptime --pretty)\t$(uptime)\n" printf "$(uptime --pretty)\t$(uptime)\n"
printf "\nPresent:\n" printf "\nPresent:\n"
if hash who 2> /dev/null; then if hash who 2> /dev/null; then
who --heading --lookup --mesg --users who --heading --mesg --users
elif hash last 2> /dev/null; then elif hash last 2> /dev/null; then
last --hostlast --dns --present $(date +%R) --fullnames --system --time-format notime last --hostlast --present $(date +%R) --fullnames --system --time-format notime
fi fi
printf "\n" printf "\n"
@ -270,8 +270,13 @@ export RES_OPTIONS="timeout:2 attempts:2 rotate edns0 trust-ad"
# https://github.com/go-nv/goenv # https://github.com/go-nv/goenv
if [ -d ~/.goenv/bin ]; then if [ -d ~/.goenv/bin ]; then
export GOENV_ROOT="$HOME/.goenv" export GOENV_ROOT="$HOME/.goenv"
PATH="$HOME/.goenv/bin:$PATH" PATH="$GOENV_ROOT/bin:$PATH"
#goenv init > /dev/null 2>&1 eval "$(goenv init -)"
PATH="$GOROOT/bin:$PATH"
PATH="$PATH:$GOPATH/bin"
elif [ -d /home/linuxbrew/.linuxbrew/opt/goenv ]; then
export GOENV_ROOT="$/home/linuxbrew/.linuxbrew/opt/goenv"
PATH="$GOENV_ROOT/bin:$PATH"
eval "$(goenv init -)" eval "$(goenv init -)"
PATH="$GOROOT/bin:$PATH" PATH="$GOROOT/bin:$PATH"
PATH="$PATH:$GOPATH/bin" PATH="$PATH:$GOPATH/bin"
@ -281,14 +286,22 @@ fi
if [ -d ~/.nvm ]; then if [ -d ~/.nvm ]; then
. ~/.nvm/nvm.sh . ~/.nvm/nvm.sh
. ~/.nvm/bash_completion . ~/.nvm/bash_completion
elif [ -d /home/linuxbrew/.linuxbrew/opt/nvm ]; then
mkdir -p /home/linuxbrew/.nvm
export NVM_DIR=/home/linuxbrew/.nvm
. /home/linuxbrew/.linuxbrew/opt/nvm/nvm.sh
#. /home/linuxbrew/.linuxbrew/opt/nvm/etc/bash_completion.d/nvm
fi fi
# https://github.com/rbenv/rbenv # https://github.com/rbenv/rbenv
if [ -d ~/.rbenv/bin ]; then if [ -d ~/.rbenv/bin ]; then
PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH" PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
rbenv init > /dev/null 2>&1 eval "$(rbenv init -)"
# Remember! And verify it before running! # Remember! And verify it before running!
# git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build # git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
elif [ -d /home/linuxbrew/.linuxbrew/opt/rbenv/bin ]; then
PATH="/home/linuxbrew/.linuxbrew/opt/rbenv/bin:/home/linuxbrew/.linuxbrew/opt/rbenv/bin/shims:$PATH"
eval "$(rbenv init -)"
fi fi
# Add RubyGems to PATH # Add RubyGems to PATH
@ -299,18 +312,29 @@ fi
# https://github.com/pyenv/pyenv # https://github.com/pyenv/pyenv
if [ -d ~/.pyenv/bin ]; then if [ -d ~/.pyenv/bin ]; then
PATH="$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH" PATH="$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH"
pyenv init > /dev/null 2>&1 eval "$(pyenv init -)"
# Worth considering (and verifying before running) # Worth considering (and verifying before running)
# git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv # git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
# git clone https://github.com/pyenv/pyenv-virtualenvwrapper.git $(pyenv root)/plugins/pyenv-virtualenvwrapper # git clone https://github.com/pyenv/pyenv-virtualenvwrapper.git $(pyenv root)/plugins/pyenv-virtualenvwrapper
elif [ -d /home/linuxbrew/.linuxbrew/opt/pyenv/bin ]; then
PATH="/home/linuxbrew/.linuxbrew/opt/pyenv/bin:/home/linuxbrew/.linuxbrew/opt/pyenv/shims:$PATH"
eval "$(pyenv init -)"
fi fi
# https://github.com/nodenv/nodenv # https://github.com/nodenv/nodenv
if [ -d ~/.nodenv/bin ]; then if [ -d ~/.nodenv/bin ]; then
PATH="$HOME/.nodenv/bin:$PATH" PATH="$HOME/.nodenv/bin:$PATH"
eval "$(nodenv init - bash)" eval "$(nodenv init -)"
# Remember! And verify it before running! # Remember! And verify it before running!
# git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build # git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build
elif [ -d /home/linuxbrew/.linuxbrew/opt/nodenv/bin ]; then
PATH="/home/linuxbrew/.linuxbrew/opt/nodenv/bin:$PATH"
eval "$(nodenv init -)"
fi
# https://github.com/Homebrew/brew
if [ -d /home/linuxbrew/.linuxbrew/bin ]; then
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
fi fi
# Removes duplicates from $PATH. Copied from https://unix.stackexchange.com/a/14896 # Removes duplicates from $PATH. Copied from https://unix.stackexchange.com/a/14896
@ -905,6 +929,12 @@ else
} }
fi fi
# In Debian there is "sudo adduser whoever whatever", but I keep forgetting
# that the more common way is usermod -aG whatever,whereever whoever
adduser-to-group() {
usermod -aG "$2" "$1"
}
# Source files for miscannellious modifications. # Source files for miscannellious modifications.
# acme.sh # acme.sh

View File

@ -23,7 +23,7 @@ set number " Show line numbers.
set ruler " Show the line and column number of the cursor position, set ruler " Show the line and column number of the cursor position,
" separated by a comma. " separated by a comma.
"set background=dark set background=dark
"Use modelines! "Use modelines!
set modeline set modeline

View File

@ -37,9 +37,9 @@ if hash lsb_release 2> /dev/null; then
printf "$(uptime --pretty)\t$(uptime)\n" printf "$(uptime --pretty)\t$(uptime)\n"
printf "\nPresent:\n" printf "\nPresent:\n"
if hash who 2> /dev/null; then if hash who 2> /dev/null; then
who --heading --lookup --mesg --users who --heading --mesg --users
elif hash last 2> /dev/null; then elif hash last 2> /dev/null; then
last --hostlast --dns --present $(date +%R) --fullnames --system --time-format notime last --hostlast --present $(date +%R) --fullnames --system --time-format notime
fi fi
printf "\n" printf "\n"
df / $HOME --human-readable --output=source,fstype,size,used,avail,pcent | uniq df / $HOME --human-readable --output=source,fstype,size,used,avail,pcent | uniq
@ -224,8 +224,13 @@ export RES_OPTIONS="timeout:2 attempts:2 rotate edns0 trust-ad"
# https://github.com/go-nv/goenv # https://github.com/go-nv/goenv
if [ -d ~/.goenv/bin ]; then if [ -d ~/.goenv/bin ]; then
export GOENV_ROOT="$HOME/.goenv" export GOENV_ROOT="$HOME/.goenv"
PATH="$HOME/.goenv/bin:$PATH" PATH="$GOENV_ROOT/bin:$PATH"
#goenv init > /dev/null 2>&1 eval "$(goenv init -)"
PATH="$GOROOT/bin:$PATH"
PATH="$PATH:$GOPATH/bin"
elif [ -d /home/linuxbrew/.linuxbrew/opt/goenv ]; then
export GOENV_ROOT="$/home/linuxbrew/.linuxbrew/opt/goenv"
PATH="$GOENV_ROOT/bin:$PATH"
eval "$(goenv init -)" eval "$(goenv init -)"
PATH="$GOROOT/bin:$PATH" PATH="$GOROOT/bin:$PATH"
PATH="$PATH:$GOPATH/bin" PATH="$PATH:$GOPATH/bin"
@ -235,14 +240,22 @@ fi
if [ -d ~/.nvm ]; then if [ -d ~/.nvm ]; then
. ~/.nvm/nvm.sh . ~/.nvm/nvm.sh
. ~/.nvm/bash_completion . ~/.nvm/bash_completion
elif [ -d /home/linuxbrew/.linuxbrew/opt/nvm ]; then
mkdir -p /home/linuxbrew/.nvm
export NVM_DIR=/home/linuxbrew/.nvm
. /home/linuxbrew/.linuxbrew/opt/nvm/nvm.sh
#. /home/linuxbrew/.linuxbrew/opt/nvm/etc/bash_completion.d/nvm
fi fi
# https://github.com/rbenv/rbenv # https://github.com/rbenv/rbenv
if [ -d ~/.rbenv/bin ]; then if [ -d ~/.rbenv/bin ]; then
PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH" PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
rbenv init > /dev/null 2>&1 eval "$(rbenv init -)"
# Remember! And verify it before running! # Remember! And verify it before running!
# git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build # git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
elif [ -d /home/linuxbrew/.linuxbrew/opt/rbenv/bin ]; then
PATH="/home/linuxbrew/.linuxbrew/opt/rbenv/bin:/home/linuxbrew/.linuxbrew/opt/rbenv/bin/shims:$PATH"
eval "$(rbenv init -)"
fi fi
# Add RubyGems to PATH # Add RubyGems to PATH
@ -253,18 +266,29 @@ fi
# https://github.com/pyenv/pyenv # https://github.com/pyenv/pyenv
if [ -d ~/.pyenv/bin ]; then if [ -d ~/.pyenv/bin ]; then
PATH="$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH" PATH="$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH"
pyenv init > /dev/null 2>&1 eval "$(pyenv init -)"
# Worth considering (and verifying before running) # Worth considering (and verifying before running)
# git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv # git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
# git clone https://github.com/pyenv/pyenv-virtualenvwrapper.git $(pyenv root)/plugins/pyenv-virtualenvwrapper # git clone https://github.com/pyenv/pyenv-virtualenvwrapper.git $(pyenv root)/plugins/pyenv-virtualenvwrapper
elif [ -d /home/linuxbrew/.linuxbrew/opt/pyenv/bin ]; then
PATH="/home/linuxbrew/.linuxbrew/opt/pyenv/bin:/home/linuxbrew/.linuxbrew/opt/pyenv/shims:$PATH"
eval "$(pyenv init -)"
fi fi
# https://github.com/nodenv/nodenv # https://github.com/nodenv/nodenv
if [ -d ~/.nodenv/bin ]; then if [ -d ~/.nodenv/bin ]; then
PATH="$HOME/.nodenv/bin:$PATH" PATH="$HOME/.nodenv/bin:$PATH"
eval "$(nodenv init - zsh)" eval "$(nodenv init -)"
# Remember! And verify it before running! # Remember! And verify it before running!
# git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build # git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build
elif [ -d /home/linuxbrew/.linuxbrew/opt/nodenv/bin ]; then
PATH="/home/linuxbrew/.linuxbrew/opt/nodenv/bin:$PATH"
eval "$(nodenv init -)"
fi
# https://github.com/Homebrew/brew
if [ -d /home/linuxbrew/.linuxbrew/bin ]; then
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
fi fi
# Removes duplicates from $PATH. Copied from https://unix.stackexchange.com/a/14896 # Removes duplicates from $PATH. Copied from https://unix.stackexchange.com/a/14896
@ -883,6 +907,12 @@ else
} }
fi fi
# In Debian there is "sudo adduser whoever whatever", but I keep forgetting
# that the more common way is usermod -aG whatever,whereever whoever
adduser-to-group() {
usermod -aG "$2" "$1"
}
# Source files for miscannellious modifications. # Source files for miscannellious modifications.
# acme.sh # acme.sh