From c86223f4737bba455890463638620562c0769a84 Mon Sep 17 00:00:00 2001 From: Eric Nielsen <4120606+ericbn@users.noreply.github.com> Date: Sun, 28 Apr 2024 14:05:03 -0500 Subject: [PATCH] Don't use tar --strip as it's not compatible with BSD distributions. Fixes #534 --- CHANGELOG.md | 6 ++++++ src/stage2/75_zimfw_tool_degit.zsh.erb | 9 ++++++++- src/zimfw.zsh.erb | 2 +- zimfw.zsh | 13 ++++++++++--- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3abf0d..3e639c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 _No unreleased changes._ +## [1.13.1] - 2024-04-28 + +### Fixed + +- The `--strip` option in tar command is not BSD compatible. + ## [1.13.0] - 2024-02-17 ### Added diff --git a/src/stage2/75_zimfw_tool_degit.zsh.erb b/src/stage2/75_zimfw_tool_degit.zsh.erb index 7d4a7d8..c2f3de3 100644 --- a/src/stage2/75_zimfw_tool_degit.zsh.erb +++ b/src/stage2/75_zimfw_tool_degit.zsh.erb @@ -71,10 +71,17 @@ _zimfw_download_tarball() { } _zimfw_untar_tarball() { - if ! ERR=$(command tar -C ${1} --strip=1 -xzf ${TARBALL_TARGET} 2>&1); then + if ! ERR=$(command tar -C ${1} -xzf ${TARBALL_TARGET} 2>&1); then _zimfw_print_error "Error extracting ${TARBALL_TARGET}" ${ERR} return 1 fi + local zsubdir + for zsubdir in ${1}/*(/); do + if ! ERR=$(command mv -f ${zsubdir}/*(DN) ${1} 2>&1 && command rmdir ${zsubdir} 2>&1); then + _zimfw_print_error "Error moving ${zsubdir}" ${ERR} + return 1 + fi + done } _zimfw_tool_degit() { diff --git a/src/zimfw.zsh.erb b/src/zimfw.zsh.erb index cdf7107..c8de893 100644 --- a/src/zimfw.zsh.erb +++ b/src/zimfw.zsh.erb @@ -4,7 +4,7 @@ class Zim :bold, :normal, :red, :normalred, :yellow, :normalyellow, :clear_line, :ellipsis, :okay, :warn, :error def initialize - @version = "1.13.0" + @version = "1.13.1-SNAPSHOT" @home = "${ZDOTDIR:-${HOME}}" @min_zsh_version = "5.2" # Matches {ssh,http,https,git}://{user@,}host/org/repo and {user@,}host:org/repo diff --git a/zimfw.zsh b/zimfw.zsh index 7acc2ae..8e1237f 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -454,7 +454,7 @@ _zimfw_compile() { } _zimfw_info() { - print -R 'zimfw version: '${_zversion}' (built at 2024-02-17 02:05:06 UTC, previous commit is 9de3984)' + print -R 'zimfw version: '${_zversion}' (built at 2024-04-28 19:04:33 UTC, previous commit is 39d2087)' local zparam for zparam in LANG ${(Mk)parameters:#LC_*} OSTYPE TERM TERM_PROGRAM TERM_PROGRAM_VERSION ZIM_HOME ZSH_VERSION; do print -R ${(r.22....:.)zparam}${(P)zparam} @@ -645,10 +645,17 @@ _zimfw_download_tarball() { } _zimfw_untar_tarball() { - if ! ERR=$(command tar -C ${1} --strip=1 -xzf ${TARBALL_TARGET} 2>&1); then + if ! ERR=$(command tar -C ${1} -xzf ${TARBALL_TARGET} 2>&1); then _zimfw_print_error "Error extracting ${TARBALL_TARGET}" ${ERR} return 1 fi + local zsubdir + for zsubdir in ${1}/*(/); do + if ! ERR=$(command mv -f ${zsubdir}/*(DN) ${1} 2>&1 && command rmdir ${zsubdir} 2>&1); then + _zimfw_print_error "Error moving ${zsubdir}" ${ERR} + return 1 + fi + done } _zimfw_tool_degit() { @@ -874,7 +881,7 @@ _zimfw_run_tool_action() { zimfw() { builtin emulate -L zsh -o EXTENDED_GLOB - local -r _zversion='1.13.0' _zversion_target=${ZIM_HOME}/.latest_version zusage=$'Usage: \E[1m'${0}$'\E[0m [\E[1m-q\E[0m|\E[1m-v\E[0m] + local -r _zversion='1.13.1-SNAPSHOT' _zversion_target=${ZIM_HOME}/.latest_version zusage=$'Usage: \E[1m'${0}$'\E[0m [\E[1m-q\E[0m|\E[1m-v\E[0m] Actions: \E[1mbuild\E[0m Build \E[1m'${ZIM_HOME}$'/init.zsh\E[0m and \E[1m'${ZIM_HOME}$'/login_init.zsh\E[0m.