Username: Password: Remember me
#Note: this PKGBUILD is made to always install the latest version of whale
 
pkgname=naver-whale
pkgver=1.6.81.13
pkgrel=1
pkgdesc="The web browser from NAVER (stable version)"
arch=('x86_64')
url="https://whale.naver.com/en/"
screenshot="https://i.imgur.com/0pMAnPh.png"
license=('custom:whale')
depends=('alsa-lib' 'ttf-liberation' 'libcups' 'libxss' 'libxtst' 'nss' 'kdialog' 'kwallet' 'plasma-browser-integration' 'gtk3' 'curl' 'sed' 'grep' 'coreutils')
# kdialog: to have kde dialogs
# plasma-browser-integration: for https://chrome.google.com/webstore/detail/plasma-integration/cimiefiiaegbelhefglklhhakcgmhkai
# kwallet: to use kwallet instead of gnome-keyring.
# grep,sed,curl,coreutils,ping: for update checking see launch script below(should be already installed on any system)!
makedepends=('binutils')
options=('!emptydirs' '!strip')
source=("http://update.whale.naver.net/downloads/installers/naver-whale-stable_amd64.deb")
md5sums=('SKIP')
conflicts=("${pkgname}" "${pkgname}-stable" "${pkgname}-beta" "${pkgname}-unstable")
provides=("${pkgname}")
 
pkgver() {
  cd $srcdir
  ar p naver-whale-stable_amd64.deb control.tar.gz | tar zx
_ver=$(cat control |grep 'Version'|sed 's/-*.$//;s/[^0-9.]*//')
  printf "$_ver"
}
 
package() {
  tar xfp data.tar.xz -C "$pkgdir/"
  rm -rf "$pkgdir"/etc/cron.daily "$pkgdir"/opt/google/chrome/cron/ "$pkgdir"/usr/share/gnome-control-center/ "$pkgdir"/usr/share/menu "$pkgdir"/usr/share/man "$pkgdir"/usr/bin/$pkgname-stable
  install -d $pkgdir/usr/share/pixmaps
  install -Dm644 $pkgdir/opt/naver/whale/product_logo_256.png $pkgdir/usr/share/pixmaps/$pkgname.png
  ln -s naver-whale-stable $pkgdir/usr/bin/$pkgname
  cat <<\EOF> $pkgdir/usr/bin/$pkgname-stable
#!/bin/sh
## Make sure we always have the latest version installed due security fixes!
_pkgname=naver-whale
_current=$(curl -L http://repo.whale.naver.com/stable/deb/dists/stable/main/binary-amd64/Packages|grep 'Version'|sed 's/-*.$//;s/[^0-9.]*//')
 
### check for internet connection and if online check version
if ping -q -w1 -c1 google.com &>/dev/null; then
  printf "connected, checking for new version of ${_pkgname}...\n"
_installed=$(pacman -Qi ${_pkgname}|grep Version|cut -d':' -f2|sed 's/-*.$//;s/[^0-9.]*//g')
_highest=$(printf "$_current\n$_installed"|sort -V|tail -1)
    if [ "$_highest" != "$_installed" ]; then
        kdialog --error "Your version of ${_pkgname} is out-of-date, please reinstall the CCR package to update! \n\nchaser install ${_pkgname}"
    fi
else
    printf "disconnected, could not check for new version of ${_pkgname}\n"
fi
 
### Link to the plasma extension after first launch so people can install it.
if [ -d $HOME/.config/naver-whale ]; then
    exec /opt/naver/whale/naver-whale "${@}"
else
    exec /opt/naver/whale/naver-whale https://chrome.google.com/webstore/detail/plasma-integration/cimiefiiaegbelhefglklhhakcgmhkai "${@}"
fi
EOF
  chmod +x $pkgdir/usr/bin/$pkgname-stable
}