File: makehurddir.sh

package info (click to toggle)
crosshurd 1.7.57
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 200 kB
  • sloc: sh: 542; makefile: 2
file content (187 lines) | stat: -rwxr-xr-x 5,267 bytes parent folder | download
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
#!/bin/bash

if test "$#" != "4" ; then
  echo Usage: `basename $0` TARGET DEB_TARGET_GNU_CPU DEB_TARGET_GNU_SYSTEM RELEASE
  exit 1
fi

STARTDIR=`pwd`
TARGET=`readlink -f $1`
DEB_TARGET_GNU_CPU=$2
DEB_TARGET_GNU_SYSTEM=$3
RELEASE=$4

if [ x"$TARGET" = x ]; then
  echo "Refused to overwrite inexistent/empty TARGET."
  exit 1
fi

. /usr/share/crosshurd/functions

debs=`cat /etc/crosshurd/packages/{common,$DEB_TARGET_GNU_SYSTEM,$DEB_TARGET_GNU_SYSTEM-$DEB_TARGET_GNU_CPU} 2> /dev/null | grep -v '^#'`

target_setup 

setup_etc 

apt_setup

if [ $retval != 0 ]; then
  echo "Failed to download the Packages files."
  exit 1
fi

apt_fetch_deb $debs

if [ $retval != 0 ]; then
  echo "Failed to download the .deb's."
  exit 1
fi

extract `(cd $TARGET/var/cache/apt/archives && \
	for i in *.deb; do dpkg-deb --field $i Priority | grep ^required \
	&& echo $i; done) | cut -d _ -f 1`

if [ -e $TARGET/var/cache/apt/archives/gnumach-image-1.8-486_* ] ; then
        extract gnumach-image-1.8-486
	# place symlink for compatibility with update-grub (/etc/grub.d/30_os-prober)
	ln -s gnumach-1.8-486.gz "$TARGET/boot/gnumach.gz"
fi

if [ -e $TARGET/var/cache/apt/archives/libbz2-1.0_* ] ; then
        extract libbz2-1.0
fi

if [ -e $TARGET/var/cache/apt/archives/libparted2_* ] ; then
        extract libparted2
fi

x_feign_install dpkg
if [ "$DEB_TARGET_GNU_SYSTEM" = "gnu" ] ; then
	x_feign_install hurd

	##############################
	# Prepare initial translator.
	##############################
	# FIXME: Should be done in the Hurd preinst.
	install -d -m 755 -o root -g root $TARGET/servers/socket
	touch $TARGET/servers/exec
	
	#####################################
	# Make sure libexec/runsystem exists
	#####################################
	# Explanation: It is managed by update-alternatives.
	#
	if [ ! -e $TARGET/libexec/runsystem -a -e $TARGET/libexec/runsystem.gnu ] ; then
		cp $TARGET/libexec/runsystem.gnu $TARGET/libexec/runsystem
	fi
	#####################################
	# create passive translators if the 
	# host system is able to
	#####################################
	gnu_setup_passive_translators
fi

cp /usr/share/crosshurd/native-install $TARGET

##################
# Setup intial /etc/passwd
##################
echo "root:x:0:0:root:/root:/bin/bash" > $TARGET/etc/passwd

##################
# Setup hostname
##################
echo "I: Preparing /etc/hostname using `hostname`..."
echo `hostname` > $TARGET/etc/hostname

###################
# Setup /etc/hosts
###################
echo "I: Preparing /etc/hosts..."

echo "127.0.0.1		localhost `hostname`" > $TARGET/etc/hosts

#########################
# Setup /etc/resolv.conf
#########################
echo "I: Preparing /etc/resolv.conf..."

if [ -e /etc/resolv.conf ] ; then
	echo Copying this machine\'s resolv.conf to the new partition.
	echo If this is not correct, please edit.
	cp /etc/resolv.conf $TARGET/etc/resolv.conf
else
	echo Setting up bogus file, PLEASE EDIT.
	echo "domain ${domainname}" > $TARGET/etc/resolv.conf
	echo "search localnet" >> $TARGET/etc/resolv.conf
	echo "nameserver WWW.XXX.YYY.ZZZ" >> $TARGET/etc/resolv.conf
fi

# more possibly interesting hooks from Marcus' cross-hurd follow
# we don't use them for now.

exit 0

#####################################
# Make sure boot/servers.boot exists
#####################################
# Explanation: It is a conf file in some versions of Hurd.

echo
echo "Latest Hurd packages declare boot/servers.boot as a conffile, let me check."

if [ -e ${dest}/boot/servers.boot.dpkg-new ] ; then
	echo "Yes, found it. I will copy boot/servers.boot.dpkg-new to boot/servers.boot"
	cp ${dest}/boot/servers.boot.dpkg-new ${dest}/boot/servers.boot
else
	echo "Nope, not your version. Please make sure that you check boot/servers.boot after"
        echo "your next update of the hurd package, because your changes will be overriden."
fi

#########################
# Make sure sh exists
#########################
# Explanation: Thorsten did a strange bash NMU.
if [ ! -e ${dest}/bin/sh ] ; then
	echo "Creating symlink /bin/sh."
	ln -s bash ${dest}/bin/sh
fi

############################
# Move perl in proper place
############################
# Explanation: Latest glibc package needs perl (and awk) to configure!

if [ ! -e ${dest}/usr/bin/perl ] ; then
	if [ -e ${dest}/usr/bin/perl.dist ] ; then
		echo
		echo "Moving perl into place."
		mv ${dest}/usr/bin/perl.dist ${dest}/usr/bin/perl
	else
		if [ -e ${dest}/usr/bin/perl-5.005.dist ] ; then
		echo
		echo "Found versioned perl."
		# We only copy it here so the postinst does the right thing.
		# A mv or ln won't work!
		cp ${dest}/usr/bin/perl-5.005.dist ${dest}/usr/bin/perl
		else
			echo
			echo "Warning, I could not find perl!"
		fi
	fi
fi

########################################################
# make some essential directories for configure of dpkg
########################################################
# FIX: In sysvutils, together with split-init
if [ ! -e ${dest}/etc/rc0.d ] ; then
        echo
        echo "Making etc/rc?.d directories for dpkg."
        for nr in 0 1 2 3 4 5 6 S
        do
                install -d -m 755 -o root -g root ${dest}/etc/rc${nr}.d
        done
        install -d -m 755 -o root -g root ${dest}/etc/rc.boot
fi