summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cb886b4dca40c8e47e6f01fd95bef614aa0988b3 (plain)
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
# Maintainer: Lennart Martens  <monkeynator78@gmail.com>

pkgname=servicemaster-git
_pkgname=servicemaster
pkgver=1.7.5.r162.f07e5ec
pkgrel=1
pkgdesc="Linux Systemd administration tool with nice TUI written in C."
arch=('x86_64')
url="https://github.com/lennart1978/servicemaster"
license=('MIT')
depends=('ncurses' 'systemd-libs')
makedepends=('meson' 'ninja' 'gcc')
provides=("$_pkgname")
conflicts=("$_pkgname")
source=("git+https://github.com/lennart1978/servicemaster.git")
sha256sums=('SKIP')

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

build() {
  arch-meson build $_pkgname
  meson compile -C build
}

package() {
  # Define path to any old manual installation
  old_path="/usr/local/bin/servicemaster"
  
  # Check if an old manual installation exists and remove it
  if [ -f "$old_path" ]; then
    echo "⚠️  Old manual installation found at $old_path. Removing it..."
    if rm -f "$old_path"; then
      echo "✅ Successfully removed old version."
    else
      echo "❌ Failed to remove $old_path!" >&2
      exit 1
    fi
  fi

  # Standard Meson installation to package directory
  meson install -C build --destdir "${pkgdir}"
}