openwifi/user_space/post_config.sh

58 lines
1.3 KiB
Bash
Raw Normal View History

2020-03-04 18:39:12 +00:00
#!/bin/bash
2021-02-03 14:54:19 +00:00
# Author: Xianjun Jiao
# SPDX-FileCopyrightText: 2019 UGent
2021-01-20 12:30:12 +00:00
# SPDX-License-Identifier: AGPL-3.0-or-later
2020-03-04 18:39:12 +00:00
set -ex
2020-04-27 07:37:04 +00:00
MACHINE_TYPE=`uname -m`
2020-03-04 18:39:12 +00:00
# setup kernel module directory
if [ -d "/lib/modules/$(uname -r)" ]; then
echo "/lib/modules/$(uname -r) already exists."
else
2020-04-27 07:37:04 +00:00
if [ ${MACHINE_TYPE} == 'aarch64' ]; then
ln -s /lib/modules/adi-linux-64 /lib/modules/$(uname -r)
else
ln -s /lib/modules/adi-linux /lib/modules/$(uname -r)
fi
2020-03-04 18:39:12 +00:00
fi
depmod
modprobe mac80211
2020-04-27 07:37:04 +00:00
if [ ${MACHINE_TYPE} == 'aarch64' ]; then
cp ~/openwifi/drv64/* ~/openwifi/ -rf
else
cp ~/openwifi/drv32/* ~/openwifi/ -rf
fi
2020-03-04 18:39:12 +00:00
# add gateway (PC) for internet access
route add default gw 192.168.10.1 || true
# build sdrctl
sudo apt-get -y install libnl-3-dev
sudo apt-get -y install libnl-genl-3-dev
cd sdrctl_src
make
cp sdrctl ../
cd ../side_ch_ctl_src/
gcc -o side_ch_ctl side_ch_ctl.c
cp side_ch_ctl ../
2020-03-04 18:39:12 +00:00
cd ..
# install and setup dhcp server
sudo apt-get -y install isc-dhcp-server
cp dhcpd.conf /etc/dhcp/dhcpd.conf
# install hostapd and other useful tools
sudo apt-get -y install hostapd
sudo apt-get -y install nano
sudo apt-get -y install tcpdump
sudo apt-get -y install webfs
sudo apt-get -y install iperf
sudo apt-get -y install libpcap-dev
2020-03-04 18:39:12 +00:00
# change the password to openwifi
echo -e "openwifi\nopenwifi" | passwd