Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/modules/base/kspost.50.zip_bootfiles.nochroot.inc
blob: 5c81b0c0b4e35d84f843f2e9728f476e58c54820 (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
. $OOB__shlib

# Put the unsigned kernel/initramfs in zip files and remove the originals
# This avoids duplication for signed builds (where these zips will be signed
# later), where otherwise we would be shipped both signed and unsigned kernels
# and losing some disk space.

suffix=$(read_laptop_model_number)

# Create zip files
create_unsigned_zip() {
	local infile=$1
	local tgt=${2}${suffix}

	cd $INSTALL_ROOT/boot
	[ -e $1 ] || return

	cp $1 data.img
	zip -j -n .img ${tgt}.zip data.img
	rm -f data.img
}

create_unsigned_zip vmlinuz runos
create_unsigned_zip initrd.img runrd
create_unsigned_zip actrd.img actrd

# Remove original copies
remove_original() {
	local name=$1

	cd $INSTALL_ROOT/boot
	[ -e "$name" ] || return

	if [ -L "$name" ]; then
		dest=$(readlink $name)
		rm -rf "$dest"
	fi

	rm -f $name
}

remove_original vmlinuz
remove_original actrd.img
remove_original initrd.img

# symlink actXX to runXX (or the other way) if any of them are missing
create_missing() {
	local dest=${1}${suffix}.zip
	local source=${2}${suffix}.zip

	[ -e $INSTALL_ROOT/boot/$dest ] && return 0
	ln -s $source $INSTALL_ROOT/boot/$dest
}
create_missing actos runos
create_missing actrd runrd
create_missing runos actos
create_missing runrd actrd


create_compat() {
	local compat=${1}.zip
	local dest=${1}${suffix}.zip

	[ -e $INSTALL_ROOT/boot/${dest} ] || return 0
	ln -s $dest $INSTALL_ROOT/boot/$compat
}

# Some old, released firmware versions for XO-1 and XO-1.5 don't support the
# new "versioned" zip file naming scheme. Create symlinks to the old names
# for backwards compatibility.
if [ "$suffix" -lt 3 ]; then
	create_compat actos
	create_compat actrd
	create_compat runos
	create_compat runrd
fi