diff --git a/.gitignore b/.gitignore index fcf54f43..a3876403 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ debian/ +dist/ +release/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 94f74c83..c417f1c0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,8 +18,12 @@ release: - if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME when: never - if: $RELEASE_TOKEN + artifacts: + paths: + - dist/* script: - CI_PUSH_REPO=`echo "$CI_REPOSITORY_URL" | sed 's/^.*@/@/g'` - git remote set-url --push origin "https://gitlab-ci-token:${RELEASE_TOKEN}$CI_PUSH_REPO" - git tag `date "+%Y%m%d"` - git push --tags + - make dist diff --git a/Makefile b/Makefile index 75039ccb..b8ac3be8 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,14 @@ check: fi @pre-commit run --all-files +dist: + @mkdir -p release dist + ./copy-firmware.sh release + @TARGET=linux-firmware_`git describe`.tar.gz; \ + cd release && tar -czf ../dist/$${TARGET} *; \ + echo "Created dist/$${TARGET}" + @rm -rf release + install: install -d $(DESTDIR)$(FIRMWAREDIR) ./copy-firmware.sh $(DESTDIR)$(FIRMWAREDIR) @@ -23,3 +31,6 @@ install-xz: install-zst: install -d $(DESTDIR)$(FIRMWAREDIR) ./copy-firmware.sh --zstd $(DESTDIR)$(FIRMWAREDIR) + +clean: + rm -rf release dist diff --git a/copy-firmware.sh b/copy-firmware.sh index 1ae1e37c..59ff976e 100755 --- a/copy-firmware.sh +++ b/copy-firmware.sh @@ -9,12 +9,16 @@ prune=no # shellcheck disable=SC2209 compress=cat compext= +quiet=">/dev/null" +rdfind_results=/dev/null while test $# -gt 0; do case $1 in -v | --verbose) # shellcheck disable=SC2209 verbose=echo + quiet= + rdfind_results=results.txt shift ;; @@ -115,6 +119,12 @@ grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read f d; do fi done +$verbose rdfind -makesymlinks true "$destdir" -outputname $rdfind_results "$quiet" +find "$destdir" -type l | while read -r l; do + target="$(realpath "$l")" + ln -fs "$(realpath --relative-to="$(dirname "$(realpath -s "$l")")" "$target")" "$l" +done + exit 0 # vim: et sw=4 sts=4 ts=4