source: scripts/scripts/native-scripts/native-shadow.sh@ c7ec163

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since c7ec163 was c7ec163, checked in by Jim Gifford <clfs@…>, 19 years ago

r2473@server (orig r1230): ryan | 2006-03-06 23:56:13 -0800

r1232@rei: lfs | 2006-03-07 18:03:13 +1100
Gah, push in long forgotten changes (must sync more often)


  • Property mode set to 100755
File size: 2.7 KB
Line 
1#!/bin/bash
2
3# cross-lfs native shadow build
4# -----------------------------
5# $LastChangedBy$
6# $LastChangedDate$
7# $LastChangedRevision$
8# $HeadURL$
9#
10
11cd ${SRC}
12LOG="shadow-native.log"
13
14SELF=`basename ${0}`
15set_buildenv
16set_libdirname
17setup_multiarch
18
19if [ ! "${libdirname}" = "lib" ]; then
20 extra_conf="--libdir=/usr/${libdirname}"
21fi
22
23unpack_tarball shadow-${SHADOW_VER} &&
24cd ${PKGDIR}
25
26# HACK
27# Issue noted with glibc-2.3-20040701 and linux-libc-headers-2.6.7
28test -f libmisc/xmalloc.c-ORIG ||
29 cp -p libmisc/xmalloc.c libmisc/xmalloc.c-ORIG
30
31sed 's@^extern char \*malloc ();@/* & */@g' \
32 libmisc/xmalloc.c-ORIG > libmisc/xmalloc.c
33
34case ${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 ;;
42esac
43
44# Set to Y if you want a shared libmisc and libshadow and have
45# passwd etc linked dynamically to these
46BUILD_SHADOW_SHARED="Y"
47
48# If not there touch /usr/bin/passwd
49test -f /usr/bin/passwd || touch /usr/bin/passwd
50
51test Y = "${BUILD_SHADOW_SHARED}" &&
52 extra_conf="${extra_conf} --enable-shared"
53
54max_log_init Shadow ${SHADOW_VER} "native (shared)" ${CONFLOGS} ${LOG}
55CC="${CC-gcc} ${ARCH_CFLAGS}" \
56CFLAGS="-O2 -pipe ${TGT_CFLAGS}" \
57./configure --prefix=/usr ${extra_conf} \
58 --mandir=/usr/share/man \
59 >> ${LOGFILE} 2>&1 &&
60echo " o Configure OK" &&
61
62min_log_init ${BUILDLOGS} &&
63make LDFLAGS="-s" \
64 >> ${LOGFILE} 2>&1 &&
65echo " o Build OK" &&
66
67min_log_init ${TESTLOGS} &&
68make check \
69 >> ${LOGFILE} 2>&1 &&
70echo " o Test OK" &&
71
72min_log_init ${INSTLOGS} &&
73make install \
74 >> ${LOGFILE} 2>&1 &&
75echo " o ALL OK" || barf
76
77shadowfiles="limits login.access"
78for file in ${shadowfiles} ; do
79 test -f /etc/${file} ||
80 {
81 cp -v etc/${file} /etc
82 chmod -c 644 /etc/limits
83 }
84done
85
86# LFS: User mailboxes belong in /var/mail not /var/spool/mail
87# From Nico's: use MD5
88sed -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
92ln -sf vipw /usr/sbin/vigr
93# Nico: create symlink for vigr man page
94ln -sf vipw.8 /usr/share/man/man8/vigr.8
95rm -f /bin/vipw
96mv -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...
102test 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
111test -f /etc/shadow ||
112 /usr/sbin/pwconv
113
Note: See TracBrowser for help on using the repository browser.