# Maintainer: PktSurf <smlinux@pktsurf.in>
app=pkgtools
version=14.2
build=1sml
homepage="https://slackware.uk/slackware/slackware-14.2/source/a/pkgtools/"
download="https://slackware.uk/slackware/slackware-14.2/source/a/pkgtools/"
desc="The Slackware package maintenance system, modified for SMLinux"
requires="tar grep gawk sed bash util-linux coreutils"
skipchecksum=1

prepbuilddir() {
  ARCH=noarch
  mkandenterbuilddir
  rm -rf $app-$version
}

build() {
  # Install Slackware script manpages:
  ( cd $srcdir/manpages
    mkdir -p $pkg/share/man/man8
    for page in explodepkg.8 installpkg.8 makepkg.8 upgradepkg.8 pkgtool.8 \
      removepkg.8 ; do
      cat $page | gzip -9c > $pkg/share/man/man8/$page.gz
    done
  )

  # Install Slackware scripts:
  ( cd $srcdir/scripts
    # Install the core Slackware package tools:
    mkdir -p $pkg/bin
    for file in explodepkg installpkg makepkg pkgtool removepkg upgradepkg ; do
      cp -a $srcdir/scripts/$file $pkg/bin
    done
    chown root:root $pkg/bin/*
    chmod 755 $pkg/bin/*
  )

  mkfinalpkg
}

sha512sums="
"
