configs addition for chroot population

master
phanes 2023-02-20 22:24:08 -05:00
parent 4668e617e6
commit 37550c04c7
14 changed files with 303 additions and 7 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
stage
logs

34
configs/etc_group Normal file
View File

@ -0,0 +1,34 @@
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:
kvm:x:61:
systemd-journal-gateway:x:73:
systemd-journal-remote:x:74:
systemd-journal-upload:x:75:
systemd-network:x:76:
systemd-resolve:x:77:
systemd-timesync:x:78:
systemd-coredump:x:79:
uuidd:x:80:
systemd-oom:x:81:
wheel:x:97:
users:x:999:
nogroup:x:65534:

14
configs/etc_passwd Normal file
View File

@ -0,0 +1,14 @@
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/usr/bin/false
daemon:x:6:6:Daemon User:/dev/null:/usr/bin/false
messagebus:x:18:18:D-Bus Message Daemon User:/run/dbus:/usr/bin/false
systemd-journal-gateway:x:73:73:systemd Journal Gateway:/:/usr/bin/false
systemd-journal-remote:x:74:74:systemd Journal Remote:/:/usr/bin/false
systemd-journal-upload:x:75:75:systemd Journal Upload:/:/usr/bin/false
systemd-network:x:76:76:systemd Network Management:/:/usr/bin/false
systemd-resolve:x:77:77:systemd Resolver:/:/usr/bin/false
systemd-timesync:x:78:78:systemd Time Synchronization:/:/usr/bin/false
systemd-coredump:x:79:79:systemd Core Dumper:/:/usr/bin/false
uuidd:x:80:80:UUID Generation Daemon User:/dev/null:/usr/bin/false
systemd-oom:x:81:81:systemd Out Of Memory Daemon:/:/usr/bin/false
nobody:x:65534:65534:Unprivileged User:/dev/null:/usr/bin/false

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
APPNAME="CHROOT VFS SETUP" APPNAME="CHROOT VFS SETUP"
T_SYSROOT=${dir_sysroot} T_SYSROOT=${dir_sysroot}
set -a
assert_zero() { assert_zero() {
if [[ "$1" -eq 0 ]]; then if [[ "$1" -eq 0 ]]; then
return return
@ -51,12 +51,15 @@ logprint "mounting proc filesystem from to chroot sysroot..."
is_mounted ${T_SYSROOT}/proc || mount -v -t proc proc ${T_SYSROOT}/proc is_mounted ${T_SYSROOT}/proc || mount -v -t proc proc ${T_SYSROOT}/proc
assert_zero $? assert_zero $?
logprint "mounting shm"
# not a symlink on ubuntu # not a symlink on ubuntu
if [ -h ${T_SYSROOT}/dev/shm ]; then if [ -h ${T_SYSROOT}/dev/shm ]; then
mkdir -vp ${T_SYSROOT}/$(readlink ${T_SYSROOT})/dev/shm mkdir -vp ${T_SYSROOT}/$(readlink "${T_SYSROOT}/dev/shm")
assert_zero $? assert_zero $?
else else
mount -t tmpfs -o nosuid,nodev tmpfs ${T_SYSROOT}/dev/shm is_mounted ${T_SYSROOT}/dev/shm || mount -t tmpfs -o nosuid,nodev tmpfs ${T_SYSROOT}/dev/shm
fi fi
logprint "mounting rex_embedded for stage3 capability"
mkdir -p ${T_SYSROOT}/rex_embedded
is_mounted ${T_SYSROOT}/rex_embedded || mount -v --bind ${project_root} ${T_SYSROOT}/rex_embedded

32
make.project/build_stage3.sh Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env bash
# fix an issue with open files limit on some hosts
ulimit -l unlimited
#ulimit -n 10240
ulimit -c unlimited
# closely aligns with LFS Ch 5, 6
T_SYSROOT=${dir_sysroot}
project_root=/rex_embedded
echo "Bootstrapping from MAKE to REX..."
dir_rex=/rex_embedded/rex.project
# Executes rex from within the chroot.
/usr/sbin/chroot "${T_SYSROOT}" /usr/bin/env -i \
HOME="/" \
TERM="$TERM" \
COLORTERM=$COLORTERM \
PS1='\n(Dark Horse Linux) [ \u @ \H ] << \w >>\n\n[- ' \
PATH=/usr/bin:/usr/sbin \
project_root="${project_root}" \
dir_rex="${dir_rex}" \
dir_logs="/${project_root}/logs" \
/rex_embedded/stage/rex/rex -v -c ${dir_rex}/x86_64/rex.config -p ${dir_rex}/x86_64/plans/stage3.plan
retVal=$?
echo "Rex exited with error code '$retVal'."

View File

@ -46,7 +46,10 @@ is_mounted ${T_SYSROOT}/proc && umount -l ${T_SYSROOT}/proc
# not a symlink on ubuntu # not a symlink on ubuntu
logprint "Unmounting ${T_SYSROOT}/dev/shm" logprint "Unmounting ${T_SYSROOT}/dev/shm"
ismounted ${T_SYSROOT}/dev/shm && umount -l {${T_SYSROOT}/dev/shm is_mounted ${T_SYSROOT}/dev/shm && umount -l ${T_SYSROOT}/dev/shm
logprint "Unmounting pyrois inside of chroot"
is_mounted ${T_SYSROOT}/rex_embedded && umount -l ${T_SYSROOT}/rex_embedded
echo echo
logprint "You can now safely delete the chroot." logprint "You can now safely delete the chroot."

View File

@ -0,0 +1,29 @@
#!/bin/bash
# Prepares sysroot ownership and perms for chrooting
# print to stdout, print to log
# the path where logs are written to
# note: LOGS_ROOT is sourced from environment
APPNAME="CHROOT PASSWD/GROUPS"
# ISO 8601 variation
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
# the file to log to
LOGFILE="${APPNAME}.log"
logprint() {
mkdir -p "${LOG_DIR}"
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
| tee -a "${LOG_DIR}/${LOGFILE}"
}
logprint "Installing initial users and groups to chroot..."
cp -f ${dir_configs}/etc_passwd ${T_SYSROOT}/etc/passwd
assert_zero $?
cp -f ${dir_configs}/etc_group ${T_SYSROOT}/etc/group
assert_zero $?

View File

@ -46,6 +46,11 @@ logprint "mounting proc filesystem from to chroot sysroot..."
is_mounted ${T_SYSROOT}/proc || mount -v -t proc proc ${T_SYSROOT}/proc is_mounted ${T_SYSROOT}/proc || mount -v -t proc proc ${T_SYSROOT}/proc
assert_zero $? assert_zero $?
logprint "mounting pyrois inside of chroot"
mkdir -p ${T_SYSROOT}/rex_embedded
is_mounted ${project_root} || mount -v --bind ${project_root} ${T_SYSROOT}/rex_embedded
assert_zero $?
# not a symlink on ubuntu # not a symlink on ubuntu
if [ -h ${T_SYSROOT}/dev/shm ]; then if [ -h ${T_SYSROOT}/dev/shm ]; then
mkdir -vp ${T_SYSROOT}/$(readlink ${T_SYSROOT})/dev/shm mkdir -vp ${T_SYSROOT}/$(readlink ${T_SYSROOT})/dev/shm

View File

@ -0,0 +1,48 @@
HORSE=$(cat <<'EOH'
⠀⠀⠀⠀⠀⠀⢀⠀⠀⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠘⣦⡀⠘⣆⠈⠛⠻⣗⠶⣶⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠈⣿⠀⠈⠳⠄⠀⠈⠙⠶⣍⡻⢿⣷⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣰⣿⣧⠀⠀⠀⠀⠀⠀⠀⠈⠻⣮⡹⣿⣿⣷⣦⣄⣀⠀⠀⢀⣸⠃⠀⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢠⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣮⢿⣿⣿⣿⣿⣿⣿⣿⠟⠀⢰⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⢀⣾⣿⠀⠀⠀⠀⠀⠀⠀⣷⠀⢷⠀⠀⠀⠙⢷⣿⣿⣿⣿⣟⣋⣀⣤⣴⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢀⣼⢿⣿⡀⠀⠀⢀⣀⣴⣾⡟⠀⠈⣇⠀⠀⠀⠈⢻⡙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣼⡏⠸⣿⣿⣶⣾⣿⡿⠟⠋⠀⠀⠀⢹⡆⠀⠀⠀⠀⠹⡽⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⣰⣿⠀⠀⠀⣀⡿⠛⠉⠀⠀⢿⠀⠀⠀⠘⣿⡄⠀⠀⠀⠀⠑⢹⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣷⣶⣾⠏⠀⠀⠀⠀⠀⠘⣇⠀⠀⠀⢻⡇⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⡿⠃⠀⣠⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠈⠙⠿⠿⠋⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⠀⢸⣷⠀⠀⠀⠀⠀⢀⠀⠹⣿⣿⣿⣿⣷⣶⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠀⠀⠀⢸⣿⠀⠀⠀⠀⢀⡞⠀⠀⠈⠛⠻⠿⠿⠯⠥⠤⢄⣀⣀⢀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⠀⠀⠀⢸⡇⠀⠀⠀⢀⡼⠃⠀⠀⠀⠀⠀⣄⠀⠀⠀⠀⠀⠀⠈⠙⠂⠙⠳⢤⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠇⠀⠀⠀⡾⠁⠀⠀⣠⡿⠃⠀⠀⠀⠀⠀⠀⠸⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⠀⠀⠀⡸⠃⠀⢀⣴⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣷⣶⣶⣦⣤⣀⡀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⠇⠀⠀⠀⠃⢀⣴⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⣿⣿⣶⣤⡀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠏⠀⠀⠀⠀⣰⡟⠁⠀⠀⠀ ⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣧⠙⠻⣿⣿⣿⣿⣿⣿⣦⡀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⢀⡖⢰⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠟⠀⠀⠀⢸⣿⠀⠀⠈⢿⣿⣿⣿⣿⣿⡿
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⡇⠀⠀⣼⠁⠼⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠋⠀⠀⠀⠀⣼⡇⠀⠀⣠⣾⣿⣿⣿⣿⠟⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡄⠘⣇⠀⠀⢻⡄⢠⡄⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⡴⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⠟⠁⠀⠀⠀⢀⣼⠏⠀⣠⣾⣿⣿⡿⣿⡿⠁⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⠁⠀⠘⠂⠀⠀⢳⠀⢳⡀⠀⠀⠀⠀⠀⠀⢀⡼⠁⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣾⣿⠃⠀⠀⠀⠀⣠⣾⠃⣠⣾⣿⣿⠿⠋⢰⡟⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢠⣿⠃⠀⠀⠀⢀⣀⡴⠞⠙⠲⣷⡄⠀⠀⠀⠀⢠⡾⠁⠀⠀⠀⢀⣀⣠⣤⣶⠿⠟⠋⠀⡾⠀⠀⠀⢀⣴⠟⠁⢠⡟⢱⡿⠃⠀⠀⠸⣇⡀⠀⠀⠀
⠀⠀⠀⠀⠀⢀⡴⠟⠁⠀⣀⡤⠖⠋⠁⠀⠀⠀⠀⣸⠇⠀⠀⠀⣤⠟⠑⠋⠉⣿⠋⠉⠉⠉⠁⣠⠞⠀⠀⠀⡇⠀⠀⢠⡿⠋⠀⠀⠈⠁⡿⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀
⠀⠀⠀⢀⣾⣏⣤⣶⡾⠛⠉⠀⠀⠀⠀⠀⠀⢀⡼⠃⠀⠀⣠⠞⠁⠀⠀⠀⠀⣿⠀⠀⠀⢀⡼⠃⠀⠀⠀⢸⠇⠀⣰⠟⠀⠀⠀⠀⠀⠐⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⣿⣿⡿⠛⠁⠀⠀⠀⠀⠀⠀⠀⢀⣴⠏⠀⠀⣠⠞⠁⠀⠀⠀⠀⠀⠀⣿⠀⠀⢀⡾⠃⠀⠀⠀⢀⡞⠀⣼⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⣼⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⣿⣶⣶⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⣾⠇⠀⠀⠀⢀⣾⣣⣾⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⢠⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠀⢠⡟⠀⠀⠀⢀⣾⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⡄⢀⣀⡀⠀⠀⠀⠀⠀⠀⢸⡇⠀⣾⠇⠀⠀⣰⣿⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢸⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⣾⠀⣰⠟⠀⢀⣼⣿⣿⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢸⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⠿⠿⠿⠿⠿⠃⠀⠀⠀⢸⣿⣶⠏⢀⣴⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢸⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⣿⠃⢠⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⢃⣴⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠈⠛⠛⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣧⣾⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⡟⢸⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⠁⠀⠀⠈⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⠿⠿⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
EOH
)
echo
echo
echo -e "\e[31m$HORSE\e[0m"
echo
echo "Welcome to Pyrois, the build system for Dark Horse Linux."
echo
echo "Stage 3, Inside-Out Linux"
echo

View File

@ -0,0 +1,71 @@
set -a
# We now do paths relative to / since we are INSIDE $T_SYSROOT
TERM=xterm-256color
COLORTERM=truecolor
LC_ALL=C
function echofail() {
echo
echo "FAILED: $1"
echo
exit 1
}
rex_dir="/rex_embedded"
# keeps talking about T_SYSROOT as $LFS
# wants $LFS path to be a mount
# needs to be set for any user including root
#2.6
# sourced from project_config
T_SYSROOT="/"
LFS=${T_SYSROOT}
# 4.3 we skip user and group creation, it's expected to be done before
# you start if you want a different user than you're running as
# == after that, configure the rex unit for dir creation to use that user
if [ "$(id -u)" -ne 0 ]; then
echo "Not running as root."
fi
# 4.4
# The set +h command turns off bash's hash function, which affects caching of paths for executables
set +h
# ensures newly created files and directories are only writable by their owner, but are readable and executable by anyone
umask 022
# sets a comptabile machine name description for use when building crosstools that isn't going to be what the host system is using
# $LFS_TGT is what LFS uses for this
T_TRIPLET=x86_64-dhl-linux-gnu
# prevents some configure scripts from looking in the wrong place for config.site
CONFIG_SITE=/usr/share/config.site
# 4.5
MAKEFLAGS="-j$(nproc)"
# where the cross-compiler gets installed ($LFS/tools)
CROSSTOOLS_DIR=/xtools
TEMP_STAGE_DIR=/source_stage
# from project_config
SOURCES_DIR=/rex_embedded/stage/sources
PATCHES_DIR=/rex_embedded/stage/patches
LOGS_ROOT=/rex_embedded/logs
# fail the unit in the event of a non-zero value passed
# used primarily to check exit codes on previous commands
# also a great convenient place to add in a "press any key to continue"
assert_zero() {
if [[ "$1" -eq 0 ]]; then
return
else
exit $1
fi
}
ARCHLIB_DIR=/lib64
PATH=/usr/bin:/usr/sbin

View File

@ -2,7 +2,7 @@
"plan": "plan":
[ [
{ {
"name": "welcome", "name": "welcome 2",
"dependencies": [ null ], "dependencies": [ null ],
"comment": "greet the user" "comment": "greet the user"
}, },
@ -100,6 +100,11 @@
"name": "preparing virtual kernel file systems", "name": "preparing virtual kernel file systems",
"dependencies": [ null ], "dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 7.3 (chroot)" "comment": "LFS 11.3-systemd-rc1 Ch. 7.3 (chroot)"
},
{
"name": "populate initial users and groups",
"dependencies": [ null ],
"comment": "OOO: LFS 11.3-systemd-rc1 Ch. 7.6 (chroot)"
} }
] ]
} }

View File

@ -0,0 +1,10 @@
{
"plan":
[
{
"name": "welcome 3",
"dependencies": [ null ],
"comment": "greet the user"
}
]
}

View File

@ -1,7 +1,7 @@
{ {
"units": [ "units": [
{ {
"name": "welcome", "name": "welcome 2",
"target": "components/stage2/welcome.bash", "target": "components/stage2/welcome.bash",
"is_shell_command": true, "is_shell_command": true,
"shell_definition": "bash", "shell_definition": "bash",
@ -359,6 +359,24 @@
"group": "root", "group": "root",
"supply_environment": true, "supply_environment": true,
"environment": "environments/stage2.env.bash" "environment": "environments/stage2.env.bash"
},
{
"name": "populate initial users and groups",
"target": "components/stage2/populate_ug.bash",
"is_shell_command": true,
"shell_definition": "bash",
"force_pty": true,
"set_working_directory": false,
"working_directory": "",
"rectify": false,
"rectifier": "",
"active": true,
"required": true,
"set_user_context": true,
"user": "root",
"group": "root",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
} }
] ]
} }

View File

@ -0,0 +1,22 @@
{
"units": [
{
"name": "welcome 3",
"target": "components/stage3/welcome.bash",
"is_shell_command": true,
"shell_definition": "bash",
"force_pty": true,
"set_working_directory": false,
"working_directory": "",
"rectify": false,
"rectifier": "",
"active": true,
"required": true,
"set_user_context": true,
"user": "root",
"group": "root",
"supply_environment": true,
"environment": "environments/stage3.env.bash"
}
]
}