#Packager: Dimitris Tzemos <dijemos~at~gmail~dot~com>

pkgname=unetbootin
pkgver=702
pkgrel=1dj
source=("https://github.com/unetbootin/unetbootin/archive/${pkgver}.tar.gz" "org.archlinux.pkexec.unetbootin.policy" "unetbootin.sh")
url='https://unetbootin.github.io'

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"unetbootin (create bootable Live USB drives)"
"UNetbootin lets you create bootable live usb drives for Linux"
"distributions without burning a CD."
""
"Homepage: http://unetbootin.sourceforge.net"
)

build() {
  cd "$SRC/${pkgname}-${pkgver}/src/${pkgname}"
  
  lrelease-qt5 "${pkgname}.pro"
  qmake-qt5 "${pkgname}.pro" -config release "DEFINES += NOSTATIC" "RESOURCES -= ${pkgname}.qrc"
  make
	
  install -Dvm755 "${pkgname}.sh" "${PKG}/usr/bin/${pkgname}"
  install -Dvm644 "org.archlinux.pkexec.${pkgname}.policy" -t "${PKG}/usr/share/polkit-1/actions"

  cd "${pkgname}-${pkgver}/src/${pkgname}"
  install -Dvm644 "${pkgname}"_*.qm -t "${PKG}/usr/share/${pkgname}"
  install -Dvm755 "${pkgname}" "${PKG}/usr/bin/${pkgname}.elf"
  install -Dvm644 "${pkgname}.desktop" -t "${PKG}/usr/share/applications"
  sed -i "s/Exec=.*/Exec=gksudo \/usr\/bin\/unetbootin.elf/g" "$PKG/usr/share/applications/$pkgname.desktop"
  install -Dvm644 'readme.md' -t "${PKG}/usr/share/doc/${pkgname}"

  for i in 16 24 32 48 64 128 256 512; do
    install -Dvm644 "${pkgname}_${i}.png" "${PKG}/usr/share/icons/hicolor/${i}x${i}/apps/${pkgname}.png"
  done
}
