From f1c57a0ae6eb8f342065bda80c0234379a72e748 Mon Sep 17 00:00:00 2001 From: damage Date: Sun, 15 Sep 2024 21:40:29 +0200 Subject: [PATCH] build deb package --- .gitignore | 4 +++- build/credentials.example | 2 ++ build/deb/build_stable.sh | 42 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 build/credentials.example create mode 100755 build/deb/build_stable.sh diff --git a/.gitignore b/.gitignore index 1d92c05..a7254a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .vscode -shperm \ No newline at end of file +shperm +build/credentials +build/deb/*.deb diff --git a/build/credentials.example b/build/credentials.example new file mode 100644 index 0000000..3377c14 --- /dev/null +++ b/build/credentials.example @@ -0,0 +1,2 @@ +GITEA_USER=user +GITEA_PASS=pass or token diff --git a/build/deb/build_stable.sh b/build/deb/build_stable.sh new file mode 100755 index 0000000..db6a739 --- /dev/null +++ b/build/deb/build_stable.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +set -e + +NAME=shperm +VERSION=1.0 +REVISION=1 +ARCH=amd64 + +if ! git tag -l |fgrep $VERSION; then + git tag $VERSION + git push origin $VERSION +fi + +curdir=`dirname $0` +workdir="$curdir/${NAME}_${VERSION}-${REVISION}_${ARCH}" +mkdir -p "$workdir" + +mkdir -p "$workdir/usr/bin" +gcc -o "$workdir/usr/bin/shperm" ../../shperm.c +chmod 0777 "$workdir/usr/bin/shperm" + +mkdir "$workdir/DEBIAN" +cat << EOT > "$workdir/DEBIAN/control" +Package: $NAME +Version: $VERSION +Architecture: $ARCH +Maintainer: Daniel Buschke +Description: Shows permissions from given path + up to the root folder +Homepage: https://source.devloop.de/damage/shperm +EOT + +dpkg-deb --build --root-owner-group "$workdir" +if [[ $? -eq 0 ]]; then + source "$curdir/../credentials" + curl --user "$GITEA_USER:$GITEA_PASS" \ + --upload-file "${NAME}_${VERSION}-${REVISION}_${ARCH}.deb" \ + https://source.devloop.de/api/packages/damage/debian/pool/stable/main/upload + + rm -rf "$workdir" +fi