aboutsummaryrefslogtreecommitdiffstats
path: root/qemu-kvm/ggsn-kernel-gtp/postinst.sh
blob: 4cbe64ca08b6e57ffdf2c546c6717ac15fba6b4c (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
#!/bin/sh

# This script is run by debian installer using preseed/late_command
# directive, see preseed.cfg

# Setup console, remove timeout on boot.
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0"/g; s/TIMEOUT=5/TIMEOUT=0/g' /etc/default/grub
update-grub

# Members of `sudo` group are not asked for password.
sed -i 's/%sudo\tALL=(ALL:ALL) ALL/%sudo\tALL=(ALL:ALL) NOPASSWD:ALL/g' /etc/sudoers

# Empty message of the day.
echo -n > /etc/motd

# Unpack postinst tarball.
tar -x -v -z -C/tmp -f /tmp/postinst.tar.gz

# Install SSH key for ggsn.
mkdir -m700 /home/ggsn/.ssh
cat /tmp/postinst/authorized_keys > /home/ggsn/.ssh/authorized_keys
chown -R ggsn:ggsn /home/ggsn/.ssh

# Install SSH key for root.
mkdir -m700 /root/.ssh
cat /tmp/postinst/authorized_keys > /root/.ssh/authorized_keys
chown -R root:root /root/.ssh

# Install misc packages required for building osmocom code
apt-get install -y --no-install-recommends \
	autoconf \
	autoconf-archive \
	autogen \
	automake \
	build-essential \
	gcc \
	git \
	libc-ares-dev \
	libgnutls28-dev \
	libncurses5-dev \
	libtalloc-dev \
	libreadline-dev \
	libsctp-dev \
	libtool \
	make \
	pkg-config
apt-get clean

# add osmocom:nightly feed + install libosmocore-dev
apt-key add /tmp/postinst/Release.key
echo "deb http://download.opensuse.org/repositories/network:/osmocom:/nightly/Debian_9.0/ ./" > /etc/apt/sources.list.d/osmocom-nightly.list
apt-get update
apt-get install -y --no-install-recommends \
	libosmocore-dev
apt-get clean

# Remove some non-essential packages.
DEBIAN_FRONTEND=noninteractive apt-get purge -y nano laptop-detect tasksel dictionaries-common emacsen-common iamerican ibritish ienglish-common ispell

# Set domain name in hosts file
#sed -i 's/127.0.1.1\t\([a-z]*\).*/127.0.1.1\t\1\.dp\-net\.com\t\1/' /etc/hosts

# Avoid using DHCP-server provided domain name.
#sed -i 's/#supersede.*/supersede domain-name "dp-net.com";/' /etc/dhcp/dhclient.conf

# check out sources we need from their respective repositories
cd /usr/local/src
git clone git://git.netfilter.org/libmnl
(cd libmnl && autoreconf -fi && ./configure && make && make install)
git clone git://git.osmocom.org/libgtpnl
(cd libgtpnl && autoreconf -fi && ./configure && make && make install)
git clone git://git.osmocom.org/osmo-ggsn
(cd osmo-ggsn && autoreconf -fi && ./configure --enable-gtp-linux && make && make install)
ldconfig