3.24. shadow-4.12.2
#!/bin/sh # Copyright © 1999-2022 Gerard Beekmans # Copyright © 2017-2022 Random Crew # Distributed under the terms of MIT License.
Configuration
The LFS book offers optional dependency from cracklib package. That is checked in code below:
if use 'cracklib' ; then sed -i 's@DICTPATH.*@DICTPATH\t/lib/cracklib/pw_dict@' etc/login.defs fi
use is method of build engine, which checks up the element of build configuration (use words in terms of any). In the example above this element is word cracklib. If it is turned on, then the condition will be true and code under the if operator will be executed.
To include cracklib into your build configuration, you may add to configuration file:
use_cracklib = 1
Or add to command line:
anch do lfs shadow-<version> use_cracklib=1
Later another code checks up the same condition:
$(use_enable 'cracklib' '--with-libcrack')
The code above will turn on option --with-libcrack, if word cracklib will be present in configuration.
The command is not performed:
touch /usr/bin/passwdWe should not touch anything at host directly. Instead we edit the resulting config.h file.
src_config() { sed -i 's/groups$(EXEEXT) //' src/Makefile.in find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \; find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \; sed -e 's:#ENCRYPT_METHOD DES:ENCRYPT_METHOD SHA512:' \ -e 's:/var/spool/mail:/var/mail:' \ -e '/PATH=/{s@/sbin:@@;s@/bin:@@}' \ -i etc/login.defs if use 'cracklib' ; then sed -i 's:DICTPATH.*:DICTPATH\t/lib/cracklib/pw_dict:' etc/login.defs fi ./configure \ --sysconfdir=/etc \ --disable-static \ --with-group-name-max-length=32 \ $(use_enable 'cracklib' '--with-libcrack') sed -i -e \ "s:#define PASSWD_PROGRAM .*:#define PASSWD_PROGRAM \"${PREFIX}/bin/passwd\":" \ config.h }
Compilation
src_compile() { make ${MAKEOPTS} }
Installation
pwconv and grpconv are not executed during the install. Instead they are saved into postinst file. That file will be executed after binary package installation.
The call of useradd is not performed. Instead the /etc/default/useradd file is stored beforehand and is installed.
src_install() { make exec_prefix=${PREFIX} ${MAKEOPTS} DESTDIR=${D} install make -C man install-man ${MAKEOPTS} DESTDIR=${D} mkdir -p ${D}/etc/default install -m600 ${S}/sample-useradd ${D}/etc/default/useradd }
lfs_postinstall
Method lfs_postinstall is declared here as empty: that means there will be no execution of postinstall script during the build. This is done, because we are performing the build from non-privileged user, but the content of postinstall script requires root privileges.
So postinstall actions will not be performed in build environment, but will be at the installation stage, with root user available.
lfs_postinstall() { return }
Run time scripts
Build code
Other files
Links