From 2b61f2be376b1d3e5491b341c006ff22f589b2bd Mon Sep 17 00:00:00 2001 From: Christian Schendel Date: Wed, 3 Sep 2025 22:18:51 +0200 Subject: [PATCH] Initial commit --- .SRCINFO | 28 +++++++++++ .gitignore | 17 +++++++ .nvchecker.toml | 4 ++ LICENSE | 12 +++++ LICENSES/0BSD.txt | 1 + LICENSES/MIT.txt | 18 ++++++++ PKGBUILD | 100 ++++++++++++++++++++++++++++++++++++++++ REUSE.toml | 30 ++++++++++++ chroot-build | 65 ++++++++++++++++++++++++++ wireguird.desktop.patch | 14 ++++++ 10 files changed, 289 insertions(+) create mode 100644 .SRCINFO create mode 100644 .gitignore create mode 100644 .nvchecker.toml create mode 100644 LICENSE create mode 120000 LICENSES/0BSD.txt create mode 100644 LICENSES/MIT.txt create mode 100644 PKGBUILD create mode 100644 REUSE.toml create mode 100755 chroot-build create mode 100644 wireguird.desktop.patch diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..269c4e5 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,28 @@ +pkgbase = wireguird + pkgdesc = GUI frontend to connect to and manage WireGuard tunnels (GTK3) + pkgver = 1.1.0 + pkgrel = 2 + url = https://github.com/UnnoTed/wireguird + arch = x86_64 + license = MIT + makedepends = git + makedepends = go + depends = bash + depends = cairo + depends = fontconfig + depends = gdk-pixbuf2 + depends = glib2 + depends = glibc + depends = gtk3 + depends = hicolor-icon-theme + depends = libayatana-appindicator + depends = openresolv + depends = pango + depends = polkit + depends = wireguard-tools + source = wireguird-1.1.0::git+https://github.com/UnnoTed/wireguird.git#tag=v1.1.0 + source = wireguird.desktop.patch + b2sums = 66538951a7fda7e58997a022fd49d4a3a23862a8f859c1b9551599de5d5606e023262c05fc48513789d5568267a019f9af7c1ca5be431afd88358a7ef2aeed67 + b2sums = e6f387cc259f9ad84a921c6f4abfa2645aff9b909a327492faa44d180079578bfa863d11f57cac4b8f937983bdc2dbeeb6a075ada704f2c8540462b35614c6bf + +pkgname = wireguird diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a8267d1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# Ignore everything +* + +# But not these files... +!.gitignore +!PKGBUILD +!.SRCINFO +!LICENSE +!chroot-build +!.nvchecker.toml +!/keys +!/keys/pgp +!/keys/pgp/*.asc +!/LICENSES +!/LICENSES/*.txt +!REUSE.toml +!*.patch diff --git a/.nvchecker.toml b/.nvchecker.toml new file mode 100644 index 0000000..90a6766 --- /dev/null +++ b/.nvchecker.toml @@ -0,0 +1,4 @@ +[wireguird] +source = "git" +git = "https://github.com/UnnoTed/wireguird.git" +prefix = "v" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b87c5e4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,12 @@ +Copyright Arch Linux Contributors + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE +FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/LICENSES/0BSD.txt b/LICENSES/0BSD.txt new file mode 120000 index 0000000..ea5b606 --- /dev/null +++ b/LICENSES/0BSD.txt @@ -0,0 +1 @@ +../LICENSE \ No newline at end of file diff --git a/LICENSES/MIT.txt b/LICENSES/MIT.txt new file mode 100644 index 0000000..d817195 --- /dev/null +++ b/LICENSES/MIT.txt @@ -0,0 +1,18 @@ +MIT License + +Copyright (c) + +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/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..d85dfbc --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,100 @@ +# Maintainer: Christian Schendel +# Contributor: flan_suse + +# The "stylized" name of the application is "WireGUIrd" (aka: "wireguard GUI") + +# PACKAGER'S NOTE: +# This program runs with elevated permissions ("Polkit"). +# The config file is located under /root/wireguird.settings +# It's preferable to use your WireGuard VPN provider's official application. +# If they do not provide one, you can use NetworkManager to create WireGuard tunnels. +# As a last resort, this application is a simple GUI that leverages "wg-quick". +# Any *.conf files found under /etc/wireguard will automatically be loaded in the list. +# You can also manually add or remove WireGuard *.conf files using the GUI interface. + +# IMPORTANT NOTE ABOUT USAGE: +# If a config's filename is longer than 15 characters, you cannot activate the tunnel. +# This is due to a limitation of interface names on Linux. + +pkgname=wireguird +pkgver=1.1.0 +pkgrel=2 +pkgdesc="GUI frontend to connect to and manage WireGuard tunnels (GTK3)" +arch=('x86_64') +url="https://github.com/UnnoTed/wireguird" +license=('MIT') +depends=( + bash + cairo + fontconfig + gdk-pixbuf2 + glib2 + glibc + gtk3 + hicolor-icon-theme + libayatana-appindicator + openresolv + pango + polkit + wireguard-tools +) +makedepends=( + git + go +) +source=( + "$pkgname-$pkgver::git+$url.git#tag=v$pkgver" + 'wireguird.desktop.patch' +) +b2sums=('66538951a7fda7e58997a022fd49d4a3a23862a8f859c1b9551599de5d5606e023262c05fc48513789d5568267a019f9af7c1ca5be431afd88358a7ef2aeed67' + 'e6f387cc259f9ad84a921c6f4abfa2645aff9b909a327492faa44d180079578bfa863d11f57cac4b8f937983bdc2dbeeb6a075ada704f2c8540462b35614c6bf') + +prepare() { + cd "$pkgname-$pkgver" + mkdir -p build/ + # a patch is more robust than sed + patch -p1 -i ../wireguird.desktop.patch +} + +build() { + cd $pkgname-$pkgver + + # Prepare the environment, so as to not download modules outside + # the working source directory + mkdir -p "$srcdir/go/"{.config,.cache} + export GOPATH=$srcdir/go + export GOENV=$srcdir/go/.config + export GOCACHE=$srcdir/go/.cache + + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + export CGO_LDFLAGS="${LDFLAGS}" + export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" + + go build -o build + go clean -cache -modcache +} + +package() { + cd "$pkgname-$pkgver" + + install -dm0755 "$pkgdir/opt/$pkgname" + install -Dm0755 build/$pkgname "$pkgdir/opt/$pkgname" + + install -dm0755 "$pkgdir/opt/$pkgname/Icon" + cp -a --no-preserve=ownership Icon "$pkgdir/opt/$pkgname" + + install -dm0755 "$pkgdir/usr/share/icons/hicolor/scalable/apps" + install -Dm0644 Icon/wireguard.svg \ + "$pkgdir/usr/share/icons/hicolor/scalable/apps/wireguird.svg" + + install -Dm0755 -t "$pkgdir/usr/bin" \ + deb/usr/local/bin/wireguird + + cp -a --no-preserve=ownership deb/usr/share "$pkgdir/usr" + + install -Dm0644 -t "$pkgdir/usr/share/doc/$pkgname/" \ + README.md preview.png deb/DEBIAN/changelog + install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE +} diff --git a/REUSE.toml b/REUSE.toml new file mode 100644 index 0000000..42eb6fe --- /dev/null +++ b/REUSE.toml @@ -0,0 +1,30 @@ +version = 1 + +[[annotations]] +path = [ + "PKGBUILD", + "README.md", + "keys/**", + ".SRCINFO", + ".nvchecker.toml", + ".gitignore", + "*.install", + "*.sysusers", + "*.tmpfiles", + "*.logrotate", + "*.pam", + "*.service", + "*.socket", + "*.timer", + "*.desktop", + "*.hook", +] +SPDX-FileCopyrightText = "Arch Linux contributors" +SPDX-License-Identifier = "0BSD" + +[[annotations]] +path = [ + "*.patch", +] +SPDX-FileCopyrightText = "wireguird contributors" +SPDX-License-Identifier = "MIT" diff --git a/chroot-build b/chroot-build new file mode 100755 index 0000000..f69cac8 --- /dev/null +++ b/chroot-build @@ -0,0 +1,65 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: Christian Schendel +# SPDX-License-Identifier: 0BSD + +set -euo pipefail +use_tmpfs=true +CHROOT="/tmp/mkarchroot" + +check_available_ram() { + if [ "$(awk '/^MemAvailable:/ { print $2; }' /proc/meminfo)" -lt 50000 ]; then + use_tmpfs=false + fi +} + +create_chroot_directory() { + if [ $use_tmpfs ]; then + sudo mount --mkdir -t tmpfs -o defaults,size=20G tmpfs $CHROOT + else + sudo mkdir -p "$CHROOT" + fi +} + +create_chroot_environment() { + if [[ ! -d "$CHROOT/root" ]]; then + mkarchroot -M ~/.config/pacman/makepkg.conf "$CHROOT/root" base-devel + fi +} + +build_package(){ + arch-nspawn "$CHROOT/root" pacman -Syu + if makechrootpkg -c -r "$CHROOT" -- -Asf . ; then + makepkg --printsrcinfo >.SRCINFO + else + delete_chroot_environment && echo -e "\n\e[1;31m==> BUILD FAILED: \e[1;37m$CHROOT removed\e[0m " && exit 1 + fi +} + +sign_package(){ + PACKAGE="$(makepkg --packagelist)" + gpg --use-agent --output "$PACKAGE.sig" --detach-sign "$PACKAGE" +} + +delete_chroot_environment() { + if [ "$(stat -f --format=%T "$CHROOT")" == "btrfs" ]; then + { + sudo btrfs subvolume delete "$CHROOT/root/var/lib/portables" + sudo btrfs subvolume delete "$CHROOT/root/var/lib/machines" + sudo btrfs subvolume delete "$CHROOT/root" + sudo rm -Rf $CHROOT + } >>/dev/null 2>&1 + elif [ "$(stat -f --format=%T "$CHROOT")" == "tmpfs" ]; then + sudo umount -f $CHROOT + fi + sudo rm -Rf $CHROOT +} + +check_available_ram +create_chroot_directory +create_chroot_environment +build_package +sign_package +delete_chroot_environment + +# vim: set ts=4 sw=4 et: diff --git a/wireguird.desktop.patch b/wireguird.desktop.patch new file mode 100644 index 0000000..269ab21 --- /dev/null +++ b/wireguird.desktop.patch @@ -0,0 +1,14 @@ +--- a/deb/usr/share/applications/wireguird.desktop ++++ b/deb/usr/share/applications/wireguird.desktop +@@ -3,6 +3,8 @@ + Version=1.1 + Type=Application + Terminal=false +-Exec=/usr/local/bin/wireguird ++Exec=wireguird + Name=Wireguird +-Icon=/opt/wireguird/Icon/128x128/wireguard.png ++Icon=wireguird ++Categories=Network ++Comment=Manage, create, and connect to WireGuard tunnels +