# Packager: Phill Watkins <ubemail~at~ymail~dot~com>

pkgname=chntpw
pkgver=100627
pkgrel=1pw
#arch=noarch
source=("http://pogostick.net/~pnh/ntpasswd/chntpw-source-$pkgver.zip")
sourcetemplate=http://people.salixos.org/pwatk/packages/ap/$pkgname/$pkgver
docs=("GPL.txt" "INSTALL.txt" "HISTORY.txt" "LGPL.txt" "README.txt" "regedit.txt" "WinReg.txt")
url=http://pogostick.net/~pnh/ntpasswd/

#doinst() {
#
#}

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"chntpw (Offline NT Password & Registry Editor)"
"This little program will enable you to view some information and"
"change user passwords in a Windows NT SAM userdatabase file."
"You do not need to know the old passwords."
"However, you need to get at the file some way or another yourself."
"In addition it contains a simple registry editor with full write"
"support, and hex-editor which enables you to"
"fiddle around with bits&bytes in the file as you wish yourself."
)

build() {
    set -e

    cd $startdir/src/$pkgname-$pkgver

    if [ "$arch" = "x86_64" ]; then
      LIBDIRSUFFIX="64"
    fi
    
    sed -i \
      -e "/^CFLAGS=/s|-m32|$CFLAGS|" \
      -e "/^OSSLLIB=/s|\/lib|\/lib$LIBDIRSUFFIX|" \
      -e "/^LIBS=/s|libcrypto.a|libcrypto.so|" \
      Makefile
    
    make clean
    make chntpw cpnt reged
    for bin in chntpw cpnt reged ;do
      install -Dm 0755 $bin $startdir/pkg/usr/sbin/$bin
    done
    
    set +e
}