summaryrefslogtreecommitdiff
path: root/install_crosshurd
blob: 198a60824ac104b40dc995b69d615df3ef96f615 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
#!/bin/sh

set -x

{ [ x"$MACHINE" != x ] \
  || read MACHINE; } &&
. machines/"$MACHINE" &&

tmpdir=$(mktemp -d) &&

TARGET_MOUNT=$tmpdir/target &&
mkdir "$TARGET_MOUNT" &&

{ [ x"$TARGET" != x ] \
  || read TARGET; } &&

# See <http://bugs.debian.org/471528>.
sudo mkfs.ext2 -F -o hurd -I 128 -b 4096 "$TARGET" &&

sudo mount -t ext2 "$TARGET" "$TARGET_MOUNT" &&

case $SITE in
  bddebian)
    # flubber
    http_proxy=http://192.168.10.50:8123/;;
esac &&

if [ x${http_proxy+set} = xset ] \
   && [ x${no_use_http_proxy+set} != xset ]; then
  env_http_proxy="env http_proxy=$http_proxy"
fi &&
sudo \
  $env_http_proxy \
  /usr/share/crosshurd/makehurddir.sh "$TARGET_MOUNT" i486 gnu &&
unset env_http_proxy &&

# We have our own /etc/fstab.
sudo sed -i \
  -e s%/etc/fstab%/dev/null%g \
  "$TARGET_MOUNT"/native-install &&

sudo dd of="$TARGET_MOUNT"/install <<EOF_INSTALL &&
#!/bin/sh

set -x &&

export TERM &&
TERM=mach &&

umask 022 &&

fsysopts / --writable &&

# Needed for dpkg.
{ test -c /servers/socket/1 \
  || settrans -c /servers/socket/1 /hurd/pflocal; } &&

# Do not configure debconf, only unpack it.
dpkg --unpack --force-depends /var/cache/apt/archives/debconf_*.deb &&

debconf-set-selections <<EOS &&
ca-certificates	ca-certificates/trust_new_crts	select	yes
adduser	adduser/homedir-permission	boolean	true
dash	dash/sh	boolean	true
debconf	debconf/frontend	select	Dialog
debconf	debconf/priority	select	medium
tcpd	tcpd/paranoid-mode	boolean	false
libpam-runtime	libpam-runtime/override	boolean	false
libpam-runtime	libpam-runtime/profiles	multiselect	unix, gnome-keyring, consolekit
libpam-runtime	libpam-runtime/conflicts	error	
EOS

( cd /dev &&
  MAKEDEV $DISK_ROOT $DISK_SWAP $DISK_DATA $DISK_DATA_LOCAL $DISK_VAR
) &&

# Already enable swap up here.
mkswap.linux -v1 /dev/$DISK_SWAP &&
# Might be running already.
{ /hurd/mach-defpager || :; } &&
swapon -a &&

# Work around »Existing system found, exitting.«.
{ test -d /proc/ && rmdir /proc || :; } &&

./native-install &&

passwd \
  -d root &&

if test -r /dev/random; then :; else
  cp /hurd/ext2fs.static /dev/random
fi &&
if test -r /dev/urandom; then :; else
  cp /hurd/ufs.static /dev/urandom
fi &&

settrans \
  -fcgap \
  /servers/socket/2 \
  /hurd/pfinet \
  -i eth0 -a $NET_IP_ADDRESS -g $NET_IP_GATEWAY -m $NET_IP_MASK
EOF_INSTALL

sudo chmod +x "$TARGET_MOUNT"/install &&

sudo dd of="$TARGET_MOUNT"/install-packages <<EOF_INSTALL_PACKAGES &&
#!/bin/sh

set -x

apt-get update &&

apt-get --purge -y --force-yes dist-upgrade &&


# Pre-configure some packages.

# For debconf-get-selections.
apt-get -y --force-yes install debconf-utils &&

debconf-get-selections > /tmp/debconf-selections &&

while read p q t v; do
  if grep -q '^[^	]*	'"\$q"'	' < /tmp/debconf-selections; then :; else
    debconf-set-selections <<EOS
\$p	\$q	\$t	\$v
EOS
  fi
done <<EOS &&
cvs	cvs/badrepositories	select	ignore
cvs	cvs/pserver	boolean	false
cvs	cvs/repositories	string	/var/lib/cvs
libpaper1	libpaper/defaultpaper	select	a4
locales	locales/default_environment_locale	select	None
locales	locales/locales_to_be_generated	multiselect	en_US.UTF-8 UTF-8
man-db	man-db/install-setuid	boolean	false
nullmailer	nullmailer/adminaddr	string	thomas@schwinge.name
nullmailer	nullmailer/relayhost	string	schwinge.homeip.net qmqp
nullmailer	shared/mailname	string	$QUALIFIED_HOSTNAME
popularity-contest	popularity-contest/participate	boolean	true
tex-common	tex-common/managecache	boolean	false
x-ttcidfont-conf	x-ttcidfont-conf/tt_backend	select	freetype
EOS


# Install packages.

packages='
  autoconf
  autoconf-doc
  automake
  bash-doc
  binutils-doc
  build-essential
  dpkg-dev
  libtool
  libtool-doc
  make-doc
  g++-4.4
  gcc-4.4-doc
  cpp-4.4-doc
  gdb
  gdb-doc
  hurd-dbg
  libc0.3-dbg
  glibc-doc
  glibc-doc-reference
  manpages-dev
  mig
  bzr bzr-doc
  cvs
  darcs
  git
  subversion
  gnu-standards
  bc
  bzip2
  devscripts
  joe
  fakeroot
  file
  info
  less
  locales
  lynx
  man
  manpages
  netcat
  nullmailer
  pkg-config
  popularity-contest
  rsync
  screen
  sudo
  ssh
  texinfo
  time
  w3m
  wdiff
  wget
' &&

# dsyslog doesn't install / configure properly, but nullmailer (weakly) depends
# on it.
packages=\$packages'
  dsyslog-
' &&

# System instability issues.
packages=\$packages'
  system-log-daemon-
  syslog-ng-
  socklog-run-
  inetutils-syslogd-
  dsyslog-
' &&

# emacs (emacs23) isn't installable yet.
# In fact, no emacs version's packages are installable at the moment...
#packages=\$packages'
#  emacs-
#  emacs22
#' &&

apt-get -y --force-yes install \$packages &&


apt-get build-dep \
  libc0.3 \
  gdb \
  gnumach \
  hurd &&


# Configure packages.

if grep '^%sudo' /etc/sudoers; then :; else
  cat >> /etc/sudoers
fi <<"EOS" &&

%sudo	ALL=(ALL) ALL
EOS

# TODO: should soon be fixed; patch has been posted to bug-hurd IIRC.
{ ed /etc/ssh/sshd_config || :; } <<"EOC"
/^UsePrivilegeSeparation/
s/yes/no/
w
EOC
EOF_INSTALL_PACKAGES

sudo chmod +x "$TARGET_MOUNT"/install-packages &&


sudo dd of="$TARGET_MOUNT"/etc/hostname <<EOF &&
$QUALIFIED_HOSTNAME
EOF

h=$(expr "$QUALIFIED_HOSTNAME" : '\([^\.]*\)') &&
sudo dd of="$TARGET_MOUNT"/etc/hosts <<EOF &&
$NET_IP_ADDRESS	$QUALIFIED_HOSTNAME $h 

127.0.0.1	localhost

::1	localhost ip6-localhost ip6-loopback
fe00::0	ip6-localnet
ff00::0	ip6-mcastprefix
ff02::1	ip6-allnodes
ff02::2	ip6-allrouters
ff02::3	ip6-allhosts
EOF
unset h &&


sudo dd of="$TARGET_MOUNT"/etc/fstab <<EOF &&
/dev/$DISK_ROOT / ext2 rw 1 1
/dev/$DISK_SWAP none swap sw 0 0
EOF
if [ x${DISK_DATA+set} = xset ]; then
  sudo mkdir -p "$TARGET_MOUNT"/media/data &&
  sudo dd of="$TARGET_MOUNT"/etc/fstab conv=notrunc oflag=append <<EOF
/dev/$DISK_DATA /media/data ext2 rw 1 2
EOF
fi &&
if [ x${DISK_DATA_LOCAL+set} = xset ]; then
  sudo mkdir -p "$TARGET_MOUNT"/media/data-local &&
  sudo dd of="$TARGET_MOUNT"/etc/fstab conv=notrunc oflag=append <<EOF
/dev/$DISK_DATA_LOCAL /media/data-local ext2 rw 1 2
EOF
fi &&
if [ x${DISK_VAR+set} = xset ]; then
  sudo mkdir -p "$TARGET_MOUNT"/media/var &&
  sudo dd of="$TARGET_MOUNT"/etc/fstab conv=notrunc oflag=append <<EOF
/dev/$DISK_VAR /media/var ext2 rw 1 2
EOF
fi &&


sudo ln -sf /usr/share/zoneinfo/Etc/UTC "$TARGET_MOUNT"/etc/localtime &&


if [ x${http_proxy+set} = xset ]; then
  sudo dd of="$TARGET_MOUNT"/etc/apt/apt.conf <<EOF
Acquire::http::Proxy "$http_proxy";
EOF
fi &&


case $SITE in
  bddebian)
    mirror=.us;;
esac &&
sudo dd of="$TARGET_MOUNT"/etc/apt/sources.list <<EOF &&
deb http://ftp$mirror.debian.org/debian unstable main non-free
deb-src http://ftp$mirror.debian.org/debian unstable main non-free
#deb http://ftp$mirror.debian.org/debian experimental main non-free
#deb-src http://ftp$mirror.debian.org/debian experimental main non-free

deb http://ftp.debian-ports.org/debian unreleased main
deb-src http://ftp.debian-ports.org/debian unreleased main
EOF
unset mirror &&


: sudo umount "$TARGET_MOUNT" &&
: sudo rm -rf "$tmpdir"