This repository has been archived by the owner on Aug 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plan.sh
87 lines (77 loc) · 2.55 KB
/
plan.sh
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
pkg_name=shadow
pkg_origin=core
pkg_version=4.9
pkg_maintainer="The Habitat Maintainers <humans@habitat.sh>"
pkg_description="Password and account management tool suite."
pkg_upstream_url="https://github.com/shadow-maint/shadow"
pkg_license=('bsd')
pkg_source="https://github.com/shadow-maint/${pkg_name}/releases/download/v${pkg_version}/${pkg_name}-${pkg_version}.tar.xz"
pkg_shasum="feec1f2ce9c1b62798afd35a7d1b04cefdfa3a0a30ff3e75d6965ba8978c9144"
pkg_deps=(
core/glibc
core/attr
core/acl
)
pkg_build_deps=(
core/coreutils
core/diffutils
core/patch
core/make
core/gcc
)
pkg_bin_dirs=(bin)
do_prepare() {
# Allow dots in usernames.
#
# Thanks to: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/shadow/files/shadow-4.1.3-dots-in-usernames.patch
patch -p1 -i "$PLAN_CONTEXT/dots-in-usernames.patch"
# Disable the installation of the `groups` program as Coreutils provides a
# better version.
#
# Thanks to:
# http://www.linuxfromscratch.org/lfs/view/stable/chapter06/shadow.html
# shellcheck disable=SC2016
sed -i 's/groups$(EXEEXT) //' src/Makefile.in
find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
# Instead of using the default crypt method, use the more secure SHA-512
# method of password encryption, which also allows passwords longer than 8
# characters.
#
# Thanks to:
# http://www.linuxfromscratch.org/lfs/view/stable/chapter06/shadow.html
sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' etc/login.defs
}
do_build() {
./configure \
--prefix="$pkg_prefix" \
--with-acl \
--with-attr \
--with-group-name-max-length=32 \
--without-selinux \
--without-libpam
make
}
do_check() {
make check
}
do_install() {
do_default_install
# Move all binaries in `sbin/` into `bin/` as this isn't handled by
# `./configure`.
mv "$pkg_prefix/sbin"/* "$pkg_prefix/bin/"
rm -rf "$pkg_prefix/sbin"
# Install the license
install -Dm644 COPYING "$pkg_prefix/share/licenses/COPYING"
}
# ----------------------------------------------------------------------------
# **NOTICE:** What follows are implementation details required for building a
# first-pass, "stage1" toolchain and environment. It is only used when running
# in a "stage1" Studio and can be safely ignored by almost everyone. Having
# said that, it performs a vital bootstrapping process and cannot be removed or
# significantly altered. Thank you!
# ----------------------------------------------------------------------------
if [[ "$STUDIO_TYPE" = "stage1" ]]; then
pkg_build_deps=(
core/gcc
)
fi