xref: /openwifi/user_space/post_config.sh (revision abdb610f56e6ff7bc54e8ad29637bde718951d91)
1#!/bin/bash
2
3# Author: Xianjun Jiao
4# SPDX-FileCopyrightText: 2019 UGent
5# SPDX-License-Identifier: AGPL-3.0-or-later
6
7set -ex
8
9MACHINE_TYPE=`uname -m`
10
11# setup kernel module directory
12if [ -d "/lib/modules/$(uname -r)" ]; then
13    echo "/lib/modules/$(uname -r) already exists."
14else
15    if [ ${MACHINE_TYPE} == 'aarch64' ]; then
16        ln -s /lib/modules/adi-linux-64 /lib/modules/$(uname -r)
17    else
18        ln -s /lib/modules/adi-linux /lib/modules/$(uname -r)
19    fi
20fi
21depmod
22modprobe mac80211
23
24if [ ${MACHINE_TYPE} == 'aarch64' ]; then
25    cp ~/openwifi/drv64/* ~/openwifi/ -rf
26else
27    cp ~/openwifi/drv32/* ~/openwifi/ -rf
28fi
29
30# add gateway (PC) for internet access
31route add default gw 192.168.10.1 || true
32
33# build sdrctl
34sudo apt-get -y install libnl-3-dev
35sudo apt-get -y install libnl-genl-3-dev
36cd sdrctl_src
37make
38cp sdrctl ../
39cd ../side_ch_ctl_src/
40gcc -o side_ch_ctl side_ch_ctl.c
41cp side_ch_ctl ../
42cd ..
43
44# install and setup dhcp server
45sudo apt-get -y install isc-dhcp-server
46cp dhcpd.conf /etc/dhcp/dhcpd.conf
47
48# install hostapd and other useful tools
49sudo apt-get -y install hostapd
50sudo apt-get -y install nano
51sudo apt-get -y install tcpdump
52sudo apt-get -y install webfs
53sudo apt-get -y install iperf
54sudo apt-get -y install libpcap-dev
55
56# change the root password to openwifi
57cat /etc/passwd
58sed -i 's/root:x:0:0:root:\/root:\/bin\/bash/root::0:0:root:\/root:\/bin\/bash/' /etc/passwd
59sync
60sleep 1
61cat /etc/passwd
62echo -e "openwifi\nopenwifi" | passwd
63sync
64sleep 1
65cat /etc/passwd
66
67