1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # cross-lfs native shadow build
|
---|
4 | # -----------------------------
|
---|
5 | # $LastChangedBy$
|
---|
6 | # $LastChangedDate$
|
---|
7 | # $LastChangedRevision$
|
---|
8 | # $HeadURL$
|
---|
9 | #
|
---|
10 |
|
---|
11 | cd ${SRC}
|
---|
12 | LOG="shadow-native.log"
|
---|
13 |
|
---|
14 | SELF=`basename ${0}`
|
---|
15 | set_buildenv
|
---|
16 | set_libdirname
|
---|
17 | setup_multiarch
|
---|
18 |
|
---|
19 | if [ ! "${libdirname}" = "lib" ]; then
|
---|
20 | extra_conf="--libdir=/usr/${libdirname}"
|
---|
21 | fi
|
---|
22 |
|
---|
23 | unpack_tarball shadow-${SHADOW_VER} &&
|
---|
24 | cd ${PKGDIR}
|
---|
25 |
|
---|
26 | # HACK
|
---|
27 | # Issue noted with glibc-2.3-20040701 and linux-libc-headers-2.6.7
|
---|
28 | test -f libmisc/xmalloc.c-ORIG ||
|
---|
29 | cp -p libmisc/xmalloc.c libmisc/xmalloc.c-ORIG
|
---|
30 |
|
---|
31 | sed 's@^extern char \*malloc ();@/* & */@g' \
|
---|
32 | libmisc/xmalloc.c-ORIG > libmisc/xmalloc.c
|
---|
33 |
|
---|
34 | case ${SHADOW_VER} in
|
---|
35 | 4.0.7 )
|
---|
36 | # fix lastlog for shadow-4.0.7
|
---|
37 | apply_patch shadow-4.0.7-fix_lastlog-1
|
---|
38 | ;;
|
---|
39 | 4.0.14 )
|
---|
40 | apply_patch shadow-4.0.14-configure_fix-1
|
---|
41 | ;;
|
---|
42 | esac
|
---|
43 |
|
---|
44 | # Set to Y if you want a shared libmisc and libshadow and have
|
---|
45 | # passwd etc linked dynamically to these
|
---|
46 | BUILD_SHADOW_SHARED="Y"
|
---|
47 |
|
---|
48 | # If not there touch /usr/bin/passwd
|
---|
49 | test -f /usr/bin/passwd || touch /usr/bin/passwd
|
---|
50 |
|
---|
51 | test Y = "${BUILD_SHADOW_SHARED}" &&
|
---|
52 | extra_conf="${extra_conf} --enable-shared"
|
---|
53 |
|
---|
54 | max_log_init Shadow ${SHADOW_VER} "native (shared)" ${CONFLOGS} ${LOG}
|
---|
55 | CC="${CC-gcc} ${ARCH_CFLAGS}" \
|
---|
56 | CFLAGS="-O2 -pipe ${TGT_CFLAGS}" \
|
---|
57 | ./configure --prefix=/usr ${extra_conf} \
|
---|
58 | --mandir=/usr/share/man \
|
---|
59 | >> ${LOGFILE} 2>&1 &&
|
---|
60 | echo " o Configure OK" &&
|
---|
61 |
|
---|
62 | min_log_init ${BUILDLOGS} &&
|
---|
63 | make LDFLAGS="-s" \
|
---|
64 | >> ${LOGFILE} 2>&1 &&
|
---|
65 | echo " o Build OK" &&
|
---|
66 |
|
---|
67 | min_log_init ${TESTLOGS} &&
|
---|
68 | make check \
|
---|
69 | >> ${LOGFILE} 2>&1 &&
|
---|
70 | echo " o Test OK" &&
|
---|
71 |
|
---|
72 | min_log_init ${INSTLOGS} &&
|
---|
73 | make install \
|
---|
74 | >> ${LOGFILE} 2>&1 &&
|
---|
75 | echo " o ALL OK" || barf
|
---|
76 |
|
---|
77 | shadowfiles="limits login.access"
|
---|
78 | for file in ${shadowfiles} ; do
|
---|
79 | test -f /etc/${file} ||
|
---|
80 | {
|
---|
81 | cp -v etc/${file} /etc
|
---|
82 | chmod -c 644 /etc/limits
|
---|
83 | }
|
---|
84 | done
|
---|
85 |
|
---|
86 | # LFS: User mailboxes belong in /var/mail not /var/spool/mail
|
---|
87 | # From Nico's: use MD5
|
---|
88 | sed -e 's%/var/spool/mail%/var/mail%' \
|
---|
89 | -e 's%^#MD5_CRYPT_ENAB.*no%MD5_CRYPT_ENAB yes%' \
|
---|
90 | etc/login.defs.linux > /etc/login.defs
|
---|
91 |
|
---|
92 | ln -sf vipw /usr/sbin/vigr
|
---|
93 | # Nico: create symlink for vigr man page
|
---|
94 | ln -sf vipw.8 /usr/share/man/man8/vigr.8
|
---|
95 | rm -f /bin/vipw
|
---|
96 | mv -f /bin/sg /usr/bin
|
---|
97 |
|
---|
98 | # Only need to move these if we built shared
|
---|
99 | # TODO: 4.0.6 seems we only need to move libshadow...
|
---|
100 | # 4.0.7, the below shouldn't be required
|
---|
101 | # Must revisit this script... though what we do here doesn't hurt...
|
---|
102 | test Y = "${BUILD_SHADOW_SHARED}" &&
|
---|
103 | {
|
---|
104 | mv -f /usr/${libdirname}/lib{shadow,misc}.so.0* /${libdirname}
|
---|
105 | ln -sf ../../${libdirname}/libshadow.so.0 /usr/${libdirname}/libshadow.so
|
---|
106 | ln -sf ../../${libdirname}/libmisc.so.0 /usr/${libdirname}/libmisc.so
|
---|
107 | ldconfig
|
---|
108 | }
|
---|
109 |
|
---|
110 | # Create shadow password file if not already built
|
---|
111 | test -f /etc/shadow ||
|
---|
112 | /usr/sbin/pwconv
|
---|
113 |
|
---|