mirror of
https://git.disroot.org/pranav/pybatmesh.git
synced 2024-12-02 11:40:44 +05:30
Pranav Jerry
8d318a5b13
naxalnet no longer creates temporary directories, since the networkd configs no longer have device names engraved in them.
36 lines
827 B
Bash
Executable File
36 lines
827 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
DATADIR="$(dirname "$0")/../share/naxalnet"
|
|
NETWORKD_DIR=/run/systemd/network
|
|
SSID="Hello World"
|
|
|
|
if [[ $# != 1 ]]
|
|
then
|
|
echo "Usage: $0 {wireless device}"
|
|
echo "Example: $0 wlan0"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -d "$NETWORKD_DIR" ]]
|
|
then
|
|
mkdir "$NETWORKD_DIR"
|
|
fi
|
|
|
|
echo "Copying systemd-networkd config files"
|
|
# Copies all files in DATADIR to NETWORKD_DIR
|
|
find "$DATADIR" -type f -execdir cp -t "$NETWORKD_DIR" {} +
|
|
|
|
echo "Linking resolv.conf to systemd-resolved's stub-resolved.conf"
|
|
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
|
|
|
echo "Starting services"
|
|
systemctl reload-or-restart iwd systemd-resolved systemd-networkd
|
|
|
|
# wait five seconds for iwd to start
|
|
#sleep 5
|
|
echo "Configuring iwd"
|
|
iwctl device "$1" set-property Mode ad-hoc
|
|
iwctl ad-hoc "$1" start_open "$SSID"
|
|
|
|
echo "Done"
|