Mercurial > hg > aboriginal
comparison sources/native-builds/gentoo-bootstrap/files/init @ 1251:204238871b7c
Shuffle gentoo bootstrapping into a single directory (with files and patches subdirectories under that).
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 24 Sep 2010 08:36:21 -0500 |
parents | sources/native-builds/gentoo-stage1-files/init@b84cf2f3ef53 |
children |
comparison
equal
deleted
inserted
replaced
1250:be39ef99f183 | 1251:204238871b7c |
---|---|
1 #!/bin/bash | |
2 | |
3 upload_result() | |
4 { | |
5 ftpput $FTP_SERVER -P $FTP_PORT "$1-$HOST" "$1" | |
6 } | |
7 | |
8 set_titlebar() | |
9 { | |
10 echo -en "\033]2;($HOST) $1\007" | |
11 echo === "$1" | |
12 } | |
13 | |
14 dotprogress() | |
15 { | |
16 while read i; do echo -n .; done; echo | |
17 } | |
18 | |
19 echo Started second stage init | |
20 | |
21 # If the root filesystem is read only (squashfs), copy it into a new chroot | |
22 # directory under /home and restart in there. | |
23 | |
24 touch /.iswriteable 2>/dev/null | |
25 rm /.iswriteable 2>/dev/null | |
26 if [ $? -ne 0 ] | |
27 then | |
28 set_titlebar "writeable chroot" | |
29 mkdir gentoo-stage1 | |
30 find / -xdev | cpio -m -v -p /home/gentoo-stage1 | dotprogress | |
31 | |
32 echo Restarting init script in chroot | |
33 for i in mnt proc sys dev; do mount --bind /$i gentoo-stage1/$i; done | |
34 chroot gentoo-stage1 /mnt/init | |
35 RC=$? | |
36 for i in mnt proc sys dev; do umount gentoo-stage1/$i; done | |
37 | |
38 | |
39 if [ $RC -eq 0 ] | |
40 then | |
41 set_titlebar "upload tarball" | |
42 tar czvf gentoo-stage1.tar.gz gentoo-stage1 | dotprogress && | |
43 upload_result gentoo-stage1.tar.gz | |
44 fi | |
45 | |
46 sync | |
47 exit | |
48 fi | |
49 | |
50 set_titlebar "zlib" && cp -sfR /mnt/zlib zlib && cd zlib && | |
51 | |
52 # 1.2.5 accidentally shipped the Makefile, then configure tries to | |
53 # modify it in place. | |
54 rm Makefile && | |
55 ./configure --prefix=/usr && | |
56 make -j $CPUS && | |
57 make install && | |
58 | |
59 cd .. && rm -rf zlib || exit 1 | |
60 | |
61 set_titlebar "ncurses" && cp -sfR /mnt/ncurses ncurses && cd ncurses && | |
62 | |
63 ./configure --without-cxx-binding --with-shared && | |
64 make -j $CPUS && | |
65 make install && | |
66 | |
67 cd .. && rm -rf ncurses || exit 1 | |
68 | |
69 set_titlebar "Python" && cp -sfR /mnt/Python python && cd python && | |
70 | |
71 ./configure --prefix=/usr && | |
72 make -j $CPUS && | |
73 make install && | |
74 | |
75 cd .. && rm -rf python || exit 1 | |
76 | |
77 # Portage uses bash ~= regex matches, which were introduced in bash 3. | |
78 | |
79 set_titlebar "Bash3" && cp -sfR /mnt/bash bash && cd bash && | |
80 | |
81 ./configure --enable-cond-regexp --disable-nls --prefix=/usr && | |
82 make -j $CPUS && | |
83 make install && | |
84 | |
85 cd .. && rm -rf bash || exit 1 | |
86 | |
87 set_titlebar "rsync" && cp -sfR /mnt/rsync rsync && cd rsync && | |
88 | |
89 ./configure --prefix=/usr && | |
90 # Break link and touch file, otherwise ./configure tries to recreate it | |
91 # which requires perl. | |
92 cat proto.h-tstamp > proto.h.new && | |
93 mv -f proto.h.new proto.h-tstamp && | |
94 make -j $CPUS && | |
95 make install && | |
96 | |
97 cd .. && rm -rf rsync || exit 1 | |
98 | |
99 # Need a patch with --dry-run to make portage happy | |
100 | |
101 set_titlebar "patch" && cp -sfR /mnt/patch patch && cd patch && | |
102 | |
103 ./configure --prefix=/usr && | |
104 make -j $CPUS && | |
105 make install && | |
106 | |
107 cd .. && rm -rf patch || exit 1 | |
108 | |
109 set_titlebar "file" && cp -sfR /mnt/file file && cd file && | |
110 | |
111 ./configure --prefix=/usr && | |
112 make -j $CPUS && | |
113 make install && | |
114 | |
115 cd .. && rm -rf file || exit 1 | |
116 | |
117 set_titlebar "portage" && cd /mnt/portage && | |
118 | |
119 echo portage:x:250:250:portage:/var/tmp/portage:/bin/false >> /etc/passwd && | |
120 echo portage::250:portage >> /etc/group && | |
121 mkdir -p /usr/lib/portage && | |
122 cp -a bin pym /usr/lib/portage/ && | |
123 echo /usr/lib/portage/pym > /usr/lib/python2.6/site-packages/gentoo.pth || | |
124 exit 1 | |
125 | |
126 for i in archive-conf dispatch-conf emaint emerge-webrsync env-update \ | |
127 etc-update fixpackages quickpkg regenworld | |
128 do | |
129 ln /usr/lib/portage/bin/$i /usr/sbin/$i || exit 1 | |
130 done | |
131 | |
132 for i in ebuild egencache emerge portageq repoman | |
133 do | |
134 ln /usr/lib/portage/bin/$i /usr/bin/$i || exit 1 | |
135 done | |
136 | |
137 cp cnf/make.globals /etc/ && | |
138 cp man/*.1 /usr/man/man1 && | |
139 cp man/*.5 /usr/man/man5 && | |
140 mv /usr/bin/emerge /usr/bin/emerge.real && | |
141 cp /mnt/emerge_wrapper.sh /usr/bin/emerge && | |
142 | |
143 mkdir -p /var/log && | |
144 mkdir -p /etc/portage/profile && | |
145 cp /mnt/package.provided /etc/portage/profile && | |
146 | |
147 cd /home || exit 1 |