summaryrefslogtreecommitdiff
path: root/setup
blob: 172212f22baadf5286c8e1b70872d8945f89364d (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
#!/bin/sh

set -e

#Set up the initial /src disk
if [ -e /dev/disk/by-label/src ]
then
	echo "Disk labelled src found"
else
	echo "Disk labelled src not found. Initializing /dev/sdb as src"
	mkfs.btrfs -L src /dev/sdb
fi

#Ensure the /src directory exists
mkdir -p /src

#Add the /src disk to /etc/fstab if it doesn't exist
grep "LABEL=src" /etc/fstab >/dev/null || echo 'LABEL=src /src btrfs defaults 0 2' >>/etc/fstab

#Mount the disk so that it can be configured
mount -a 

#Retrieve the staging-filler
if [ -e /src/staging-filler ]
then
	cd /src/staging-filler
	git pull origin master
	cd -
else
	git clone ssh://git@trove.ducie.codethink.co.uk/ct/genivi/genivi-staging-filler /src/staging-filler
fi

if [ -e /src/staging-filler/water-bomb-x86_64-filler.tar.gz ]
then
	echo "Water bomb staging-filler already exists"
else
	echo "Downloading water bomb staging-filler"
	wget -P /src/staging-filler http://download.baserock.org/baserock/water-bomb-x86_64-filler.tar.gz
fi

#Ensure the cache and temp directories exist
mkdir -p /src/cache
mkdir -p /src/tmp

#Create morph.conf
cat >/src/morph.conf <<EOF
[config]
log = /src/morph.log
cachedir = /src/cache
tempdir = /src/tmp
staging-chroot = true
staging-filler = /src/staging-filler/water-bomb-x86_64-filler.tar.gz, \
                 /src/staging-filler/genivi-staging.tar.gz
trove-host = trove.ducie.codethink.co.uk
trove-prefix = ct/genivi
EOF

#Ensure morph uses our morph.conf
ln -s /src/morph.conf $HOME/.morph.conf