blob: dc34676f9c9d819b1733e0a1c3f652d4ab9f7082 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#!/bin/bash
set -e
pushd "${LFS}" >/dev/null || exit 1
printf "%b" "${GRN}Creating essential files and symbolic links${RST}... "
if [[ -f "sources/essential" ]]; then
printf "%b" "\n ${IGRN}Essential files and symbolic links already created${RST}\n"
else {
sudo ln -sfv proc/self/mounts etc/mtab
sudo bash -c 'echo "127.0.0.1 localhost $(hostname)" > etc/hosts'
sudo bash -c 'cat > 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
EOF'
sudo bash -c 'cat > 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:
EOF'
sudo bash -c 'echo "tester:x:"'"${TESTERUID}"'":101::/home/tester:/bin/bash" >> etc/passwd'
sudo bash -c 'echo "tester:x:101:" >> etc/group'
sudo install -v -o "${TESTERUID}" -d home/tester
sudo touch var/log/btmp
sudo touch var/log/lastlog
sudo touch var/log/faillog
sudo touch var/log/tmp
sudo chgrp utmp var/log/lastlog
sudo chmod -v 664 var/log/lastlog
sudo chmod -v 600 var/log/btmp
} >"${LFS}"/sources/log/essential.log 2>&1
sudo touch sources/essential
success "OK"
fi
popd >/dev/null || exit 1
|