diff options
author | Douglas Iuri Medeiros Cabral | 2022-11-12 11:42:24 -0300 |
---|---|---|
committer | Douglas Iuri Medeiros Cabral | 2022-11-12 11:42:24 -0300 |
commit | 94595fa6a614294cb816b64036767ed4c49183a7 (patch) | |
tree | d256cf4008f9fff5d6169e876f969d1c8f9e6f95 | |
parent | 16cb932027e0e53360cbe6601e5e4052eb69a680 (diff) | |
download | aur-94595fa6a614294cb816b64036767ed4c49183a7.tar.gz |
Added systemd to depends and improves the install script
-rw-r--r-- | .SRCINFO | 5 | ||||
-rw-r--r-- | PKGBUILD | 14 | ||||
-rw-r--r-- | forticlient-vpn.changelog | 6 | ||||
-rw-r--r-- | forticlient-vpn.install | 159 |
4 files changed, 121 insertions, 63 deletions
@@ -1,11 +1,12 @@ pkgbase = forticlient-vpn - pkgdesc = Build through the official package of FortiClient VPN + pkgdesc = Build through the official package of FortiClient VPN only pkgver = 7.0.0.0018 - pkgrel = 1 + pkgrel = 2 url = https://www.fortinet.com/support/product-downloads install = forticlient-vpn.install arch = x86_64 license = custom:fortinet + depends = systemd depends = nss depends = gtk3 depends = libxss @@ -1,12 +1,12 @@ # Maintainer: Douglas Iuri Medeiros Cabral <douglasimcabral at zohomail dot com> pkgname=forticlient-vpn pkgver=7.0.0.0018 -pkgrel=1 -pkgdesc="Build through the official package of FortiClient VPN" +pkgrel=2 +pkgdesc="Build through the official package of FortiClient VPN only" arch=("x86_64") url="https://www.fortinet.com/support/product-downloads" license=('custom:fortinet') -depends=('nss' 'gtk3' 'libxss' 'polkit' 'openssl' 'libnotify' 'org.freedesktop.secrets' 'libappindicator-gtk2') +depends=('systemd' 'nss' 'gtk3' 'libxss' 'polkit' 'openssl' 'libnotify' 'org.freedesktop.secrets' 'libappindicator-gtk2') optdepends=( 'mate-polkit: for polkit authentication for the MATE' 'polkit-gnome: for polkit authentication for the GNOME' @@ -32,15 +32,9 @@ package() { # Install license install -Dm 644 "${pkgdir}/usr/share/doc/forticlient/copyright" "${pkgdir}/usr/share/licenses/fortinet/LICENSE" - # Symbolic binaries which are located in /opt + # Symbolic link to fortivpn CLI mkdir -p ${pkgdir}/usr/bin ln -sf '/opt/forticlient/fortivpn' "${pkgdir}/usr/bin/fortivpn" - ln -sf '/opt/forticlient/gui/FortiClient-linux-x64/FortiClient' "${pkgdir}/usr/bin/forticlient" - - # Symbolic launchers - mkdir -p ${pkgdir}/etc/xdg/autostart - ln -sf '/opt/forticlient/Fortitray.desktop' "${pkgdir}/etc/xdg/autostart/Fortitray.desktop" - ln -sf '/opt/forticlient/Fortivpn.desktop' "${pkgdir}/etc/xdg/autostart/Fortivpn.desktop" } diff --git a/forticlient-vpn.changelog b/forticlient-vpn.changelog index 1e100f12badf..42e41124cfb0 100644 --- a/forticlient-vpn.changelog +++ b/forticlient-vpn.changelog @@ -1,3 +1,9 @@ +## forticlient-vpn - 7.0.0.0018 - 2022-11-12 +* forticlient-vpn - 7.0.0.0018 - `release 2` + + update install scripts + + added the term 'only' to `pkgdesc` + + added systemd to `depends` + ## forticlient-vpn - 7.0.0.0018 - 2021-06-13 * forticlient-vpn - 7.0.0.0018 - `release 1` + libappindicator-gtk2 moved to `depends` diff --git a/forticlient-vpn.install b/forticlient-vpn.install index 567b72391f52..20b7504c58d6 100644 --- a/forticlient-vpn.install +++ b/forticlient-vpn.install @@ -27,83 +27,110 @@ pre_install () { } pre_upgrade () { -# Remove old symlink when upgrading from older versions -if [ -f /usr/bin/FortiClient ]; then - pkill -f /usr/bin/FortiClient - rm -rf /usr/bin/FortiClient -fi + # Check if forticlient is registered to EMS if it's an uninstall + if [ -f /opt/forticlient/.fct_ec_registered ]; then + echo "Error: Unable to uninstall forticlient while connected to EMS" + exit 1 + fi + + # Remove old symlink when upgrading from older versions + if [ -f /usr/bin/FortiClient ]; then + pkill -f /usr/bin/FortiClient + rm -rf /usr/bin/FortiClient + fi } post_install() { # Remove older version directories and files when upgrading if [ -d /usr/bin/forticlient ]; then - pkill -f /usr/bin/forticlient - rm -rf /usr/bin/forticlient + pkill -f /usr/bin/forticlient + rm -rf /usr/bin/forticlient fi # Remove old configuration files when upgrading from older versions if [ -f /etc/forticlient/config.xml ]; then - rm -rf /etc/forticlient/config.xml + rm -rf /etc/forticlient/config.xml fi if [ -f /etc/forticlient/config_backup.xml ]; then - rm -rf /etc/forticlient/config_backup.xml + rm -rf /etc/forticlient/config_backup.xml fi # Remove old pid lock if [ -f /tmp/.forticlient/fortivpn.pid ]; then - rm -rf /tmp/.forticlient/fortivpn.pid + rm -rf /tmp/.forticlient/fortivpn.pid + fi + + if [ -f /opt/forticlient/Fortitray.desktop ]; then + ln -sf /opt/forticlient/Fortitray.desktop /etc/xdg/autostart/Fortitray.desktop + fi + + if [ -f /opt/forticlient/Fortivpn.desktop ]; then + ln -sf /opt/forticlient/Fortivpn.desktop /etc/xdg/autostart/Fortivpn.desktop + fi + + # Restore permissions to all files + if [ -f /opt/forticlient/.repackaged ] && [ -f /opt/forticlient/.acl ]; then + ( + cd / + setfacl --restore /opt/forticlient/.acl + ) fi if [ -f /etc/forticlient/servers.conf ]; then - chmod 600 /etc/forticlient/servers.conf + chmod 600 /etc/forticlient/servers.conf fi # Create GUI symlink to launch from terminal if [ -f /opt/forticlient/gui/FortiClient-linux-x64/FortiClient ]; then - ln -sf /opt/forticlient/gui/FortiClient-linux-x64/FortiClient /usr/bin/forticlient + ln -sf /opt/forticlient/gui/FortiClient-linux-x64/FortiClient /usr/bin/forticlient fi # Launch fortitray if [ -f /opt/forticlient/fortitraylauncher ]; then - if [ ! -z "$(logname 2>/dev/null)" ]; then - user="$(logname 2>/dev/null)" - elif [ ! -z "$SUDO_USER" ]; then - user="$SUDO_USER" - else - user=$(users 2>/dev/null | cut -d ' ' -f1) - fi - - # Need to find the user DBUS address, otherwise Fortitray icon won't show - DBUS_SESSION_BUS_ADDRESS=$(ps -u $(id -u $user) -o pid= | xargs -I{} cat /proc/{}/environ 2>/dev/null | tr '\0' '\n' 2>/dev/null | grep -m1 '^DBUS_SESSION_BUS_ADDRESS=') - DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS#*=} - - # XAUTHORITY and DISPLAY needed by Fortitray to run - XAUTHORITY=$(ps -u $(id -u $user) -o pid= | xargs -I{} cat /proc/{}/environ 2>/dev/null | tr '\0' '\n' 2>/dev/null | grep -m1 '^XAUTHORITY=') - XAUTHORITY=${XAUTHORITY#*=} - - DISPLAY=$(ps -u $(id -u $user) -o pid= | xargs -I{} cat /proc/{}/environ 2>/dev/null | tr '\0' '\n' 2>/dev/null | grep -m1 '^DISPLAY=') - DISPLAY=${DISPLAY#*=} - - XDG_RUNTIME_DIR=$(ps -u $(id -u $user) -o pid= | xargs -I{} cat /proc/{}/environ 2>/dev/null | tr '\0' '\n' 2>/dev/null | grep -m1 '^XDG_RUNTIME_DIR=') - XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR#*=} - - # Start fortitraylauncher while forwarding environment variables needed by Fortitray - su ${user} -c "env XAUTHORITY=$XAUTHORITY \ - DISPLAY=$DISPLAY \ - DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS \ - XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \ - setsid /opt/forticlient/fortitraylauncher &>/dev/null &" - fi - + if [ ! -z "$(logname 2>/dev/null)" ]; then + user="$(logname 2>/dev/null)" + elif [ ! -z "$SUDO_USER" ]; then + user="$SUDO_USER" + else + user=$(users 2>/dev/null | cut -d ' ' -f1) + fi + + # Need to find the user DBUS address, otherwise Fortitray icon won't show + DBUS_SESSION_BUS_ADDRESS=$(ps -u $(id -u $user) -o pid= | xargs -I{} cat /proc/{}/environ 2>/dev/null | tr '\0' '\n' 2>/dev/null | grep -m1 '^DBUS_SESSION_BUS_ADDRESS=') + DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS#*=} + + # XAUTHORITY and DISPLAY needed by Fortitray to run + XAUTHORITY=$(ps -u $(id -u $user) -o pid= | xargs -I{} cat /proc/{}/environ 2>/dev/null | tr '\0' '\n' 2>/dev/null | grep -m1 '^XAUTHORITY=') + XAUTHORITY=${XAUTHORITY#*=} + + DISPLAY=$(ps -u $(id -u $user) -o pid= | xargs -I{} cat /proc/{}/environ 2>/dev/null | tr '\0' '\n' 2>/dev/null | grep -m1 '^DISPLAY=') + DISPLAY=${DISPLAY#*=} + + XDG_RUNTIME_DIR=$(ps -u $(id -u $user) -o pid= | xargs -I{} cat /proc/{}/environ 2>/dev/null | tr '\0' '\n' 2>/dev/null | grep -m1 '^XDG_RUNTIME_DIR=') + XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR#*=} + + # Start fortitraylauncher while forwarding environment variables needed by Fortitray + su ${user} -c "env XAUTHORITY=$XAUTHORITY \ + DISPLAY=$DISPLAY \ + DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS \ + XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \ + setsid /opt/forticlient/fortitraylauncher &>/dev/null &" + fi + # Update icons cache so icon will show correctly if [ -f /usr/share/icons/hicolor/48x48/apps/forticlient.png ]; then - gtk-update-icon-cache -f /usr/share/icons/hicolor || true + gtk-update-icon-cache -f /usr/share/icons/hicolor || true fi - + # Setup forticlient protocol handler if [ -f /usr/share/applications/forticlient-register.desktop ]; then - update-desktop-database + update-desktop-database + fi + + # Stop reload daemons + if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload > /dev/null || true fi } @@ -116,12 +143,6 @@ EOF } pre_remove() { - # Check if forticlient is registered to EMS if it's an uninstall - if [ -f /opt/forticlient/.fct_ec_registered ] && [ "$action" != "upgrade" ]; then - echo "Error: Unable to uninstall forticlient while connected to EMS" - exit 1 - fi - # Stop fortitray if [ -f /tmp/.forticlient/fortitraylauncher ]; then echo "terminate" > /tmp/.forticlient/fortitraylauncher || true @@ -138,14 +159,50 @@ pre_remove() { done fi + # Stop forticlient service + if [ -d /run/systemd/system ]; then + systemctl stop forticlient-scheduler.service + fi + pkill -f /opt/forticlient exit 0 } post_remove() { + # Stop reload daemons + if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload > /dev/null || true + fi + # Remove shared memory rm -rf /var/run/fctc.s || true + # Remove Fortitray.desktop symlink + rm -rf /etc/xdg/autostart/Fortitray.desktop || true + # Remove fortitraylauncher fifo rm -rf /tmp/.forticlient/fortitraylauncher || true + + # Remove VPN autostart launcher symlink + rm -rf /etc/xdg/autostart/Fortivpn.desktop || true + + # Remove GUI symlink + rm -rf /usr/bin/forticlient || true + + # Remove fortivpn symlink + rm -rf /usr/bin/forticlient || true + + # Remove FortiClient scheduler + rm -rf /lib/systemd/system/forticlient-scheduler.service || true + + # Remove FortiClient binaries + rm -rf /opt/forticlient || true + + # Remove fortitray policy + rm -rf /usr/share/polkit-1/actions/org.fortinet.fortitray.policy || true + + # Remove forticlient policy + rm -rf /usr/share/polkit-1/actions/org.fortinet.forticlient.policy || true + + exit 0 } |