From 02ddeffd36519793867548972385d2d3adf1fe33 Mon Sep 17 00:00:00 2001 From: MDLeom <2809763-curben@users.noreply.gitlab.com> Date: Mon, 15 Jul 2024 09:43:45 +0000 Subject: [PATCH] fix: unzip alternatives --- src/script.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/script.sh b/src/script.sh index 53a6736a..ea64cb51 100644 --- a/src/script.sh +++ b/src/script.sh @@ -39,8 +39,6 @@ check_grep() { } check_grep - -## Fallback to busybox's dos2unix if installed if ! command -v dos2unix &> /dev/null then if command -v busybox &> /dev/null @@ -52,6 +50,19 @@ then fi fi +if command -v unzip &> /dev/null +then + alias unzip="unzip -p" +elif command -v busybox &> /dev/null +then + alias unzip="busybox unzip -p" +elif command -v bsdunzip &> /dev/null +then + alias unzip="bsdunzip -p" +else + echo "unzip not found" + exit 1 +fi ## Create a temporary working folder mkdir -p "tmp/" @@ -93,7 +104,7 @@ fi cp -f "../src/exclude.txt" "." ## Prepare URLhaus.csv -unzip -p "urlhaus.zip" | \ +unzip "urlhaus.zip" | \ # Convert DOS to Unix line ending dos2unix | \ tr "[:upper:]" "[:lower:]" | \ @@ -139,7 +150,7 @@ sort -u > "urlhaus-domains-online.txt" ## Parse the Umbrella 1 Million -unzip -p "top-1m-umbrella.zip" | \ +unzip "top-1m-umbrella.zip" | \ dos2unix | \ tr "[:upper:]" "[:lower:]" | \ # Parse domains only @@ -150,7 +161,7 @@ sed "s/^www\.//g" | \ sort -u > "top-1m-umbrella.txt" ## Parse the Tranco 1 Million -unzip -p "top-1m-tranco.zip" | \ +unzip "top-1m-tranco.zip" | \ dos2unix | \ tr "[:upper:]" "[:lower:]" | \ # Parse domains only