From a7dbcddf117ef4de6236793ae20f4371aab4cc82 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Sat, 10 May 2025 16:23:16 +0300 Subject: [PATCH] Simplify source.sh script --- check-version.sh | 15 +++++++++++++++ pkg.info | 2 +- source.sh | 7 +++++-- 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 check-version.sh diff --git a/check-version.sh b/check-version.sh new file mode 100644 index 0000000..dfa7857 --- /dev/null +++ b/check-version.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Github repository +REPO="westes/flex" + +# Get tag name using Github Rest API +TAG_NAME=$(curl -s -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/"$REPO"/releases/latest | jq -r '.tag_name') + +# Get version number from tag name +VERSION=$(echo "$TAG_NAME" | rev | cut -d'-' -f1 | rev) + +# Trim 'v' character in VERSION variable +VERSION=$(echo "$VERSION" | tr -d 'v') + +echo "$VERSION" diff --git a/pkg.info b/pkg.info index 6bc692e..d0971a2 100644 --- a/pkg.info +++ b/pkg.info @@ -1,7 +1,7 @@ name: flex description: Tool for generating text-scanning programs version: 2.6.4 -revision: 2 +revision: 3 url: https://github.com/westes/flex license: Custom architecture: any diff --git a/source.sh b/source.sh index 606f5d7..9e2f276 100644 --- a/source.sh +++ b/source.sh @@ -29,8 +29,11 @@ check() { # This function is used to move the compiled files into the output directory package() { make DESTDIR="$BPM_OUTPUT" install + + # Make symlinks ln -sv flex "$BPM_OUTPUT"/usr/bin/lex ln -sv flex.1 "$BPM_OUTPUT"/usr/share/man/man1/lex.1 - mkdir -p "$BPM_OUTPUT"/usr/share/licenses/flex - cp COPYING "$BPM_OUTPUT"/usr/share/licenses/flex + + # Install package license + install -Dm755 COPYING "$BPM_OUTPUT"/usr/share/licenses/flex/COPYING }