mirror of
https://git.disroot.org/pranav/pybatmesh.git
synced 2025-03-04 23:33:09 +05:30
fixed ad-hoc device getting ip address
naxalnet no longer creates temporary directories, since the networkd configs no longer have device names engraved in them.
This commit is contained in:
parent
b2727231d0
commit
8d318a5b13
24
naxalnet
24
naxalnet
@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DATADIR="$(dirname "$0")/../share/naxalnet"
|
DATADIR="$(dirname "$0")/../share/naxalnet"
|
||||||
NETWORKD_DIR=/run/systemd/network
|
NETWORKD_DIR=/run/systemd/network
|
||||||
SSID="Hello World"
|
SSID="Hello World"
|
||||||
@ -13,33 +11,25 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "creating and copying file to tmp dir"
|
|
||||||
TMPDIR=$(mktemp -d)
|
|
||||||
cd "$TMPDIR"
|
|
||||||
cp -r $DATADIR/* .
|
|
||||||
|
|
||||||
|
|
||||||
echo "Setting $1 as wireless device"
|
|
||||||
sed -i "s/{ADHOC_NETWORK}/$1/" *.network
|
|
||||||
|
|
||||||
if [[ ! -d "$NETWORKD_DIR" ]]
|
if [[ ! -d "$NETWORKD_DIR" ]]
|
||||||
then
|
then
|
||||||
mkdir "$NETWORKD_DIR"
|
mkdir "$NETWORKD_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Copying systemd-networkd config files"
|
echo "Copying systemd-networkd config files"
|
||||||
cp * "$NETWORKD_DIR"
|
# Copies all files in DATADIR to NETWORKD_DIR
|
||||||
|
find "$DATADIR" -type f -execdir cp -t "$NETWORKD_DIR" {} +
|
||||||
|
|
||||||
echo "Linking resolv.conf to resolved stub-resolved.conf"
|
echo "Linking resolv.conf to systemd-resolved's stub-resolved.conf"
|
||||||
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
||||||
|
|
||||||
echo "Starting services"
|
echo "Starting services"
|
||||||
systemctl reload-or-restart systemd-resolved iwd systemd-networkd
|
systemctl reload-or-restart iwd systemd-resolved systemd-networkd
|
||||||
|
|
||||||
# wait five seconds for iwd to start
|
# wait five seconds for iwd to start
|
||||||
sleep 5
|
#sleep 5
|
||||||
echo "Configuring iwd"
|
echo "Configuring iwd"
|
||||||
iwctl device $1 set-property Mode ad-hoc
|
iwctl device "$1" set-property Mode ad-hoc
|
||||||
iwctl ad-hoc $1 start_open "$SSID"
|
iwctl ad-hoc "$1" start_open "$SSID"
|
||||||
|
|
||||||
echo "Done"
|
echo "Done"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
[Match]
|
[Match]
|
||||||
# this line will be changed by sed
|
# This will match all networks in ad-hoc mode.
|
||||||
WLANInterfaceType={ADHOC_NETWORK}
|
# It assumes there is only one interface in ad-hoc mode.
|
||||||
|
WLANInterfaceType=ad-hoc
|
||||||
|
|
||||||
[Network]
|
[Network]
|
||||||
Description=ad-hoc network connecting to other nodes
|
Description=ad-hoc network connecting to other nodes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user