openwifi/user_space/post_config.sh

76 lines
1.6 KiB
Bash
Raw Permalink 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
2023-01-17 13:30:41 +00:00
sudo apt update
chmod +x *.sh
2020-03-04 18:39:12 +00:00
# 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
2023-01-17 13:30:41 +00:00
sudo apt-get -y install iperf3
sudo apt-get -y install libpcap-dev
sudo apt-get -y install bridge-utils
2020-03-04 18:39:12 +00:00
cd ./inject_80211/
make
# change the root password to openwifi
cat /etc/passwd
sed -i 's/root:x:0:0:root:\/root:\/bin\/bash/root::0:0:root:\/root:\/bin\/bash/' /etc/passwd
sync
sleep 1
cat /etc/passwd
2020-03-04 18:39:12 +00:00
echo -e "openwifi\nopenwifi" | passwd
sync
sleep 1
cat /etc/passwd