aboutsummaryrefslogtreecommitdiffstats
path: root/community/makepasswd/APKBUILD
blob: 97e4c211453370356455dc6f09b973b05cf772d8 (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
47
# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=makepasswd
pkgver=0.5.4
pkgrel=0
pkgdesc="Generates (pseudo-)random passwords of a desired length"
url="https://www.defora.org/os/project/117/makepasswd"
arch="all"
license="GPL-3.0"
depends=""
makedepends="libxslt docbook-xsl openssl-dev"
install=""
subpackages="$pkgname-doc"
source="https://www.defora.org/os/download/download/4438/$pkgname-$pkgver.tar.gz"

build() {
	make
	make -C doc
}

package() {
	install -D -p -m 755 src/makepasswd "$pkgdir"/usr/bin/makepasswd
	install -D -p -m 644 doc/makepasswd.1 \
		"$pkgdir"/usr/share/man/man1/$pkgname.1
}

check() {
	local expected output

	# Generated expected hash with:
	# {
	#  printf -- '%s  %s\n' testing "$(printf testing | openssl enc -a)" ;
	#  printf testing | openssl dgst -md5 | awk '{$1="testing "; print; quit;}' ;
	#  for a in des md5 sha256 ; do printf -- '%s  ' testing; mkpasswd -m "$a" testing foobar ; done ;
	# } | sha512sum
	#
	expected='11d0cc3117bb6074adefaded0ed5f2a50fdc6b5448d832dd25b742edb499f225fe2469f7ae7f8859921640f2f31c62d6b2c82d7ea9471fb28a152a011aac7406'
	output="$(mktemp -q -p .)"

	local a; for a in base64 md5 des shmd5 sha256; do
		./src/makepasswd -e "${a}" -s 'foobar' -p 'testing'
	done > "$output"

	printf -- '%s  %s\n' "${expected}" "${output}" | sha512sum -c
}

sha512sums="c8721826c7329b2c4e7fc2226e31a081347b66a76827ca669547125fed2175035ecd6b7d46aacdf8ae6ee140281caf31e5bdbecdd2807723800596fd0140aaa0  makepasswd-0.5.4.tar.gz"