i have 3 jails that use nullfs to mount the home directory
each jail has zsh installed and so they all use the zsh config files
i need a way to check the os,
so i can have different shell config for each jail
so they can have different shell paths
XDG_RUNTIME_DIR directories, or use X11 or wayland
this is done using the ~/.zshenv file
with 2 case statements
the first case statement uses OSTYPE to check if the jail is running Freebsd
the second case statement use uname -a to check if the jail is running Ubuntu or Rocky linux
github.com
just using OSTYPE or uname on its own doesnt work
you have to use them both
each jail has zsh installed and so they all use the zsh config files
i need a way to check the os,
so i can have different shell config for each jail
so they can have different shell paths
XDG_RUNTIME_DIR directories, or use X11 or wayland
this is done using the ~/.zshenv file
with 2 case statements
the first case statement uses OSTYPE to check if the jail is running Freebsd
the second case statement use uname -a to check if the jail is running Ubuntu or Rocky linux
cerberus/zsh/ostype-uname.org at master · NapoleonWils0n/cerberus
cerberus code library. Contribute to NapoleonWils0n/cerberus development by creating an account on GitHub.
Code:
vi ~/.zshenv
Code:
# ~/.zshenv
# for ZSH
case "$OSTYPE" in
freebsd*)
# Path
typeset -U PATH path
path=("$path[@]")
export PATH
# XDG_RUNTIME_DIR
export XDG_RUNTIME_DIR=/var/run/xdg/"${USER}"
# wayland - uncomment to use wayland
export WAYLAND_DISPLAY=wayland-0
export QT_QPA_PLATFORM=wayland
export GDK_BACKEND=wayland
;;
esac
case "$(uname -a)" in
*ubuntu*)
typeset -U PATH path
path=( "$HOME/.cargo/bin" "/opt/resolve/bin" "/bin" "/usr/bin" "$path[@]")
export PATH
# XDG_RUNTIME_DIR
export XDG_RUNTIME_DIR="/run/user/`id -u`"
# dummy-uvm.so for access to the gpu
export LD_PRELOAD="${HOME}"/.config/gpu/dummy-uvm.so
# wayland - uncomment to use wayland
#export WAYLAND_DISPLAY=wayland-0
#export QT_QPA_PLATFORM=wayland
#export GDK_BACKEND=wayland
# x11 - comment out to use wayland
export DISPLAY=:0
export QT_QPA_PLATFORM=xcb
export GDK_BACKEND=x11
. "$HOME/.cargo/env"
;;
*rocky*)
typeset -U PATH path
path=( "/usr/local/cuda-12.4/bin" "/bin" "/usr/bin" "$path[@]")
export PATH
# XDG_RUNTIME_DIR
export XDG_RUNTIME_DIR="/run/user/`id -u`"
# dummy-uvm.so for access to the gpu
export LD_PRELOAD="${HOME}"/.config/gpu/dummy-uvm.so
# wayland - uncomment to use wayland
#export WAYLAND_DISPLAY=wayland-0
#export QT_QPA_PLATFORM=wayland
#export GDK_BACKEND=wayland
# x11 - comment out to use wayland
export DISPLAY=:0
export QT_QPA_PLATFORM=xcb
export GDK_BACKEND=x11
;;
esac
# xdg directories
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
# qt5
export QT_QPA_PLATFORMTHEME=qt5ct
just using OSTYPE or uname on its own doesnt work
you have to use them both