1
0

Compare commits

...

7 Commits

Author SHA1 Message Date
37599593bc ci: switch to Debian 13 "Trixie"
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-08-18 12:08:45 +03:00
a6e52c8992 zsh: improve sbuild snippet
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-08-18 10:58:51 +03:00
06126b2991 sbuild: dedup & adjust
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-08-17 17:36:29 +03:00
00648901a9 zsh: update
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-07-23 10:59:44 +03:00
48e93e48b6 zsh: openwrt-related goodies
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/manual/woodpecker Pipeline was successful
2025-07-13 21:09:51 +03:00
12449788a6 zsh/git goodies
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2025-07-08 12:21:04 +03:00
3b6c18395b zsh: openwrt-related goodies
listing archives with apk-tools 3.0.0_pre20250606 is PITA
2025-07-08 12:20:59 +03:00
20 changed files with 285 additions and 159 deletions

View File

@@ -29,6 +29,7 @@
!/.config/zsh/alias/k8s.zsh
!/.config/zsh/alias/kconfig.zsh
!/.config/zsh/alias/ls.zsh
!/.config/zsh/alias/openwrt.zsh
!/.config/zsh/alias/quilt.zsh
!/.config/zsh/alias/sbuild.zsh
!/.config/zsh/alias/sudo.zsh
@@ -63,7 +64,6 @@
!/.config/zsh/lib/systemd.zsh
!/.config/zsh/lib/term.zsh
!/.config/zsh/lib/time.zsh
!/.config/zsh/lib/title.zsh
!/.config/zsh/local.zsh.example
!/.config/zsh/local/.keep
!/.config/zsh/local/completion/.keep
@@ -77,7 +77,8 @@
!/.config/zsh/rc.zsh
!/.config/zsh/rc/completion.zsh
!/.config/zsh/rc/gpg-agent.zsh
!/.config/zsh/rc/keyboard.zsh
!/.config/zsh/rc/keyboard-base.zsh
!/.config/zsh/rc/keyboard-extras.zsh
!/.config/zsh/rc/pager.zsh
!/.config/zsh/rc/prompt.zsh
!/.config/zsh/rc/ssh-agent.zsh

View File

@@ -1,6 +1,6 @@
steps:
- name: check
image: docker.io/debian:bookworm-slim
image: docker.io/debian:trixie-slim
environment:
DEBCONF_NONINTERACTIVE_SEEN: 'true'
DEBIAN_FRONTEND: 'noninteractive'

View File

@@ -12,8 +12,8 @@ $run_autopkgtest = 0;
$run_lintian = 0;
$run_piuparts = 0;
$apt_distupgrade = 0;
$apt_upgrade = 0;
$apt_distupgrade = 1;
$apt_upgrade = 1;
$purge_build_directory = 'successful';

View File

@@ -1,10 +1,12 @@
#!/bin/zsh
## early module load
zmodload -s zsh/zprof
## early load modules
zmodload zsh/mathfunc zsh/datetime zsh/zprof
typeset -gA ZSHU
__z_unsupported() { echo "not supported" >&2 ; }
ZSHU[t_begin]=${(%):-%D{%s.%6.}}
ZSHU[d_zdot]="${ZDOTDIR}"

View File

@@ -6,6 +6,7 @@ alias gds='git diff -p --stat=200 '
alias gdu='git-dir-usage '
alias ggc='git-gc '
alias ggcf='git-gc-force '
alias gst='git status -s '
git-dir-usage() {
local gitdir x topdir
@@ -73,3 +74,7 @@ git-archive-ref() {
git-br() {
__z_git -c core.pager='cat' branch --no-abbrev "$@"
}
git-rebase-log() {
git log --format='pick %h # %s' --reverse "$@"
}

View File

@@ -0,0 +1,42 @@
#!/bin/zsh
openwrt-ssh() {
ssh -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no "$@"
}
openwrt-apk-list() {
(( ${+commands[openwrt-apk]} )) || {
echo 'missing "openwrt-apk"' >&2
return 127
}
local i w
w=$(mktemp -d) ; : "${w:?}"
for i ; do
[ -n "$i" ] || continue
find "$w/" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
find "$w/" -mindepth 1 -maxdepth 1 -exec rm -rf {} + || return
openwrt-apk extract --no-cache --no-logfile --no-network --no-check-certificate --allow-untrusted --no-chown --destination "$w" "$i"
env -C "$w" find ./ -mindepth 1 -exec ls -ldgG --color {} +
done
rm -rf "$w"
}
openwrt-ipk-list() {
local i m o
for i ; do
[ -n "$i" ] || continue
o=0
for m ( './data.tar.gz' 'data.tar.gz' ) ; do
tar -tf "$i" "$m" 2>/dev/null || continue
o=1
env printf '%q:\n' "$i"
tar -Oxf "$i" "$m" | tar -ztvf -
break
done
if [ "$o" = '0' ] ; then
env printf '%q: missing data.tar.gz\n' "$i"
continue
fi
done
}

View File

@@ -64,10 +64,20 @@ krd-sbuild() {
find -name '*.build' -type f -exec xz -9vv {} +
done
find -name '*_all.deb' -type f -exec mv -fvt "../${arch}-all" {} +
find -name '*_all.ddeb' -type f -exec mv -fvt "../${arch}-all" {} +
find -name '*dbgsym*.deb' -type f -exec mv -fvt "../${arch}-debug" {} +
find -name '*.ddeb' -type f -exec mv -fvt "../${arch}-debug" {} +
find \
-name '*_all.deb' -type f \
-exec mv -fvt "../${arch}-all" {} +
find \
-name '*_all.ddeb' -type f \
-exec mv -fvt "../${arch}-all" {} +
find \
-regextype egrep -regex '.+dbg(sym)?_[^_]+_'"${arch}"'\.d?deb$' -type f \
-exec mv -fvt "../${arch}-debug" {} +
find \
-name '*.ddeb' -type f \
-exec mv -fvt "../${arch}-debug" {} +
cd "${builddir}-all"
find -type f -exec mv -nvt '../all' {} +
)

View File

@@ -7,8 +7,7 @@ z-time() {
"$@" ; r=$?
a=$[ EPOCHREALTIME - a ]
a=$(z-ts-to-human "$a" 6)
echo >&2
echo "time took: $a" >&2
printf '\n# time took: %s\n' "$a" >&2
return $r
}
@@ -49,5 +48,7 @@ add-zsh-hook precmd __z_cmdtime_measure
add-zsh-hook preexec __z_cmdtime_set
else
echo "cmd time measurement is disabled due to missing hook support" >&2
echo "cmd time measurement is disabled due to missing hook support" >&2
fi

View File

@@ -47,5 +47,7 @@ __z_pwd_hook() {
add-zsh-hook precmd __z_pwd_hook
else
echo "shiny pwd's are disabled due to missing hook support" >&2
echo "shiny pwd's are disabled due to missing hook support" >&2
fi

View File

@@ -1,5 +1,6 @@
#!/bin/zsh
typeset -gA ZSHU_TERM
typeset -Uga ZSHU_TERM_MISSING
z-ti-test() {
@@ -16,3 +17,136 @@ z-ti-test() {
return $r
}
case "${TERM}" in
xterm* | putty* | rxvt* | konsole* | mlterm* | alacritty* | foot* | contour* )
ZSHU_TERM[has_title_tab]=1
ZSHU_TERM[has_title_wnd]=1
ZSHU_TERM[want_cwd]=1
ZSHU_TERM[title_tab]=term
ZSHU_TERM[title_wnd]=term
;;
st* | wezterm* )
ZSHU_TERM[has_title_tab]=1
ZSHU_TERM[has_title_wnd]=1
ZSHU_TERM[title_tab]=term
ZSHU_TERM[title_wnd]=term
;;
cygwin | ansi )
ZSHU_TERM[has_title_tab]=1
ZSHU_TERM[has_title_wnd]=1
ZSHU_TERM[title_tab]=term
ZSHU_TERM[title_wnd]=term
;;
screen* | tmux* )
ZSHU_TERM[has_title_tab]=1
ZSHU_TERM[want_cwd]=1
ZSHU_TERM[title_tab]=mux
;;
* )
if z-ti-test fsl tsl ; then
ZSHU_TERM[has_title_tab]=1
ZSHU_TERM[want_cwd]=1
ZSHU_TERM[title_tab]=terminfo
fi
;;
esac
z-term-title-tab() {
# [ "${ZSHU_TERM[has_title_tab]}" = 1 ] || return 1
case "${ZSHU_TERM[title_tab]:-}" in
term )
print -Pn "\e]1;${1:q}\a"
;;
mux )
## screen/tmux: hardstatus
print -Pn "\ek${1:q}\e\\"
;;
terminfo )
echoti tsl
print -Pn "$1"
echoti fsl
;;
esac
}
z-term-title-window() {
# [ "${ZSHU_TERM[has_title_wnd]}" = 1 ] || return 1
case "${ZSHU_TERM[title_wnd]:-}" in
term )
print -Pn "\e]2;${1:q}\a"
;;
esac
}
z-term-title() {
## if $2 is unset use $1 as default
## if it is set and empty, leave it as is
: ${2=$1}
z-term-title-tab "$1"
z-term-title-window "$2"
}
z-term-cwd() {
[ "${ZSHU_TERM[want_cwd]}" = 1 ] || return 1
local host path
host=${HOST:-localhost}
path=${PWD}
## Konsole doesn't want ${host}
while : ; do
[ -n "${KONSOLE_DBUS_SERVICE}" ] || break
[ -n "${KONSOLE_DBUS_SESSION}" ] || break
[ -n "${KONSOLE_DBUS_WINDOW}" ] || break
[ -n "${KONSOLE_PROFILE_NAME}" ] || break
host=
break ; done
printf "\e]7;file://%s%s\e\\" "${host}" "${path}"
}
if autoload -Uz add-zsh-hook ; then
ZSHU[term_title]=1
z-term-title-enable() { ZSHU[term_title]=1 ; }
z-term-title-disable() { ZSHU[term_title]=0 ; }
ZSHU[title_tab]='%15<..<%~%<<'
ZSHU[title_wnd]='%n@%m:%~'
__z_term_title_precmd() {
[ "${ZSHU[term_title]}" = 1 ] || return
z-term-title "${ZSHU[title_tab]}" "${ZSHU[title_wnd]}"
}
add-zsh-hook precmd __z_term_title_precmd
ZSHU[term_cwd]=1
z-term-cwd-enable() { ZSHU[term_cwd]=1 ; }
z-term-cwd-disable() { ZSHU[term_cwd]=0 ; }
__z_term_cwd_precmd() {
[ "${ZSHU[term_cwd]}" = 1 ] || return
z-term-cwd
}
## "chpwd" doesn't always hook pwd changes
add-zsh-hook precmd __z_term_cwd_precmd
else
echo "current working directory and tab/window title handling is disabled due to missing hook support" >&2
z-term-title-enable() { __z_unsupported ; }
z-term-title-disable() { __z_unsupported ; }
z-term-cwd-enable() { __z_unsupported ; }
z-term-cwd-disable() { __z_unsupported ; }
fi

View File

@@ -1,58 +0,0 @@
#!/bin/zsh
ZSHU[title_tab]='%15<..<%~%<<'
ZSHU[title_window]='%n@%m:%~'
z-title-tab() {
emulate -L zsh
case "${TERM}" in
cygwin | xterm* | putty* | rxvt* | konsole* | ansi | mlterm* | alacritty | st* )
print -Pn "\e]1;${1:q}\a"
;;
screen* | tmux* )
## hardstatus
print -Pn "\ek${1:q}\e\\"
;;
* )
z-ti-test fsl tsl || return
echoti tsl
print -Pn "$1"
echoti fsl
;;
esac
}
z-title-window() {
emulate -L zsh
case "${TERM}" in
cygwin | xterm* | putty* | rxvt* | konsole* | ansi | mlterm* | alacritty | st* )
print -Pn "\e]2;${1:q}\a"
;;
esac
}
z-title() {
emulate -L zsh
## if $2 is unset use $1 as default
## if it is set and empty, leave it as is
: ${2=$1}
z-title-tab "$1"
z-title-window "$2"
}
if autoload -Uz add-zsh-hook ; then
__z_title_precmd() {
z-title "${ZSHU[title_tab]}" "${ZSHU[title_window]}"
}
add-zsh-hook precmd __z_title_precmd
else
echo "tab/window title handling is disabled due to missing hook support" >&2
fi

View File

@@ -1,13 +1,6 @@
#!/bin/zsh
unsetopt err_exit
unsetopt err_return
unsetopt multios
unsetopt err_exit err_return multios
setopt bsd_echo
setopt interactive_comments
setopt long_list_jobs
setopt monitor
setopt prompt_subst
setopt zle
setopt bsd_echo interactive_comments long_list_jobs monitor prompt_subst zle
# setopt magic_equal_subst

View File

@@ -1,9 +1,5 @@
#!/bin/zsh
unsetopt flow_control
unsetopt menu_complete
unsetopt flow_control menu_complete
setopt always_to_end
setopt auto_menu
setopt complete_aliases
setopt complete_in_word
setopt always_to_end auto_menu complete_aliases complete_in_word

View File

@@ -1,7 +1,3 @@
#!/bin/zsh
setopt auto_cd
setopt auto_pushd
setopt cdable_vars
setopt pushd_ignore_dups
setopt pushd_minus
setopt auto_cd auto_pushd cdable_vars pushd_ignore_dups pushd_minus

View File

@@ -1,11 +1,3 @@
#!/bin/zsh
setopt append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_all_dups
setopt hist_ignore_dups
setopt hist_ignore_space
setopt hist_verify
setopt inc_append_history
setopt share_history
setopt append_history extended_history hist_expire_dups_first hist_ignore_all_dups hist_ignore_dups hist_ignore_space hist_verify inc_append_history share_history

View File

@@ -1,28 +1,50 @@
#!/bin/zsh
typeset -Ua zshu_modules
zshu_modules+=(
typeset -a zshu_modules
## DEBUG module load order
# typeset -a zshu_m0 zshu_m1
zshu_modules=(
clone
langinfo
parameter
sched
termcap
terminfo
watch
zpty
zle
zleparameter
deltochar
complete
complist
computil
datetime
langinfo
main
mathfunc
parameter
stat
system
terminfo
zle
zutil
compctl
)
for i ( ${zshu_modules} ) ; do
case "$i" in
*/* ) ;;
* ) i="zsh/$i" ;;
esac
i="zsh/$i"
## DEBUG module load order
# zshu_m0=( $(zmodload) )
# if ((${zshu_m0[(Ie)${i}]})); then
# echo "# already loaded: $i" >&2
# continue
# fi
zmodload "$i"
## DEBUG module load order
# zshu_m1=( $(zmodload) )
# for k ( ${zshu_m1} ) ; do
# if [ "$k" = "$i" ] ; then continue ; fi
# if ((${zshu_m0[(Ie)${k}]})); then
# continue
# fi
# echo "# new module loaded (with $i): $k" >&2
# done
done
unset i zshu_modules
## DEBUG module load order
# unset zshu_m0 zshu_m1
autoload -Uz +X colors && colors

View File

@@ -4,10 +4,8 @@ typeset -A ZSHU_TI_KEYS
typeset -A ZSHU_FB_KEYS
if z-ti-test smkx rmkx ; then
zle-line-init() { emulate -L zsh ; echoti smkx ; }
zle-line-finish() { emulate -L zsh ; echoti rmkx ; }
# zle-line-init() { echoti smkx ; }
# zle-line-finish() { echoti rmkx ; }
zle-line-init() { echoti smkx ; }
zle-line-finish() { echoti rmkx ; }
zle -N zle-line-init
zle -N zle-line-finish
fi
@@ -87,7 +85,7 @@ z-bind () {
case "${widget}" in
/* )
widget=${widget:1}
emulate zsh -c "autoload -RUz ${widget}"
autoload -RUz "${widget}"
zle -N "${widget}"
;;
esac
@@ -131,8 +129,3 @@ z-bind emacs viins vicmd -- Esc-w kill-region
## use emacs key bindings
bindkey -e
for i ( /usr/share/doc/fzf/examples/key-bindings.zsh ) ; do
[ -s "$i" ] || continue
source $i
done ; unset i

View File

@@ -0,0 +1,7 @@
#!/bin/zsh
## TODO: more fzf locations
for i ( /usr/share/doc/fzf/examples/key-bindings.zsh ) ; do
[ -s "$i" ] || continue
source $i
done ; unset i

View File

@@ -84,17 +84,25 @@ z-ps1() {
return
}
local k
for k ( "$1" "${1}L" ) ; do
(( ${+ZSHU_PS1[$k]} )) || continue
local k ; k=$1
case "$k" in
[1-9] )
(( ${+ZSHU_PS1[$k]} )) || k="${k}L"
;;
[1-9][Ll] )
(( ${+ZSHU_PS1[$k]} )) || k="${k%?}L"
;;
esac
(( ${+ZSHU_PS1[$k]} )) || return 1
ZSHU_PS[ps1]=$k
PS1=${ZSHU_PS1[$k]}
return
done
return 1
ZSHU_PS[ps1]=$k
PS1=${ZSHU_PS1[$k]}
}
z-ps1 3
[ "${ZSHU_RUN[nested]}" = 1 ] && z-ps1 2
[ "${ZSHU_RUN[nested1L]}" = 1 ] && z-ps1 1
if [ "${ZSHU_RUN[nested1L]}" = 1 ] ; then
z-ps1 1
elif [ "${ZSHU_RUN[nested]}" = 1 ] ; then
z-ps1 2
else
z-ps1 3
fi

View File

@@ -1,21 +0,0 @@
$chroot_mode = "schroot";
$build_path = '';
$pgp_options = [ '-us', '-uc', '-ui' ];
$build_arch_all = 1;
$build_arch_any = 1;
$check_space = 0;
$enable_network = 1;
$run_autopkgtest = 0;
$run_lintian = 0;
$run_piuparts = 0;
$apt_distupgrade = 0;
$apt_upgrade = 0;
$purge_build_directory = 'successful';
# don't remove this, Perl needs it:
1;

1
.sbuildrc.dist Symbolic link
View File

@@ -0,0 +1 @@
.config/sbuild/config.pl.dist