-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-whatsapp.sh
69 lines (53 loc) · 2.32 KB
/
build-whatsapp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
VERSION="$(($(wget -qO- https://github.com/cycool29/whatsapp-for-linux/releases/latest | grep -m 1 -o "WhatsApp for Linux.*" | sed 's/WhatsApp for Linux //g' | head -c 2) + 1))"
echo -e "\nBuilding version: $VERSION\n"
# echo "if ('serviceWorker' in navigator) {
# caches.keys().then(function (cacheNames) {
# cacheNames.forEach(function (cacheName) {
# caches.delete(cacheName);
# });
# });
# }" >./clear-sw-cache.js
wget -qO- https://aur.archlinux.org/cgit/aur.git/plain/whatsapp-nativefier-inject.js?h=whatsapp-nativefier-arch-electron >./clear-sw-cache.js
for ARCH in armv7l arm64 x64; do
nativefier -a ${ARCH} --inject clear-sw-cache.js --browserwindow-options '{ "webPreferences": { "spellcheck": true } }' --single-instance --tray --maximize --user-agent "Mozilla/5.0 (X11; Linux ${ARCH}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" -p linux --name "WhatsApp" https://web.whatsapp.com -e "$(wget -qO- https://api.github.com/repos/electron/electron/releases/latest | jq -r '.tag_name' | sed s/v//g)"
done
for FOLDER in $(ls | grep "^WhatsApp"); do
ARCH="$(echo ${FOLDER} | sed s/.*-//g)"
if [ "${ARCH}" == armv7l ]; then
ARCH=armhf
elif [ "${ARCH}" == arm64 ]; then
ARCH=arm64
elif [ "${ARCH}" == x64 ]; then
ARCH=amd64
elif [ "${ARCH}" == ia32 ]; then
ARCH=i386
fi
mkdir -p "${FOLDER}-DEB"
cd "${FOLDER}-DEB"
mkdir -p DEBIAN usr/share/applications usr/bin opt
cp -a ../${FOLDER} ./opt/WhatsApp
echo '#!/bin/bash
/opt/WhatsApp/WhatsApp' >./usr/bin/whatsapp
chmod +x ./usr/bin/whatsapp
echo "Package: whatsapp
Name: WhatsApp
Architecture: ${ARCH}
Description: An unofficial WhatsApp client for Linux, built with nativefier.
Author: cycool29 <[email protected]>
Maintainer: cycool29 <[email protected]>
Version: ${VERSION}.0" >./DEBIAN/control
echo "[Desktop Entry]
Name=WhatsApp
Comment=An unofficial WhatsApp client for Linux, built with nativefier.
Exec=/opt/WhatsApp/WhatsApp
Icon=/opt/WhatsApp/resources/app/icon.png
Type=Application
StartupNotify=false
StartupWMClass=WhatsApp
Categories=Internet;Chat;Network
Keywords=whatsapp;
" >./usr/share/applications/whatsapp.desktop
cd ../
dpkg-deb -b ${FOLDER}-DEB whatsapp_${VERSION}.0_${ARCH}.deb
done