diff options
Diffstat (limited to 'essential.sh')
-rw-r--r-- | essential.sh | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/essential.sh b/essential.sh index 3384917..dc34676 100644 --- a/essential.sh +++ b/essential.sh @@ -1,70 +1,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 +#!/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
|