From 6e3959f0b288cf4080a63af83a215abdc1d825f0 Mon Sep 17 00:00:00 2001 From: eshanized Date: Tue, 31 Dec 2024 05:03:00 +0530 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20perf:=20more=20improved=20?= =?UTF-8?q?script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snigdhaos-brave-config/build.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/snigdhaos-brave-config/build.sh b/snigdhaos-brave-config/build.sh index 6ea42b86..890a4167 100644 --- a/snigdhaos-brave-config/build.sh +++ b/snigdhaos-brave-config/build.sh @@ -2,10 +2,22 @@ set -e +# Define source files and the output package name sourcefiles="Brave-Browser" -pkgname=$(grep "^pkgname=" PKGBUILD | awk -F"=" '{print $2}') -pkgrel=$(grep "^pkgrel=" PKGBUILD | awk -F"=" '{split($2,a," ");gsub(/"/, "", a[1]);print a[1]}') -arch=$(grep "^arch=" PKGBUILD | awk -F"'" '{print $2}') +# Extract pkgname, pkgrel, and arch from the PKGBUILD +pkgname=$(grep "^pkgname=" PKGBUILD | awk -F"=" '{print $2}' | xargs) +pkgrel=$(grep "^pkgrel=" PKGBUILD | awk -F"=" '{split($2,a," ");gsub(/"/, "", a[1]);print a[1]}' | xargs) +arch=$(grep "^arch=" PKGBUILD | awk -F"'" '{print $2}' | xargs) -tar -zcvf $pkgname.tar.gz $sourcefiles +# Check if the necessary source files exist before proceeding +if [ ! -d "$sourcefiles" ]; then + echo "Error: The source directory '$sourcefiles' does not exist." + exit 1 +fi + +# Create the tarball +echo "Creating tarball $pkgname-$pkgrel-$arch.tar.gz..." +tar -zcvf "$pkgname-$pkgrel-$arch.tar.gz" "$sourcefiles" + +echo "Tarball $pkgname-$pkgrel-$arch.tar.gz created successfully."