comparison sources/native/sbin/init.sh @ 790:188a182b1a7f

Remove some leftover /tools residue.
author Rob Landley <rob@landley.net>
date Mon, 06 Jul 2009 05:26:21 -0500
parents db06a8c1bfed
children 18fa21056b01
comparison
equal deleted inserted replaced
789:dde700454fbe 790:188a182b1a7f
1 #!/bin/sh 1 #!/bin/sh
2
3 # If you're doing a Linux From Scratch build, the /tools directory is
4 # sufficient. (Start by installing kernel headers and building a C library.)
5 2
6 # Otherwise, building source packages wants things like /bin/bash and 3 # Otherwise, building source packages wants things like /bin/bash and
7 # running the results wants /lib/ld-uClibc.so.0, so set up some directories 4 # running the results wants /lib/ld-uClibc.so.0, so set up some directories
8 # and symlinks to let you easily compile source packages. 5 # and symlinks to let you easily compile source packages.
9 6
10 # Add /tools to $PATH if it's not there
11
12 if [ -d tools/bin ] && [ -z "$(echo :$PATH | tools/bin/grep :/tools/bin)" ]
13 then
14 [ -z "$PATH" ] && PATH=/tools/bin || PATH="$PATH":/tools/bin
15 export PATH
16 fi
17 export HOME=/home 7 export HOME=/home
18
19 # Create some temporary directories at the root level
20 mkdir -p proc sys dev etc tmp home
21 [ ! -e bin ] && ln -s tools/bin bin
22 [ ! -e lib ] && ln -s tools/lib lib
23 [ ! -e usr ] && ln -s tools usr
24 8
25 # Populate /dev 9 # Populate /dev
26 mountpoint -q sys || mount -t sysfs sys sys 10 mountpoint -q sys || mount -t sysfs sys sys
27 mountpoint -q dev || mount -t tmpfs -o noatime dev dev 11 mountpoint -q dev || mount -t tmpfs -o noatime dev dev
28 mdev -s 12 mdev -s
29 13
30 # Mount /proc is there 14 # Make sure /proc is there
31 mountpoint -q proc || mount -t proc proc proc 15 mountpoint -q proc || mount -t proc proc proc
32 16
33 # If we're running under qemu, do some more setup 17 # If we're running under qemu, do some more setup
34 if [ $$ -eq 1 ] 18 if [ $$ -eq 1 ]
35 then 19 then
50 if [ ! -z "$HOMEDEV" ] 34 if [ ! -z "$HOMEDEV" ]
51 then 35 then
52 mount -o noatime $HOMEDEV /home 36 mount -o noatime $HOMEDEV /home
53 fi 37 fi
54 38
55 mount -o noatime -t tmpfs /tmp /tmp 39 mount -t tmpfs /tmp /tmp
56 40
57 echo Type exit when done. 41 echo Type exit when done.
58 exec /tools/bin/oneit -c /dev/"$(dmesg | sed -n '/^Kernel command line:/s@.* console=\(/dev/\)*\([^ ]*\).*@\2@p')" /tools/bin/ash 42 exec /bin/oneit -c /dev/"$(dmesg | sed -n '/^Kernel command line:/s@.* console=\(/dev/\)*\([^ ]*\).*@\2@p')" /bin/ash
59 43
60 # If we're not PID 1, it's probably a chroot. 44 # If we're not PID 1, it's probably a chroot.
61 else 45 else
62 echo "nameserver 4.2.2.1" > /etc/resolv.conf 46 echo "nameserver 4.2.2.1" > /etc/resolv.conf
63 47
64 # Switch to a shell with command history. 48 # Switch to a shell with command history.
65 49
66 echo Type exit when done. 50 echo Type exit when done.
67 /tools/bin/ash 51 /bin/ash
68 cd / 52 cd /
69 umount ./dev 53 umount ./dev
70 umount ./home 54 umount ./home
71 umount ./sys 55 umount ./sys
72 umount ./proc 56 umount ./proc