From e2751b06eed31a0e91fdeb70a8073f8b23ae0502 Mon Sep 17 00:00:00 2001 From: ferrreo Date: Thu, 10 Aug 2023 19:27:59 +0100 Subject: [PATCH] Initial commit --- .github/workflows/release.yml | 49 +++++++++++++++++++++ LICENSE.md | 21 +++++++++ debian/changelog | 5 +++ debian/control | 19 +++++++++ debian/copyright | 0 debian/rules | 80 +++++++++++++++++++++++++++++++++++ debian/scripts/get_pwd.sh | 2 + debian/source/format | 1 + main.sh | 19 +++++++++ release.sh | 11 +++++ 10 files changed, 207 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 LICENSE.md create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100755 debian/scripts/get_pwd.sh create mode 100644 debian/source/format create mode 100755 main.sh create mode 100755 release.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ec990c7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: PikaOS Package Release + +on: + workflow_dispatch + +jobs: + build: + runs-on: self-hosted + container: + image: ghcr.io/pikaos-linux/pika-package-container:latest + volumes: + - /proc:/proc + options: --privileged -it + + steps: + - uses: actions/checkout@v3 + + - name: Import GPG key + id: import_gpg + uses: crazy-max/ghaction-import-gpg@v5 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.PASSPHRASE }} + + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.SSH_KEY }} + name: id_rsa + known_hosts: ${{ secrets.KNOWN_HOSTS }} + if_key_exists: replace + + - name: Update apt cache + run: apt-get update -y + + - name: Build Package + run: ./main.sh + + - name: Release Package + run: ./release.sh + + - name: Purge cache + uses: jakejarvis/cloudflare-purge-action@master + env: + # Zone is required by both authentication methods + CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }} + + CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} + PURGE_URLS: '["https://ppa.pika-os.com/dists/lunar/InRelease", "https://ppa.pika-os.com/dists/lunar/main/binary-i386/Packages.gz", "https://ppa.pika-os.com/dists/lunar/main/binary-amd64/Packages.gz", "https://ppa.pikaos.com/dists/lunar/pika-sources.deb", "https://ppa.pika-os.com/dists/lunar/main/source/Sources.gz" ]' diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..125ed9b --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 PikaOS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..328bc5c --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +upstream-name (pkgver-pkgrel) distro_codename; urgency=medium + + * Initial release. (Closes: #nnnn) + + -- ferreo Wed, 18 Jan 2023 21:48:14 +0000 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..0bcd8e0 --- /dev/null +++ b/debian/control @@ -0,0 +1,19 @@ +Source: upstream-name +Section: admin +Priority: optional +Maintainer: name +Standards-Version: 4.6.1 +Build-Depends: debhelper-compat (= 13) +Rules-Requires-Root: no + +Package: pkgname1 +Architecture: linux-any +# Delete any of these lines if un-used +Depends: ${misc:Depends}, depends +Recommends: high priority optdepends +Conflicts: conflicts +Suggests: low priority optdepends +Breaks: also conflicts!? +Provides: provides +# +Description: pkgdesc diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..e69de29 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..ed40aff --- /dev/null +++ b/debian/rules @@ -0,0 +1,80 @@ +#! /usr/bin/make -f + +## See debhelper(7) (uncomment to enable). +## Output every command that modifies files on the build system. +export DH_VERBOSE = 1 + +## === Set paths env vars === + +## Source directory, called upon by $(srcdir) +srcdir = $(shell debian/scripts/get_pwd.sh) +## The Root of package number one, called upon by $(pkgdir1) +pkgdir1 = $(srcdir)/debian/pkgdir1 +## The Root of package number two, you can add as many of these as you like +pkgdir2 = $(srcdir)/debian/pkgdir2 + +## If building a singular package you can remove the number, and as you guessed you call upon it with $(pkgdir) +# pkgdir = $(srcdir)/debian/pkgdir + +## === End end of region === + +## === the chain of command === +## debuild runs a chain of dh functions in the following order: +## dh_testdir +## dh_clean +## dh_auto_clean +## dh_update_autotools_config +## dh_autoreconf +## dh_auto_configure +## dh_prep +## dh_build +## dh_auto_build +## dh_install +## dh_auto_install +## dh_installdocs +## dh_installchangelogs +## dh_perl +## dh_link +## dh_strip_nondeterminism +## dh_compress +## dh_fixperms +## dh_missing +## dh_dwz +## dh_strip +## dh_makeshlibs +## dh_shlibdeps +## dh_installdeb +## dh_gencontrol +## but you are most likely to only need to override the following: +## dh_clean +## dh_auto_configure +## dh_build +## dh_install + +## === End end of region === + +## === overriding dh functions === +## by default all dh functions will run a specific command based on the build system selected by "dh $@" +## if you have a makefile that does everything you need this is fine, +## but most likely you have no MakeFile and you want to add your own commands +## Note : overrides must be places above %: +## So here's a few examples: + +## overriding dh_clean to make it not delete rust vendor files: +#override_dh_clean: +# echo "disabled" + +## overriding dh_auto_configure to add custom configs: +#override_dh_auto_configure: +# $(srcdir)/configure -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_DATADIR=/usr/share -DCMAKE_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu -DBUILD_PLUGIN=OFF + +## overriding dh_install to install files to a package: +#override_dh_auto_configure: +# mkdir -p $(pkgdir1)/usr/bin +# cp $(srcdir)/pikman $(pkgdir1)/usr/bin/ + +## === End end of region === + +## This here will start the build: +%: + dh $@ diff --git a/debian/scripts/get_pwd.sh b/debian/scripts/get_pwd.sh new file mode 100755 index 0000000..ef98ce9 --- /dev/null +++ b/debian/scripts/get_pwd.sh @@ -0,0 +1,2 @@ +#! /bin/sh +env | grep -w "PWD" | cut -c5- diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/main.sh b/main.sh new file mode 100755 index 0000000..4fd7b08 --- /dev/null +++ b/main.sh @@ -0,0 +1,19 @@ +#! /bin/bash + +DEBIAN_FRONTEND=noninteractive + +# Clone Upstream +mkdir -p ./src-pkg-name +cp -rvf ./debian ./src-pkg-name/ +cd ./src-pkg-name/ + +# Get build deps +apt-get build-dep ./ -y + +# Build package +dpkg-buildpackage --no-sign + +# Move the debs to output +cd ../ +mkdir -p ./output +mv ./*.deb ./output/ diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..98eac6c --- /dev/null +++ b/release.sh @@ -0,0 +1,11 @@ +# Sign the packages +dpkg-sig --sign builder ./output/*.deb + +# Pull down existing ppa repo db files etc +rsync -azP --exclude '*.deb' ferreo@direct.pika-os.com:/srv/www/pikappa/ ./output/repo + +# Add the new package to the repo +reprepro -V --basedir ./output/repo/ includedeb lunar ./output/*.deb + +# Push the updated ppa repo to the server +rsync -azP ./output/repo/ ferreo@direct.pika-os.com:/srv/www/pikappa/