mirror of
https://git.disroot.org/pranav/pybatmesh.git
synced 2024-11-10 07:21:59 +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
|
||||
|
||||
|
||||
|
||||
DATADIR="$(dirname "$0")/../share/naxalnet"
|
||||
NETWORKD_DIR=/run/systemd/network
|
||||
SSID="Hello World"
|
||||
@ -13,33 +11,25 @@ then
|
||||
exit 1
|
||||
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" ]]
|
||||
then
|
||||
mkdir "$NETWORKD_DIR"
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
sleep 5
|
||||
#sleep 5
|
||||
echo "Configuring iwd"
|
||||
iwctl device $1 set-property Mode ad-hoc
|
||||
iwctl ad-hoc $1 start_open "$SSID"
|
||||
iwctl device "$1" set-property Mode ad-hoc
|
||||
iwctl ad-hoc "$1" start_open "$SSID"
|
||||
|
||||
echo "Done"
|
||||
|
@ -1,6 +1,7 @@
|
||||
[Match]
|
||||
# this line will be changed by sed
|
||||
WLANInterfaceType={ADHOC_NETWORK}
|
||||
# This will match all networks in ad-hoc mode.
|
||||
# It assumes there is only one interface in ad-hoc mode.
|
||||
WLANInterfaceType=ad-hoc
|
||||
|
||||
[Network]
|
||||
Description=ad-hoc network connecting to other nodes
|
||||
|
Loading…
Reference in New Issue
Block a user