mrrl

Minimal Reliable Reproducible Linux
git clone https://ccx.te2000.cz/git/mrrl
Log | Files | Refs | Submodules | README

commit 0df54cd5d6a626a3b29cb0a76cd535b811ef88c5
parent afddfa255941b4eb9657274b77a48f003d5d713b
Author: Jan Pobrislo <ccx@te2000.cz>
Date:   Sat,  3 May 2025 17:21:35 +0000

Fix gen-downloadlist-entry for mrrl paths

Diffstat:
Mutil/gen-downloadlist-entry | 18+++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/util/gen-downloadlist-entry b/util/gen-downloadlist-entry @@ -2,7 +2,7 @@ setopt no_unset warn_create_global zmodload zsh/stat || exit $? -typeset -g basedir=$0:h +typeset -g basedir=${0:P:h:h} typeset -g hl_fatal hl_reset if (( $terminfo[colors] >= 8 )); then @@ -67,18 +67,26 @@ confirm() { ### Main {{{1 main() { - local digest url fname + local digest url fname dl_dir dl_list local -A statinfo url=$1 fname=${2:-./${1:t}} + dl_dir=$basedir/cache/downloads/sha256 + dl_list=$basedir/downloadlist.sha256 + + [[ -f $dl_list ]] || + die100 "Could not find downloadlist file, expected ${(qqq)dl_list}" + + [[ -d $dl_dir ]] || + die100 "Could not find downloads directory, expected ${(qqq)dl_dir}" zstat -H statinfo - $fname || die_ret $? "stat failed" digest=${"$(sha256sum $fname)"%% *} || die_ret $? "sha256sum failed" printf '%s %s %s\n' $digest $statinfo[size] $url - confirm "Write to $basedir/downloadlist.sha256 and move file to downloads? [y/N]" - printf >>$basedir/downloadlist.sha256 '%s %s %s\n' $digest $statinfo[size] $url - mv -v $fname $basedir/downloads/sha256/$digest + confirm "Write to $dl_list and move file to downloads? [y/N]" + printf >>$dl_list '%s %s %s\n' $digest $statinfo[size] $url + mv -v $fname $dl_dir/$digest } main "$@"