summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO19
-rw-r--r--PKGBUILD38
-rw-r--r--twingate-bin.install88
3 files changed, 145 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..580572cfe99c
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,19 @@
+pkgbase = twingate-bin
+ pkgdesc = Twingate (twingate): Client for providing secure access to private resources for distributed workforces under a zero trust networking model
+ pkgver = 0.146.0
+ pkgrel = 0
+ url = https://www.twingate.com/
+ install = twingate-bin.install
+ arch = aarch64
+ arch = x86_64
+ depends = sudo
+ depends = cryptsetup
+ depends = curl
+ depends = dbus
+ depends = libnl
+ source_aarch64 = twingate_arm64_0.146.0.tar.zst::https://binaries.twingate.com/client/linux/ARCH/aarch64/stable/twingate-arm64.pkg.tar.zst
+ sha256sums_aarch64 = 939ec380b47d4f949c1f1c5c64bdb2e9197e203712a8efb3f2cdab5d41bbee0a
+ source_x86_64 = twingate_x64_0.146.0.tar.zst::https://binaries.twingate.com/client/linux/ARCH/x86_64/stable/twingate-amd64.pkg.tar.zst
+ sha256sums_x86_64 = 9d9d8448dad3dda97af4046def873f071e6ee54b3d16139b8cb8d083bdc457e2
+
+pkgname = twingate-bin
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..ae209f9c29a1
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,38 @@
+# Maintainer: Alex R <alex at ironrobin dot net>
+
+pkgname=twingate-bin
+_pkgname=twingate
+pkgdesc="Twingate (twingate): Client for providing secure access to private resources for distributed workforces under a zero trust networking model"
+pkgver=0.146.0
+pkgrel=0
+arch=('aarch64' 'x86_64')
+url="https://www.twingate.com/"
+depends=('sudo' 'cryptsetup' 'curl' 'dbus' 'libnl')
+install=$pkgname.install
+
+source_aarch64=(twingate_arm64_${pkgver}.tar.zst::https://binaries.twingate.com/client/linux/ARCH/aarch64/stable/twingate-arm64.pkg.tar.zst)
+source_x86_64=(twingate_x64_${pkgver}.tar.zst::https://binaries.twingate.com/client/linux/ARCH/x86_64/stable/twingate-amd64.pkg.tar.zst)
+sha256sums_aarch64=('939ec380b47d4f949c1f1c5c64bdb2e9197e203712a8efb3f2cdab5d41bbee0a')
+sha256sums_x86_64=('9d9d8448dad3dda97af4046def873f071e6ee54b3d16139b8cb8d083bdc457e2')
+
+package() {
+ install -d "${pkgdir}/var/lib/${_pkgname}"
+ install -d "${pkgdir}/run/${_pkgname}"
+
+ install -Dm 644 "${srcdir}/usr/share/bash-completion/completions/${_pkgname}" "${pkgdir}/usr/share/bash-completion/completions/${_pkgname}"
+ install -Dm 644 "${srcdir}/usr/lib/systemd/system/${_pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${_pkgname}.service"
+ install -Dm 644 "${srcdir}/usr/lib/systemd/system-preset/${_pkgname}.preset" "${pkgdir}/usr/lib/systemd/system-preset/${_pkgname}.preset"
+ install -Dm 644 "${srcdir}/usr/lib/systemd/user/${_pkgname}-desktop-notifier.service" "${pkgdir}/usr/lib/systemd/user/${_pkgname}-desktop-notifier.service"
+
+ install -Dm 644 "${srcdir}/etc/${_pkgname}/autostart.conf" "${pkgdir}/etc/${_pkgname}/autostart.conf"
+ install -Dm 644 "${srcdir}/etc/${_pkgname}/config.json" "${pkgdir}/etc/${_pkgname}/config.json"
+ install -Dm 644 "${srcdir}/etc/${_pkgname}/controller_url.conf" "${pkgdir}/etc/${_pkgname}/controller_url.conf"
+ install -Dm 644 "${srcdir}/etc/${_pkgname}/network.conf" "${pkgdir}/etc/${_pkgname}/network.conf"
+ install -Dm 644 "${srcdir}/etc/${_pkgname}/sentry_user_consent.conf" "${pkgdir}/etc/${_pkgname}/sentry_user_consent.conf"
+
+ install -Dm 644 "${srcdir}/etc/xdg/autostart/${_pkgname}-autostart.desktop" "${pkgdir}/etc/xdg/autostart/${_pkgname}-autostart.desktop"
+
+ install -Dm 755 "${srcdir}/usr/bin/twingate" "${pkgdir}/usr/bin/twingate"
+ install -Dm 755 "${srcdir}/usr/bin/twingate-notifier" "${pkgdir}/usr/bin/twingate-notifier"
+ install -Dm 755 "${srcdir}/usr/bin/twingated" "${pkgdir}/usr/bin/twingated"
+}
diff --git a/twingate-bin.install b/twingate-bin.install
new file mode 100644
index 000000000000..1b346f8db13b
--- /dev/null
+++ b/twingate-bin.install
@@ -0,0 +1,88 @@
+post_install() {
+
+ SERVICE_NAME='twingate.service'
+
+ # summary of how this script can be called:
+ # <new-version>
+ # <failed-install-package> <version> `removing'
+ # <conflicting-package> <version>
+
+ if [ -d /run/systemd/system ]; then
+ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ]; then
+ if [[ "$(cat /etc/issue)" =~ ThinPro ]]; then
+ OVERRIDE_DIR="/etc/systemd/system/$SERVICE_NAME.d"
+ install -m 0755 -d "$OVERRIDE_DIR"
+ echo -e "[Service]\nStateDirectory=\nEnvironment=STATE_DIRECTORY=/writable/var/lib/twingate\n" > "$OVERRIDE_DIR/override.conf"
+ fi
+
+ systemctl --system daemon-reload >/dev/null || true
+
+ if [ -x "/usr/bin/deb-systemd-helper" ]; then
+ # This will only remove masks created by d-s-h on package removal.
+ deb-systemd-helper unmask ${SERVICE_NAME} >/dev/null || true
+ fi
+
+ # If it is clean installation
+ if [ -z "$2" ]; then
+ # Reset the enable/disable status one or more unit files, as specified on the command line,
+ # to the defaults configured in the preset policy files. This has the same effect as disable or enable,
+ # depending how the unit is listed in the preset files.
+ systemctl --no-reload preset ${SERVICE_NAME} >/dev/null || true
+ fi
+
+ # Stop and then start one or more units specified on the command line if the units are running.
+ # This does nothing if units are not running.
+ # It has to restart service after upgrade
+ systemctl try-restart ${SERVICE_NAME} &>/dev/null
+
+ # Update the statefile to add new symlinks (if any), which need to be
+ # cleaned up on purge. Also remove old symlinks.
+
+ if [ -x "/usr/bin/deb-systemd-helper" ]; then
+ # The "update-state" action is also not present in systemctl.
+ # It updates deb-systemd-helper's state file,
+ # removing obsolete entries (e.g. service files that are no longer shipped by the package)
+ # and adding new entries (e.g. new service files shipped by the package) without enabling them.
+ deb-systemd-helper update-state ${SERVICE_NAME} >/dev/null || true
+ fi
+ fi
+ fi
+}
+
+post_upgrade() {
+ post_install
+}
+
+pre_remove() {
+
+ SERIVCE_NAME='twingate.service'
+
+ if [ -d /run/systemd/system ]
+ then
+ if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
+ systemctl stop "${SERIVCE_NAME}" >/dev/null || true
+ fi
+ fi
+}
+
+post_remove() {
+ SERVICE_NAME='twingate.service'
+
+ if [ "$1" = "purge" ]; then
+ rm -rf /var/lib/twingate
+ rm -rf /etc/twingate
+ if [ -x "/usr/bin/deb-systemd-helper" ]; then
+ deb-systemd-helper purge ${SERVICE_NAME} >/dev/null || true
+ deb-systemd-helper unmask ${SERVICE_NAME} >/dev/null || true
+ fi
+ if [[ "$(cat /etc/issue)" =~ ThinPro ]]; then
+ rm -rf /writable/var/lib/twingate
+ fi
+ fi
+
+ if [ "$1" = "remove" ]; then
+ if [ -x "/usr/bin/deb-systemd-helper" ]; then
+ deb-systemd-helper mask ${SERVICE_NAME} >/dev/null || true
+ fi
+ fi
+}