Re: a patch to replace zipinfo with bsdunzip

"Zhang Wen" ([email protected] via alfs-discuss Mailing List) <[email protected]> Tue, 18 Feb 2025 12:27:53 +0800
Newsgroups gmane.linux.lfs.automated
Message-ID <[email protected]>
在 2025/2/18 7:30, Ken Moffat ([email protected] via alfs-discuss 
Mailing List) 写道:
> On Sun, Feb 16, 2025 at 12:49:42PM +0800, Zhang Wen wrote:
>> Not sure if there's a better way to do this, it seems tricky to use
>> awk and tail commands.
>>
>> diff --git a/BLFS/xsl/scripts.xsl b/BLFS/xsl/scripts.xsl
>> index 0bf4348..825fde1 100644
>> --- a/BLFS/xsl/scripts.xsl
>> +++ b/BLFS/xsl/scripts.xsl
>> @@ -349,7 +349,7 @@ case $PACKAGE in
>>        JH_UNPACKDIR=`head -n1 unpacked | cut  -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
>>        ;;
>>     *.zip)
>> -     zipinfo -1 $SRC_DIR/$PACKAGE &gt; unpacked
>> +     bsdunzip -1 $SRC_DIR/$PACKAGE|awk '{print $4}'|tail -n +3 &gt; unpacked
> 
> Should that not be -l (lowercase L) rather than -1 ?
> 
> I'm on an older version on this machine, apologies if -1 is now an
> option.
> 
>   ĸen
> 
> 
My fault, it should be -l(lowercase L) instead of -1.

diff --git a/BLFS/xsl/scripts.xsl b/BLFS/xsl/scripts.xsl
index 0bf4348..3f23c6e 100644
--- a/BLFS/xsl/scripts.xsl
+++ b/BLFS/xsl/scripts.xsl
@@ -349,7 +349,7 @@ case $PACKAGE in
       JH_UNPACKDIR=`head -n1 unpacked | cut  -d" " -f2 | sed 
's@^\./@@;s@/.*@@'`
       ;;
    *.zip)
-     zipinfo -1 $SRC_DIR/$PACKAGE &gt; unpacked
+     bsdunzip -l $SRC_DIR/$PACKAGE|awk '{print $4}'|tail -n +3 &gt; 
unpacked
       JH_UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
       if test $(wc -w &lt;&lt;&lt; $JH_UNPACKDIR) -eq 1; then
         unzip $SRC_DIR/$PACKAGE

-- 
http://lists.linuxfromscratch.org/sympa/info/alfs-discuss
Unsubscribe: See the above information page
0001-replace-zipinfo-with-bsdunzip.patch (text/plain, 843 B)
From 8ad9a7bd7a5b3c33b965632455fbefce55841fe0 Mon Sep 17 00:00:00 2001
From: Zhang Wen <[email protected]>
Date: Sun, 16 Feb 2025 00:56:35 +0800
Subject: [PATCH] replace zipinfo with bsdunzip

---
 BLFS/xsl/scripts.xsl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BLFS/xsl/scripts.xsl b/BLFS/xsl/scripts.xsl
index 0bf4348..3f23c6e 100644
--- a/BLFS/xsl/scripts.xsl
+++ b/BLFS/xsl/scripts.xsl
@@ -349,7 +349,7 @@ case $PACKAGE in
      JH_UNPACKDIR=`head -n1 unpacked | cut  -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
      ;;
   *.zip)
-     zipinfo -1 $SRC_DIR/$PACKAGE &gt; unpacked
+     bsdunzip -l $SRC_DIR/$PACKAGE|awk '{print $4}'|tail -n +3 &gt; unpacked
      JH_UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
      if test $(wc -w &lt;&lt;&lt; $JH_UNPACKDIR) -eq 1; then
        unzip $SRC_DIR/$PACKAGE
-- 
2.48.1