summaryrefslogtreecommitdiff
path: root/src/scripts/23net.sh
blob: 0b571efd50a0d6647e22565830914b63b6bfa12b (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
#!/bin/sh

# make-live - utility to build Debian Live systems
#
# Copyright (C) 2006 Daniel Baumann <daniel@debian.org>
# Copyright (C) 2006 Marco Amadori <marco.amadori@gmail.com>
#
# make-live comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
# This is free software, and you are welcome to redistribute it
# under certain conditions; see COPYING for details.

Net ()
{
	if [ ! -f "${LIVE_ROOT}"/.stage/image_binary ]
	then
		mkdir -p "${LIVE_ROOT}"/binary/casper
		cp -r "${LIVE_TEMPLATES}"/common/* "${LIVE_ROOT}"/binary
		mv "${LIVE_ROOT}"/filesystem.manifest* "${LIVE_ROOT}"/binary/casper

		# Installing smbfs
		Chroot_exec "apt-get install --yes smbfs"

		if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
		then
			if [ ! -d "${LIVE_CHROOT}"/etc/initramfs-tools ]
			then 
				mkdir "${LIVE_CHROOT}"/etc/initramfs-tools
			fi
		
			# Configuring initramfs for NFS
cat >> "${LIVE_CHROOT}"/etc/initramfs-tools/initramfs.conf << EOF
MODULES=netboot
BOOT=nfs
NFSROOT=auto
EOF
			Chroot_exec "update-initramfs -tu"
		fi

		# Switching package indices to default
		if [ "${LIVE_GENERIC_INDICES}" = "yes" ]
		then
			Indices default
		fi
	
		# Generating rootfs image
		Genrootfs

		# Switching package indices to custom
		if [ "${LIVE_GENERIC_INDICES}" = "yes" ]
		then
			Indices custom
		fi

		# Installing syslinux
		Syslinux net

		# Installing linux-image
		Linuximage net

		# Installing memtest
		Memtest net

		# Creating tarball
		cd "${LIVE_ROOT}" && \
		mv binary "`basename ${LIVE_SERVER_PATH}`" && \
		cd .. && \
		tar cfz binary.tar.gz "`basename ${LIVE_ROOT}`/`basename ${LIVE_SERVER_PATH}`" "`basename ${LIVE_ROOT}`/tftpboot" && \
		mv binary.tar.gz "${LIVE_ROOT}" && \
		cd "${OLDPWD}" && \
		mv "`basename ${LIVE_SERVER_PATH}`" binary

		# Touching stage file
		touch "${LIVE_ROOT}"/.stage/image_binary
	fi

	if [ ! -f "${LIVE_ROOT}"/.stage/image_source ] && [ "${LIVE_SOURCE}" = "yes" ]
	then
		# Downloading sources
		Sources

		# Creating tarball
		tar cfz source.tar.gz "${LIVE_ROOT}"/source

		# Touching stage file
		touch "${LIVE_ROOT}"/.stage/image_source
	fi
}