2.79. basefiles

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()
{
    mkdir -p ${D}/etc
    ln -s /proc/self/mounts ${D}/etc/mtab

    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:/var/run/dbus:/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:
systemd-journal:x:23:
input:x:24:
mail:x:34:
nogroup:x:99:
users:x:999:
$(id -gn):x:$(id -g):
EOF

    mkdir -p ${D}/var/log
    touch \
        ${D}/var/log/btmp \
        ${D}/var/log/lastlog \
        ${D}/var/log/faillog \
        ${D}/var/log/wtmp
    
}

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
pass1.sh

Other files

meta.txt
text

Links

url.lfs: https://linuxfromscratch.org/lfs/view/9.1/chapter06/createfiles.html
url.lfs.stage1: https://linuxfromscratch.org/lfs/view/9.1/chapter06/createfiles.html