diff options
author | Lorenzo Nizzi | 2022-02-23 11:04:02 +0100 |
---|---|---|
committer | Lorenzo Nizzi | 2022-02-23 11:04:02 +0100 |
commit | d08a6aca973eb5d8d7d9e4ff5fe09e36061d319e (patch) | |
tree | 9d0da7aa1e37c0a922510488ca06eea336b643bf | |
download | aur-d08a6aca973eb5d8d7d9e4ff5fe09e36061d319e.tar.gz |
First upload
-rw-r--r-- | .SRCINFO | 60 | ||||
-rw-r--r-- | PKGBUILD | 30 | ||||
-rw-r--r-- | gosign.install | 125 |
3 files changed, 215 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..28074ad429d2 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,60 @@ +pkgbase = gosign + pkgdesc = Nuovo tool di firma e rinnovo online per i certificati digitali emessi da InfoCert + pkgver = 1.2.1 + pkgrel = 1 + url = https://www.firma.infocert.it + install = gosign.install + arch = x86_64 + groups = + license = CUSTOM + depends = alsa-lib + depends = atk + depends = at-spi2-atk + depends = at-spi2-core + depends = bzip2 + depends = cairo + depends = curl + depends = dbus + depends = desktop-file-utils + depends = expat + depends = freetype2 + depends = gcc-libs + depends = gdk-pixbuf2 + depends = glib2 + depends = glibc + depends = gtk3 + depends = hicolor-icon-theme + depends = hidapi + depends = kde-cli-tools + depends = libcups + depends = libnotify + depends = libusb + depends = libx11 + depends = libxcb + depends = libxcomposite + depends = libxcursor + depends = libxdamage + depends = libxext + depends = libxfixes + depends = libxi + depends = libxml2 + depends = libxrandr + depends = libxrender + depends = libxslt + depends = libxss + depends = libxtst + depends = nspr + depends = nss + depends = openssl + depends = pango + depends = pcsclite + depends = trash-cli + depends = xdg-utils + depends = zlib + optdepends = libgnome-keyring + options = !strip + options = !emptydirs + source = https://rinnovofirma.infocert.it/gosign/download/linux/latest/GoSign-Desktop-installer-linux.deb + sha512sums = 1b68948f6822458cde6a090171387b57ae28ac76a03a8b3c5c09aac8e2e883c7cbb4967ea031750c596c4a2e038ea191c70f0d488734f8452ca6a2f7eb21615c + +pkgname = gosign diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..2c2c66e03af7 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,30 @@ +# Maintainer: Lorenzo Nizzi <lorenzo.nizzi.grifi@gmail.com> +pkgname=gosign +pkgver=1.2.1 +pkgrel=1 +pkgdesc="Nuovo tool di firma e rinnovo online per i certificati digitali emessi da InfoCert" +arch=('x86_64') +url="https://www.firma.infocert.it" +license=('CUSTOM') +groups=('') +depends=('alsa-lib' 'atk' 'at-spi2-atk' 'at-spi2-core' 'bzip2' 'cairo' 'curl' 'dbus' 'desktop-file-utils' 'expat' 'freetype2' 'gcc-libs' 'gdk-pixbuf2' 'glib2' 'glibc' 'gtk3' 'hicolor-icon-theme' 'hidapi' 'kde-cli-tools' 'libcups' 'libnotify' 'libusb' 'libx11' 'libxcb' 'libxcomposite' 'libxcursor' 'libxdamage' 'libxext' 'libxfixes' 'libxi' 'libxml2' 'libxrandr' 'libxrender' 'libxslt' 'libxss' 'libxtst' 'nspr' 'nss' 'openssl' 'pango' 'pcsclite' 'trash-cli' 'xdg-utils' 'zlib') +optdepends=('libgnome-keyring') +options=('!strip' '!emptydirs') +install=${pkgname}.install +source=("https://rinnovofirma.infocert.it/gosign/download/linux/latest/GoSign-Desktop-installer-linux.deb") +sha512sums=('1b68948f6822458cde6a090171387b57ae28ac76a03a8b3c5c09aac8e2e883c7cbb4967ea031750c596c4a2e038ea191c70f0d488734f8452ca6a2f7eb21615c') + +package(){ + + # Extract package data + tar xf data.tar.xz -C "${pkgdir}" + + install -dm 755 "$pkgdir/usr"/{lib,bin,share} + install -dm 755 "$pkgdir/usr/share/applications" + install -dm 755 "$pkgdir/usr/share/pixmaps" + install -dm 755 "$pkgdir/usr/share/doc" + install -dm 755 "$pkgdir/usr" + install -D -m644 "/usr/lib/gosigndesktop/resources/app/node_modules/yargs-parser/LICENSE.txt" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + install -D -m644 "/usr/share/doc/gosigndesktop/copyright" "${pkgdir}/usr/share/licenses/${pkgname}/COPYRIGHT" + +} diff --git a/gosign.install b/gosign.install new file mode 100644 index 000000000000..ac78877912a9 --- /dev/null +++ b/gosign.install @@ -0,0 +1,125 @@ +pre_install() { + + PROCESS="/usr/lib/gosigndesktop/GoSignDesktop" + + # if active, try clean stop + if pgrep --full --exact "$PROCESS" 1>/dev/null 2>/dev/null; then + pgrep --full --exact "$PROCESS" 2>/dev/null | while IFS= read -r PROCESS_PID; do + USER_UID=$(ps -p "$PROCESS_PID" -o euid= 2>/dev/null) + if [ ! -z "$USER_UID" ]; then + # scan displays + find /tmp/.X11-unix/ -mindepth 1 -maxdepth 1 -type s 2>/dev/null | while IFS= read -r DISP; do + DISPLAY_UID=$(stat --format=%u "$DISP") + if [ "$USER_UID" -eq "$DISPLAY_UID" ]; then + DISPLAY_IDENTIFIER=$(basename "$DISP" | tr 'X' ':') + USER_NAME=$(id --user --name "$USER_UID") + # set DISPLAY and send --die command as process user + if [ ! -z "$DISPLAY_IDENTIFIER" ] && [ ! -z "$USER_NAME" ]; then + DISPLAY="$DISPLAY_IDENTIFIER" sudo --user="$USER_NAME" "$PROCESS" --die 1>/dev/null 2>/dev/null + fi + fi + done + fi + done + # wait clean stop + sleep 5 + fi + + # if survivors, kill + if pgrep --full --exact "$PROCESS" 1>/dev/null 2>/dev/null; then + pkill -SIGUSR2 --full --exact "$PROCESS" 1>/dev/null 2>/dev/null + fi + +} + +post_install() { + gtk-update-icon-cache -q -t -f usr/share/icons/hicolor + + # create HID rules + #if [ -d "/usr/lib/udev/rules.d/" ] && [ -w "/usr/lib/udev/rules.d/" ]; then + # cat << "EOF" >/usr/lib/udev/rules.d/99-hidkey.rules 2>/dev/null + # + # HID rules + # + #SUBSYSTEM=="usb", ATTRS{idVendor}=="072f", ATTRS{idProduct}=="100d", MODE="0666" + #KERNEL=="hidraw*", ATTRS{idVendor}=="072f", ATTRS{idProduct}=="100d", MODE="0666" + # + #SUBSYSTEM=="usb", ATTRS{idVendor}=="25dd", ATTRS{idProduct}=="23b4", MODE="0666" + #KERNEL=="hidraw*", ATTRS{idVendor}=="25dd", ATTRS{idProduct}=="23b4", MODE="0666" + # + #"EOF" + #fi + + # retrieve HOMEs base directory from defaults and copy config files and license + HOME_BASE=$(useradd -D | grep '^HOME=' | cut -d= -f2) + if [ -d "$HOME_BASE" ]; then + find "$HOME_BASE" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | while IFS= read -r USER_HOME; do + OLD_PROG_DIR="$USER_HOME/.dike" + NEW_PROG_DIR="$USER_HOME/.gosign" + if [ ! -e "$NEW_PROG_DIR" ] && [ -d "$OLD_PROG_DIR" ]; then + OLD_PROG_DIR_UID=$(stat --format=%u "$OLD_PROG_DIR") + OLD_PROG_DIR_GID=$(stat --format=%g "$OLD_PROG_DIR") + OLD_PROG_DIR_PERM=$(stat --format=%a "$OLD_PROG_DIR") + install --directory --owner="$OLD_PROG_DIR_UID" --group="$OLD_PROG_DIR_GID" --mode="$OLD_PROG_DIR_PERM" "$NEW_PROG_DIR" 1>/dev/null 2>/dev/null + if [ -d "$NEW_PROG_DIR" ]; then + [ -f "$OLD_PROG_DIR/dike.conf" ] && cp -p "$OLD_PROG_DIR/dike.conf" "$NEW_PROG_DIR" 1>/dev/null 2>/dev/null + [ -f "$OLD_PROG_DIR/dike-r.conf" ] && cp -p "$OLD_PROG_DIR/dike-r.conf" "$NEW_PROG_DIR" 1>/dev/null 2>/dev/null + [ -f "$OLD_PROG_DIR/license" ] && cp -p "$OLD_PROG_DIR/license" "$NEW_PROG_DIR" 1>/dev/null 2>/dev/null + fi + fi + done + fi + + update-desktop-database -q +} + +pre_upgrade() { + pre_install +} + +post_upgrade() { + post_install +} + +pre_remove() { + + PROCESS="/usr/lib/gosigndesktop/GoSignDesktop" + + # if active, try clean stop + if pgrep --full --exact "$PROCESS" 1>/dev/null 2>/dev/null; then + pgrep --full --exact "$PROCESS" 2>/dev/null | while IFS= read -r PROCESS_PID; do + USER_UID=$(ps -p "$PROCESS_PID" -o euid= 2>/dev/null) + if [ ! -z "$USER_UID" ]; then + # scan displays + find /tmp/.X11-unix/ -mindepth 1 -maxdepth 1 -type s 2>/dev/null | while IFS= read -r DISP; do + DISPLAY_UID=$(stat --format=%u "$DISP") + if [ "$USER_UID" -eq "$DISPLAY_UID" ]; then + DISPLAY_IDENTIFIER=$(basename "$DISP" | tr 'X' ':') + USER_NAME=$(id --user --name "$USER_UID") + # set DISPLAY and send --die command as process user + if [ ! -z "$DISPLAY_IDENTIFIER" ] && [ ! -z "$USER_NAME" ]; then + DISPLAY="$DISPLAY_IDENTIFIER" sudo --user="$USER_NAME" "$PROCESS" --die 1>/dev/null 2>/dev/null + fi + fi + done + fi + done + # wait clean stop + sleep 5 + fi + + # if survivors, kill + if pgrep --full --exact "$PROCESS" 1>/dev/null 2>/dev/null; then + pkill -SIGUSR2 --full --exact "$PROCESS" 1>/dev/null 2>/dev/null + fi + +} + +post_remove() { + gtk-update-icon-cache -q -t -f usr/share/icons/hicolor + + # remove HID rules + rm -f "/usr/lib/udev/rules.d/99-hidkey.rules" 1>/dev/null 2>/dev/null + + update-desktop-database -q +} |