From: sev Date: Sun, 20 Mar 2022 02:53:01 +0000 (-0500) Subject: adjust args in install.sh find, zprofile path X-Git-Url: https://git.sev.monster/~sev/dotfiles.git/commitdiff_plain/a8dee69aaede1f7aaea1d9a21871742035c2e55d?hp=6d54344e74d961369b15acb46cc95ae8da282c79 adjust args in install.sh find, zprofile path move mindepth and maxdepth global options for GNU find add PREFIX to path search, simplify brace expansion --- diff --git a/base/.zprofile b/base/.zprofile index 73de480..0d64d4f 100644 --- a/base/.zprofile +++ b/base/.zprofile @@ -25,7 +25,7 @@ function _sev_zcleanup { ## gpg forwarding if [[ -d $_sev_gpg_forward_dir && ( -z $1 || $1 == 'gpg-forward' ) ]] { # clean up forward dirs if its session is dead or we ask for it - find $_sev_gpg_forward_dir -type d -mindepth 1 -maxdepth 1 | + find $_sev_gpg_forward_dir -mindepth 1 -maxdepth 1 -type d | while {read -r x} { # NOTE: the only way we can get here is if we have not been # forwarded before, if the user asks for it, or during @@ -58,7 +58,7 @@ function _sev_zcleanup { # NOTE: XDG dirs that use our tmp are not unset here, they are in zlogout if [[ -d $_sev_tmp && ( -z $1 || $1 == 'tmp' ) ]] { # clean up tmp dirs if its session is dead or we ask for it - find $_sev_tmp -name '.session.*' -type d -mindepth 1 -maxdepth 1 | + find $_sev_tmp -mindepth 1 -maxdepth 1 -name '.session.*' -type d | while {read -r x} { # NOTE: same rationale as above p=${$(basename $x)#.session.} @@ -86,10 +86,11 @@ if [[ ! -v _sev_setup_path || -o login ]] { typeset -U path fpath # add as many generic paths as possible to keep the order we want # NOTE: /usr/{local,pkg,games} are unix/bsdisms + # XXX: PREFIX not validated, non-posix but Termux uses it syspath=("$path[@]") - path=({~,~/.local,,/usr,/opt,/usr/local,/usr/pkg}/sbin - {~,~/.local,,/usr,/opt,/usr/local,/usr/pkg}/bin - /usr/X11R{7,6}/bin /usr/games) + path=({~,~/.local,{$PREFIX,}{,/opt,/usr{,/local,pkg}}}/sbin + {~,~/.local,{$PREFIX,}{,/opt,/usr{,/local,pkg}}}/bin + /usr/{X11R{7,6}/bin,games}) ((len=$#path)) path=("$path[@]" "$syspath[@]") # remove nonexistent and duplicate paths