niizam / vantage

Lenovo Vantage for Linux
GNU General Public License v3.0
134 stars 14 forks source link

Arch AUR pkgbuild script. #15

Open petar-v opened 3 weeks ago

petar-v commented 3 weeks ago

Hello!

Thanks so much for making this. It's super useful.

I'd like to add it to AUR. However, for this, it would be best if you can make your makefile take an install dir argument. I've made the following PKGBUILD script and will submit it to AUR.

# Maintainer: Petar Vasilev <petar@pshow.org>
pkgname=lenovo-vantage-linux
pkgver=r21.0e123d7 
pkgrel=1
pkgdesc="This shell script helps you to provide Lenovo Vantage in GNU/Linux operating system."
arch=('x86_64')
url="https://github.com/niizam/vantage" 
license=('GPL3')
depends=('zenity' 'xorg-xinput' 'networkmanager')
makedepends=('git' 'make')
optdepends=(
  'pulseaudio: for PulseAudio support'
  'pipewire-pulse: for PipeWire support instead of PulseAudio'
)

_commit="0e123d7508ca20bef26d4ea8ba2a13124f863d10"
source=("$pkgname::git+$url.git#commit=$_commit")
sha256sums=('5c2d16ee808695712c5e7010e623006678e8e24d40ef9297b62e02e420469eac')

provides=('lenovo-vantage-linux')

# Handle pulseaudio/pipewire-pulse
prepare() {
  if pacman -Qi pipewire-pulse &>/dev/null; then
    depends=('zenity' 'xorg-xinput' 'networkmanager' 'pipewire-pulse')
  fi
  if pacman -Qi pulseaudio &>/dev/null; then
    depends=('zenity' 'xorg-xinput' 'networkmanager' 'pulseaudio')
  fi
}

pkgver() {
  cd "$pkgname"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

package() {
  cd "$srcdir/$pkgname"

  # Manually install files as per Makefile's instructions
  chmod a+rx ./vantage.sh
  install -Dm644 ./icon.png "$pkgdir/usr/share/icons/hicolor/scalable/apps/vantage.png"
  install -Dm644 ./vantage.desktop "$pkgdir/usr/share/applications/vantage.desktop"
  install -Dm755 ./vantage.sh "$pkgdir/usr/bin/vantage"
  install -Dm644 "./LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}