diff options
author | Sukanka | 2022-02-27 01:03:51 +0800 |
---|---|---|
committer | Sukanka | 2022-02-27 01:03:51 +0800 |
commit | 92aac72d159c0b5875d1501a950d990f391f2bd3 (patch) | |
tree | 658ce72ffb0d87719f8c1e426dda064f599f7544 | |
download | aur-92aac72d159c0b5875d1501a950d990f391f2bd3.tar.gz |
first push
-rw-r--r-- | .SRCINFO | 28 | ||||
-rw-r--r-- | PKGBUILD | 74 | ||||
-rw-r--r-- | cfw | 3 | ||||
-rw-r--r-- | clash-core-service@.service | 13 | ||||
-rw-r--r-- | clash-for-windows-bin.install | 11 | ||||
-rw-r--r-- | clash-for-windows.desktop | 10 |
6 files changed, 139 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..afd673995bf1 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,28 @@ +pkgbase = clash-for-windows-electron-bin + pkgdesc = A Windows/macOS/Linux GUI based on Clash and Electron. Using system clash and electron + pkgver = 0.19.10 + pkgrel = 1 + url = https://github.com/Fndroid/clash_for_windows_pkg + install = clash-for-windows-bin.install + arch = x86_64 + license = unknown + depends = electron + depends = clash + depends = clash-geoip + optdepends = nftables: TUN mode required. + optdepends = iproute2: TUN mode required. + optdepends = clash-premium-tun: TUN mode required + provides = clash-for-windows + provides = clash-for-windows-electron + conflicts = clash-for-windows + conflicts = clash-for-windows-bin + source = clash-for-windows-electron-bin-0.19.10-x86_64-linux.tar.gz::https://github.com/Fndroid/clash_for_windows_pkg/releases/download/0.19.10/Clash.for.Windows-0.19.10-x64-linux.tar.gz + source = clash-for-windows.desktop + source = cfw + source = clash-core-service@.service + sha256sums = 90d8ae93b73b970cb1901c1212ec9c0142d504135a6bb07bf1600cc00b8d3221 + sha256sums = 340ee7a8c8e7da27eca9891dbc6997e7b2d87607947e8010903fb79d1fbb9da6 + sha256sums = db2e160e5d5cf82ed69d0926ac51c0eccb9efc541f89be3bb467d85be509f735 + sha256sums = 98c0b73fb879941364e3f6b1b45d0c504c91f07280a4801db908312cea84f32d + +pkgname = clash-for-windows-electron-bin diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..140cba49e0af --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,74 @@ +# Maintainer: sukanka <su975853527 [AT] gmail.com> +pkgname=clash-for-windows-electron-bin +_pkgname=${pkgname%-bin} +pkgver=0.19.10 +pkgrel=1 +pkgdesc="A Windows/macOS/Linux GUI based on Clash and Electron. Using system clash and electron" +arch=("x86_64") +parch=$(echo ${arch} | sed "s/x86_64/x64/") +license=('unknown') +url="https://github.com/Fndroid/clash_for_windows_pkg" +install=clash-for-windows-bin.install + +provides=('clash-for-windows' ${_pkgname}) +conflicts=('clash-for-windows' 'clash-for-windows-bin') + +depends=('electron' +'clash' +'clash-geoip' +) + +optdepends=( + 'nftables: TUN mode required.' + 'iproute2: TUN mode required.' + 'clash-premium-tun: TUN mode required' +) + +source=( + "${pkgname}-${pkgver}-${arch}-linux.tar.gz::${url}/releases/download/${pkgver}/Clash.for.Windows-${pkgver}-${parch}-linux.tar.gz" + "clash-for-windows.desktop" + "cfw" + "clash-core-service@.service" + ) +sha256sums=('90d8ae93b73b970cb1901c1212ec9c0142d504135a6bb07bf1600cc00b8d3221' + '340ee7a8c8e7da27eca9891dbc6997e7b2d87607947e8010903fb79d1fbb9da6' + 'db2e160e5d5cf82ed69d0926ac51c0eccb9efc541f89be3bb467d85be509f735' + '98c0b73fb879941364e3f6b1b45d0c504c91f07280a4801db908312cea84f32d') + +build() { + cd $srcdir + sed -i "s/pkgver/${pkgver}/" clash-for-windows.desktop + + cd "Clash for Windows-${pkgver}-${parch}-linux"/resources/ + asar e app.asar apps + + # fix for autostart and system electron + cd apps + sed -i 's|r=n\[1\],|r="cfw\\nIcon=clash\\n",|g' dist/electron/renderer.js + sed -i 's|"electron-log": "^4.1.0",|"electron-log": "^4.4.6",|g' package.json + + npm install + cd .. + asar p apps app.asar +} + +package() { + cd $srcdir + + install -Dm755 cfw -t ${pkgdir}/usr/bin + install -Dm644 "clash-for-windows.desktop" -t ${pkgdir}/usr/share/applications + install -Dm644 "clash-core-service@.service" -t ${pkgdir}/usr/lib/systemd/system/ + + cd "Clash for Windows-${pkgver}-${parch}-linux" + install -Dm644 resources/app.asar -t ${pkgdir}/opt/clash-for-windows/ + + cp -pvr resources/static ${pkgdir}/opt/clash-for-windows/ + + cd resources/apps/dist/electron/static/imgs + install -Dm644 logo.png ${pkgdir}/usr/share/icons/hicolor/512x512/apps/clash.png + + cd ${pkgdir}/opt/clash-for-windows/static/files + rm -rf linux/{common,x64/clash-linux} default/Country.mmdb + ln -s /usr/bin/clash linux/x64/clash-linux + ln -s /etc/clash/Country.mmdb default/Country.mmdb +} @@ -0,0 +1,3 @@ +#!/bin/sh +cd /opt/clash-for-windows +electron app.asar "$@" diff --git a/clash-core-service@.service b/clash-core-service@.service new file mode 100644 index 000000000000..12744a93e888 --- /dev/null +++ b/clash-core-service@.service @@ -0,0 +1,13 @@ +[Unit] +Description=Clash core service created by Clash for Windows for normal user. +After=network-online.target nftables.service iptabels.service + +[Service] +Type=simple +ExecStartPre=+/usr/share/clash/setup-cgroup.sh +ExecStart=/usr/bin/bypass-proxy /home/%i/.config/clash/service/clash-core-service +Restart=always +RestartSec=5 + +[Install] +WantedBy=multi-user.target diff --git a/clash-for-windows-bin.install b/clash-for-windows-bin.install new file mode 100644 index 000000000000..02151974ea63 --- /dev/null +++ b/clash-for-windows-bin.install @@ -0,0 +1,11 @@ +post_install() { + echo 'Clash for Windows has it own built-in autostart since 0.18.1.' + echo 'Enable it will create .desktop file under $HOME/.config/autostart/' + echo -e "\033[32m To use the TUN mode, you need to run \033[0m" + echo -e "\033[32m sudo systemctl start clash-core-service@\$USER \033[0m" + echo -e "\033[32m sudo systemctl enable clash-core-service@\$USER \033[0m" + echo -e "\033[32m and change tun.dns-hijack to 198.18.0.2:53 \033[0m" +} +post_upgrade(){ + post_install +} diff --git a/clash-for-windows.desktop b/clash-for-windows.desktop new file mode 100644 index 000000000000..09a9c60fb695 --- /dev/null +++ b/clash-for-windows.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Application +Version=pkgver +Name=Clash For Windows +Comment=Clash GUI +Exec=cfw +Icon=clash.png +Terminal=false +Keywords=clash +Categories=Network;Utility; |