feat: replace the dangerous install script and update

This commit is contained in:
otaj 2025-09-07 17:05:40 +02:00
parent cafd6cd800
commit 1a1bf09355
3 changed files with 43 additions and 132 deletions

View file

@ -1,20 +1,21 @@
pkgbase = surfshark-client
pkgdesc = Surfshark VPN GUI client for Linux. Encrypt your internet activity so no one can track or steal your data. Increase your privacy and avoid tracking by using a different IP address. Keep your digital freedom and security while using unprotected networks.
pkgver = 3.5.3.6162
pkgdesc = Official Surfshark VPN client
pkgver = 3.5.4
pkgrel = 1
url = https://surfshark.com
install = surfshark-client.install
arch = x86_64
license = custom:surfshark
depends = alsa-lib
depends = at-spi2-core
depends = gjs
depends = nss
depends = org.freedesktop.secrets
depends = wireguard-tools
depends = networkmanager
depends = networkmanager-openvpn
optdepends = libappindicator-gtk3: for tray icon
optdepends = org.freedesktop.secrets: password storage backend
optdepends = emoji-font: emoji support
options = !strip
options = !emptydirs
source = https://ocean.surfshark.com/debian/pool/main/s/surfshark_3.5.3_amd64.deb
sha512sums = 06a05ab7281ed7bb736aeb24e1d46ac083e854cbe2ef3f68cdd6085d7f27d32b4399565253f37640650d2e40e18dd8cdcf4006685e382133d75f44d969cdf849
source = https://ocean.surfshark.com/debian/pool/main/s/surfshark_3.5.4_amd64.deb
sha512sums = e51bd526e61aa14bbe2b5a8436f34352e87f00bbfc4913ba29029ca8c1de81bfd3d7667d7787b5b91cd995e4efd92bca80bd8ed6af5930aa5ae58fd63c38a82f
pkgname = surfshark-client

View file

@ -1,23 +1,47 @@
# Maintainer: Liam Doan <not.lamdn@gmail.com>
pkgname=surfshark-client
pkgver=3.5.3.6162
pkgver=3.5.4
pkgrel=1
pkgdesc="Surfshark VPN GUI client for Linux. Encrypt your internet activity so no one can track or steal your data. Increase your privacy and avoid tracking by using a different IP address. Keep your digital freedom and security while using unprotected networks."
pkgdesc="Official Surfshark VPN client"
arch=('x86_64')
url="https://surfshark.com"
license=('custom:surfshark')
depends=('alsa-lib' 'at-spi2-core' 'gjs' 'nss' 'org.freedesktop.secrets' 'wireguard-tools')
depends=(
'gjs'
'nss'
'networkmanager'
'networkmanager-openvpn'
)
optdepends=(
'libappindicator-gtk3: for tray icon'
'org.freedesktop.secrets: password storage backend'
'emoji-font: emoji support'
)
options=('!strip' '!emptydirs')
install=${pkgname}.install
source=("https://ocean.surfshark.com/debian/pool/main/s/surfshark_3.5.3_amd64.deb")
sha512sums=('06a05ab7281ed7bb736aeb24e1d46ac083e854cbe2ef3f68cdd6085d7f27d32b4399565253f37640650d2e40e18dd8cdcf4006685e382133d75f44d969cdf849')
source=("https://ocean.surfshark.com/debian/pool/main/s/surfshark_${pkgver}_amd64.deb")
sha512sums=('e51bd526e61aa14bbe2b5a8436f34352e87f00bbfc4913ba29029ca8c1de81bfd3d7667d7787b5b91cd995e4efd92bca80bd8ed6af5930aa5ae58fd63c38a82f')
prepare() {
tar xf data.tar.xz
}
package(){
mv usr/ opt/ "${pkgdir}"
# Extract package data
tar -xJ -f data.tar.xz -C "${pkgdir}"
# Install License file
install -D -m644 "${pkgdir}/opt/Surfshark/resources/dist/resources/surfsharkd.js.LICENSE.txt" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
# Create link for surfshark executable in /bin
mkdir -p "${pkgdir}/usr/bin" && ln -sf "${pkgdir}/opt/Surfshark/surfshark" "${pkgdir}/usr/bin/surfshark"
# SUID chrome-sandbox for Electron 5+
chmod 4755 "${pkgdir}/opt/Surfshark/chrome-sandbox" || true
# Assign correct permissions for systemctl to run surfsharkd service as user
# Please note that surfsharkd2 systemd service is run as system user and only
# root user executable permission needs to be set
chmod 755 "${pkgdir}/opt/Surfshark/resources/dist/resources/surfsharkd.js" || true
chmod 744 "${pkgdir}/opt/Surfshark/resources/dist/resources/surfsharkd2.js" || true
}

View file

@ -1,123 +1,9 @@
post_install() {
gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
PATH="/sbin:/usr/sbin:/bin:/usr/bin"
ln -sf '/opt/Surfshark/surfshark' '/usr/bin/surfshark'
chmod 4755 '/opt/Surfshark/chrome-sandbox' || true
update-mime-database /usr/share/mime || true
update-desktop-database /usr/share/applications || true
mkdir -p /usr/lib/systemd/user || true
echo "
[Unit]
Description=Surfshark Daemon
[Service]
ExecStart=/opt/Surfshark/resources/dist/resources/surfsharkd.js
Restart=on-failure
RestartSec=5
IPAddressDeny=any
RestrictRealtime=true
ProtectKernelTunables=true
ProtectSystem=full
RestrictSUIDSGID=true
[Install]
WantedBy=default.target
" > /usr/lib/systemd/user/surfsharkd.service || true
mkdir -p /usr/lib/systemd/system || true
echo "
[Unit]
Description=Surfshark Daemon2
[Service]
ExecStart=/opt/Surfshark/resources/dist/resources/surfsharkd2.js
Restart=on-failure
RestartSec=5
IPAddressDeny=any
RestrictRealtime=true
ProtectKernelTunables=true
ProtectSystem=full
RestrictSUIDSGID=true
[Install]
WantedBy=default.target
" > /usr/lib/systemd/system/surfsharkd2.service || true
chmod 644 /usr/lib/systemd/user/surfsharkd.service || true
chmod 644 /usr/lib/systemd/system/surfsharkd2.service || true
chmod 755 '/opt/Surfshark/resources/dist/resources/surfsharkd.js' || true
chmod 755 '/opt/Surfshark/resources/dist/resources/surfsharkd2.js' || true
chmod 755 '/opt/Surfshark/resources/dist/resources/update' || true
chmod 755 '/opt/Surfshark/resources/dist/resources/diagnostics' || true
chmod 755 '/etc/init.d/surfshark' || true
chmod 755 '/etc/init.d/surfshark2' || true
case "$(ps -p 1 --no-headers -o '%c' | tr -d '\n')" in
systemd)
systemctl daemon-reload || true
systemctl enable --global surfsharkd.service || true
;;
init)
update-rc.d surfshark defaults || true
update-rc.d surfshark2 defaults || true
/etc/init.d/surfshark restart || true
/etc/init.d/surfshark2 restart || true
;;
*)
echo "Unsupported service manager"
;;
esac
update-desktop-database -q
echo -e " sudo systemctl daemon-reload"
echo -e " sudo systemctl enable surfsharkd2.service && sudo systemctl start surfsharkd2.service\n"
}
post_upgrade() {
post_install
}
post_remove() {
gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
PATH="/sbin:/usr/sbin:/bin:/usr/bin"
systemctl disable --global surfsharkd.service || true
systemctl disable surfsharkd2.service || true
systemctl stop surfsharkd2.service || true
/etc/init.d/surfshark stop || true
/etc/init.d/surfshark2 stop || true
kill -15 $(pidof surfshark) || :
kill -15 $(pgrep surfsharkd) || :
rm -rf /run/surfshark || :
rm -f /tmp/surfsharkd.sock || :
rm -f /tmp/surfshark-electron.sock || :
rm -f $XDG_RUNTIME_DIR/surfsharkd.sock || :
rm -f $XDG_RUNTIME_DIR/surfshark-electron.sock || :
rm -f '/usr/bin/surfshark' || :
# Surfshark post-remove
nmcli connection delete surfshark_ipv6 || true
nmcli connection delete surfshark_wg || true
nmcli connection delete surfshark_openvpn || true
shopt -s globstar
if [ "$1" = purge ]; then
rm -rf /home/**/.config/Surfshark || true
fi
rm -rf /home/**/.cache/Surfshark || true
iptables -S | grep surfshark_ks | sed -r '/.*comment.*surfshark_ks*/s/-A/iptables -D/e' || true
ip6tables -S | grep surfshark_ks | sed -r '/.*comment.*surfshark_ks*/s/-A/ip6tables -D/e' || true
update-desktop-database -q
}