~cyphermox/debian-cd/union-aufs-server-live

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
#! /bin/sh -e

BDIR=$TDIR/$CODENAME-$FULLARCH

if [ "$CDIMAGE_LIVE" ]; then
	DIR=casper
else
	DIR=install
fi
mkdir -p "$BDIR/CD1/$DIR"
if [ -e "$LIVEIMAGES/$FULLARCH.cloop" ]; then
	ln "$LIVEIMAGES/$FULLARCH.cloop" "$BDIR/CD1/$DIR/filesystem.cloop"
elif [ -e "$LIVEIMAGES/$FULLARCH.squashfs" ]; then
	ln "$LIVEIMAGES/$FULLARCH.squashfs" "$BDIR/CD1/$DIR/filesystem.squashfs"
	if [ -e "$LIVEIMAGES/$FULLARCH.size" ]; then
		ln "$LIVEIMAGES/$FULLARCH.size" "$BDIR/CD1/$DIR/filesystem.size"
	fi
	if [ -e "$LIVEIMAGES/$FULLARCH.squashfs.gpg" ]; then
		ln "$LIVEIMAGES/$FULLARCH.squashfs.gpg" "$BDIR/CD1/$DIR/filesystem.squashfs.gpg"
	fi

	if [ -e "$LIVEIMAGES/$FULLARCH.installer.squashfs" ]; then
		ln "$LIVEIMAGES/$FULLARCH.installer.squashfs" "$BDIR/CD1/$DIR/installer.squashfs"
		if [ -e "$LIVEIMAGES/$FULLARCH.installer.size" ]; then
			ln "$LIVEIMAGES/$FULLARCH.installer.size" "$BDIR/CD1/$DIR/installer.size"
		fi
		if [ -e "$LIVEIMAGES/$FULLARCH.installer.squashfs.gpg" ]; then
			ln "$LIVEIMAGES/$FULLARCH.installer.squashfs.gpg" "$BDIR/CD1/$DIR/installer.squashfs.gpg"
		fi
	fi
else
	echo "No filesystem for $FULLARCH!" >&2
fi
if [ -e "$LIVEIMAGES/$FULLARCH.usb-creator.exe" ]; then
	ln "$LIVEIMAGES/$FULLARCH.usb-creator.exe" "$BDIR/CD1/usb-creator.exe"
fi
for item in kernel initrd; do
	for path in "$LIVEIMAGES/$FULLARCH.$item"-*; do
		if [ -f "$path" ]; then
			ln "$path" "$BDIR/CD1/$DIR/filesystem.${path#$LIVEIMAGES/$FULLARCH.}"
		fi
	done
done
ln "$LIVEIMAGES/$FULLARCH.manifest" "$BDIR/CD1/$DIR/filesystem.manifest" || true
if [ -e "$LIVEIMAGES/$FULLARCH.manifest-remove" ]; then
	ln "$LIVEIMAGES/$FULLARCH.manifest-remove" "$BDIR/CD1/$DIR/filesystem.manifest-remove" || true
elif [ -e "$LIVEIMAGES/$FULLARCH.manifest-desktop" ]; then
	ln "$LIVEIMAGES/$FULLARCH.manifest-desktop" "$BDIR/CD1/$DIR/filesystem.manifest-desktop" || true
fi

if [ "$PROJECT" = edubuntu ] && [ "$CDIMAGE_DVD" = 1 ]; then
	case $ARCH in
		amd64|i386)
			# LTSP is i386 for both architectures
			# Starting with raring (13.04), all the Edubuntu squashfses now
			# reside under casper/
			if [ "$DIST" = "precise" ]; then
				mkdir -p "$BDIR/CD1/ltsp"
				ln "$LIVEIMAGES/$FULLARCH.ltsp-squashfs" \
					"$BDIR/CD1/ltsp/i386.img"
			else
				mkdir -p "$BDIR/CD1/casper"
				ln "$LIVEIMAGES/$FULLARCH.ltsp-squashfs" \
					"$BDIR/CD1/casper/ltsp.squashfs"
# FIXME: Disabled edubuntu-server (LP: #1154601)
#				ln "$LIVEIMAGES/$FULLARCH.server-squashfs" \
#					"$BDIR/CD1/casper/server.squashfs"
			fi
			;;
	esac
fi

lzcat_sane () {
	local path
	case $1 in
	    -*)
		path="$2"
		;;
	    *)
		path="$1"
		;;
	esac
	# TODO: This only works if there is at least one dot in $1;
	# fortunately this is currently always true.
	lzcat -S ".${path##*.}" "$@"
}

initrd_decompressor () {
	if zcat -t "$1" >/dev/null 2>&1; then
		echo zcat
	elif bzcat -t "$1" >/dev/null 2>&1; then
		echo bzcat
	elif lzcat_sane -t "$1" >/dev/null 2>&1; then
		echo lzcat_sane
	fi
}

if [ "$CDIMAGE_LIVE" ]; then
	# Extract the UUID from the casper initrd, if any.
	mkdir -p "$BDIR/uuid"
	for path in "$BDIR/CD1/casper/filesystem.initrd"-*; do (
		[ -e "$path" ] || continue
		cd "$BDIR/uuid"
		decompressor="$(initrd_decompressor "$path")"
		[ "$decompressor" ] || continue
		"$decompressor" "$path" | cpio --quiet -id conf/uuid.conf
		if [ -e conf/uuid.conf ]; then
			mkdir -p "$BDIR/CD1/.disk"
			mv conf/uuid.conf "$BDIR/CD1/.disk/casper-uuid-${path#$BDIR/CD1/casper/filesystem.initrd-}"
		fi
	); done
fi

# Release notes URL for use by Ubiquity. '${LANG}' will be replaced with the
# installation locale code.
RELEASE_NOTES=
case $PROJECT in
	ubuntu|kubuntu|edubuntu|xubuntu|gobuntu|ubuntustudio|mythbuntu|lubuntu|ubuntu-gnome|ubuntukylin|ubuntu-desktop-next|ubuntu-mate|ubuntu-budgie)
		case $DIST in
			warty|hoary|breezy|dapper|edgy)
				;;
			*)
				RELEASE_NOTES="http://www.ubuntu.com/getubuntu/releasenotes?os=$PROJECT&ver=${DEBVERSION%% *}&lang=\${LANG}"
				;;
		esac
		;;
esac
if [ "$RELEASE_NOTES" ]; then
	mkdir -p "$BDIR/CD1/.disk"
	echo "$RELEASE_NOTES" > "$BDIR/CD1/.disk/release_notes_url"
fi