diff options
author | RimuruW | 2021-08-24 01:23:22 +0800 |
---|---|---|
committer | RimuruW | 2021-08-24 01:23:22 +0800 |
commit | 1a8c8a84bb750ce7ad28a3273f8af039476617ac (patch) | |
tree | 4756836ad53542fc70f5a88e31aeecb29e1069bc | |
download | aur-1a8c8a84bb750ce7ad28a3273f8af039476617ac.tar.gz |
Test build
(Because of upstream's issue,
build process will get error)
-rw-r--r-- | .SRCINFO | 17 | ||||
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | PKGBUILD | 72 |
3 files changed, 95 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..564419a93b38 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,17 @@ +pkgbase = switchhosts + pkgdesc = An App for hosts management & switching. + pkgver = 4.0.3 + pkgrel = 1 + url = https://github.com/oldj/SwitchHosts + arch = any + license = Apache + makedepends = nodejs + makedepends = electron + makedepends = npm + provides = switchhosts + conflicts = switchhosts-bin + conflicts = switchhosts-appimage + source = switchhosts-4.0.3.tar.gz::https://github.com/oldj/SwitchHosts/archive/v4.0.3/SwitchHosts-v4.0.3.tar.gz + sha256sums = 4a3ad76fa95103c4ba041a6220987d658fc57cb697cbbd0bdd43a66cd1b7cbff + +pkgname = switchhosts diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..bad3abafa235 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*/*.tar +*/*.gz +*/*.part +*/pkg +*/src +*/*.pkg.* diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..550d1f547b82 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,72 @@ +# Maintainer: Qingxu <me@linioi.com> +pkgname=switchhosts +pkgver=4.0.3 +_subpkgver=6070 +pkgrel=1 +pkgdesc="An App for hosts management & switching." +arch=( + 'any' +) +url="https://github.com/oldj/SwitchHosts" +license=('Apache') +provides=('switchhosts') +conflicts=( + 'switchhosts-bin' + 'switchhosts-appimage' +) +makedepends=( + 'nodejs' + 'electron' + 'npm' +) +source=( + "${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}/SwitchHosts-v${pkgver}.tar.gz" +) +sha256sums=( + '4a3ad76fa95103c4ba041a6220987d658fc57cb697cbbd0bdd43a66cd1b7cbff' +) + +prepare() { + cd SwitchHosts-${pkgver} + sed -i "/mirror:/d" scripts/make.js + # use system electron version + # see: https://wiki.archlinux.org/index.php/Electron_package_guidelines + #electronDist=$(dirname $(realpath $(which electron13))) + #electronVer=$(electron13 --version | tail -c +2) + #sed -i "/electronDownload/,/}/d" scripts/make.js + #sed -i "/directories/i\ electronVersion: \`$electronVer\`," scripts/make.js + #sed -i "/directories/i\ electronDist: \`/usr/lib/electron\`," scripts/make.js + # Set arch and target + local i686=ia32 x86_64=x64 armv7h=armv7l aarch64=arm64 + sed -i "s/.*AppImage:x64.*$/ linux: ['pacman:build_arch'],/" scripts/make.js + sed -i "s#build_arch#${!CARCH}#g" scripts/make.js + sed -i "/await makeMacArm/d" scripts/make.js + sed -i "/win: \[/d" scripts/make.js + sed -i "/mac: \[/d" scripts/make.js +} + +build() { + cd SwitchHosts-${pkgver} + npm install + npm run build + npm run make +} + +package() { + cd ${srcdir} + tar -xvf SwitchHosts-${pkgver}/dist/SwitchHosts_linux_${pkgver}\(${_subpkgver}\).pacman -C ${pkgdir} + rm -f ${pkgdir}/.PKGINFO ${pkgdir}/.MTREE ${pkgdir}/.INSTALL +} + +post_install() { + # Link to the binary + ln -sf '/opt/SwitchHosts/switchhosts' '/usr/bin/switchhosts' + # SUID chrome-sandbox for Electron 5+ + chmod 4755 '/opt/SwitchHosts/chrome-sandbox' || true + update-mime-database /usr/share/mime || true + update-desktop-database /usr/share/applications || true +} + +post_remove() { + rm -f '/usr/bin/switchhosts' +} |