3.79. basefiles-11.0

Package with essential files and links, which are not distributed to another packages.

#!/bin/sh
# Copyright © 1999-2022 Gerard Beekmans
# Copyright © 2017-2022 Random Crew
# Distributed under the terms of MIT License.

Configuration

src_config()
{
    return
}

Compilation

src_compile()
{
    return
}

Installation

With the calls of id utility we write the user ID and group ID of current user into user database of newly created system. That way we can operate later inside chrooted environment from the same user as outside.

chgrp utility is not called during the build, as it requires root privileges. Instead it is called later in the postinstall script.

src_install()
{
    if ause 'pass1' ; then
        mkdir -p ${D}/var/lib/
        echo ${LFS} > ${D}/var/lib/formerbase
    fi

    mkdir -p ${D}/etc
    ln -s /proc/self/mounts ${D}/etc/mtab

    cat > ${D}/etc/hosts << EOF
127.0.0.1  localhost $(hostname)
::1        localhost
EOF

    cat > ${D}/etc/passwd << EOF
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/bin/false
daemon:x:6:6:Daemon User:/dev/null:/bin/false
messagebus:x:18:18:D-Bus Message Daemon User:/run/dbus:/bin/false
uuidd:x:80:80:UUID Generation Daemon User:/dev/null:/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
$(id -un):x:$(id -u):$(id -g):Current user:/tmp:/bin/bash
EOF

    cat > ${D}/etc/group << EOF
root:x:0:
bin:x:1:daemon
sys:x:2:
kmem:x:3:
tape:x:4:
tty:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
dialout:x:10:
audio:x:11:
video:x:12:
utmp:x:13:
usb:x:14:
cdrom:x:15:
adm:x:16:
messagebus:x:18:
input:x:24:
mail:x:34:
kvm:x:61:
uuidd:x:80:
wheel:x:97:
nogroup:x:99:
users:x:999:
$(id -gn):x:$(id -g):
EOF

    echo "tester:x:101:101::/home/tester:/bin/bash" >> ${D}/etc/passwd
    echo "tester:x:101:" >> ${D}/etc/group
    mkdir -p ${D}/home/tester

    mkdir -p ${D}/var/log
    touch \
        ${D}/var/log/btmp \
        ${D}/var/log/lastlog \
        ${D}/var/log/faillog \
        ${D}/var/log/wtmp
#    chgrp utmp ${D}/var/log/lastlog
    chmod 664 ${D}/var/log/lastlog
    chmod 600 ${D}/var/log/btmp
}

lfs_install

Method lfs_install is empty, which means the package is not installed into chroot at the main stage of the build. Instead it is installed only at pass1 stage, which uses another method for installation.

lfs_install()
{
    return
}

Run time scripts

postinst

Build code

basefiles.build

Other files

meta.txt
text

Links

url.lfs: https://linuxfromscratch.org/lfs/view/11.0/chapter07/createfiles.html
url.lfs.stage1: https://linuxfromscratch.org/lfs/view/11.0/chapter07/createfiles.html