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 | # fix lastlog for shadow-4.0.7 |
---|
35 | case ${SHADOW_VER} in |
---|
36 | 4.0.7 ) |
---|
37 | apply_patch shadow-4.0.7-fix_lastlog-1 |
---|
38 | ;; |
---|
39 | esac |
---|
40 | |
---|
41 | # Set to Y if you want a shared libmisc and libshadow and have |
---|
42 | # passwd etc linked dynamically to these |
---|
43 | BUILD_SHADOW_SHARED="Y" |
---|
44 | |
---|
45 | # If not there touch /usr/bin/passwd |
---|
46 | test -f /usr/bin/passwd || touch /usr/bin/passwd |
---|
47 | |
---|
48 | test Y = "${BUILD_SHADOW_SHARED}" && |
---|
49 | extra_conf="${extra_conf} --enable-shared" |
---|
50 | |
---|
51 | max_log_init Shadow ${SHADOW_VER} "native (shared)" ${CONFLOGS} ${LOG} |
---|
52 | CC="${CC-gcc} ${ARCH_CFLAGS}" \ |
---|
53 | CFLAGS="-O2 -pipe ${TGT_CFLAGS}" \ |
---|
54 | ./configure --prefix=/usr ${extra_conf} \ |
---|
55 | --mandir=/usr/share/man \ |
---|
56 | >> ${LOGFILE} 2>&1 && |
---|
57 | echo " o Configure OK" && |
---|
58 | |
---|
59 | min_log_init ${BUILDLOGS} && |
---|
60 | make LDFLAGS="-s" \ |
---|
61 | >> ${LOGFILE} 2>&1 && |
---|
62 | echo " o Build OK" && |
---|
63 | |
---|
64 | min_log_init ${TESTLOGS} && |
---|
65 | make check \ |
---|
66 | >> ${LOGFILE} 2>&1 && |
---|
67 | echo " o Test OK" && |
---|
68 | |
---|
69 | min_log_init ${INSTLOGS} && |
---|
70 | make install \ |
---|
71 | >> ${LOGFILE} 2>&1 && |
---|
72 | echo " o ALL OK" || barf |
---|
73 | |
---|
74 | shadowfiles="limits login.access" |
---|
75 | for file in ${shadowfiles} ; do |
---|
76 | test -f /etc/${file} || |
---|
77 | { |
---|
78 | cp -v etc/${file} /etc |
---|
79 | chmod -c 644 /etc/limits |
---|
80 | } |
---|
81 | done |
---|
82 | |
---|
83 | # LFS: User mailboxes belong in /var/mail not /var/spool/mail |
---|
84 | # From Nico's: use MD5 |
---|
85 | sed -e 's%/var/spool/mail%/var/mail%' \ |
---|
86 | -e 's%^#MD5_CRYPT_ENAB.*no%MD5_CRYPT_ENAB yes%' \ |
---|
87 | etc/login.defs.linux > /etc/login.defs |
---|
88 | |
---|
89 | ln -sf vipw /usr/sbin/vigr |
---|
90 | # Nico: create symlink for vigr man page |
---|
91 | ln -sf vipw.8 /usr/share/man/man8/vigr.8 |
---|
92 | rm -f /bin/vipw |
---|
93 | mv -f /bin/sg /usr/bin |
---|
94 | |
---|
95 | # Only need to move these if we built shared |
---|
96 | # TODO: 4.0.6 seems we only need to move libshadow... |
---|
97 | # 4.0.7, the below shouldn't be required |
---|
98 | # Must revisit this script... though what we do here doesn't hurt... |
---|
99 | test Y = "${BUILD_SHADOW_SHARED}" && |
---|
100 | { |
---|
101 | mv -f /usr/${libdirname}/lib{shadow,misc}.so.0* /${libdirname} |
---|
102 | ln -sf ../../${libdirname}/libshadow.so.0 /usr/${libdirname}/libshadow.so |
---|
103 | ln -sf ../../${libdirname}/libmisc.so.0 /usr/${libdirname}/libmisc.so |
---|
104 | ldconfig |
---|
105 | } |
---|
106 | |
---|
107 | # Create shadow password file if not already built |
---|
108 | test -f /etc/shadow || |
---|
109 | /usr/sbin/pwconv |
---|
110 | |
---|