Developing lightweight computation at the DSG edge
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Quick Mesh Project
qMp packages
Commits
6a9c063f
Commit
6a9c063f
authored
Mar 13, 2014
by
Pau Escrich
Browse files
Improve the autoconfiguration system
Make it compatible with OpenWRT BB
parent
fd36f16c
Changes
2
Hide whitespace changes
Inline
Side-by-side
packages/qmp-system/files/etc/init.d/qmp_autoconf
View file @
6a9c063f
...
...
@@ -32,9 +32,8 @@ QMP_KEY="/tmp/qmp_key"
QMP_LOG
=
"/root/qmp_autoconf.log"
log
()
{
echo
"
$@
"
>
/dev/console
echo
"
$@
"
echo
"
$@
"
>>
$QMP_LOG
echo
-e
"
$@
"
>
/dev/console
echo
-e
"
$@
"
}
exechooks
()
{
...
...
@@ -43,70 +42,65 @@ exechooks() {
qmp_hooks_exec
$stage
}
stop_services
()
{
/etc/init.d/dnsmasq stop
/etc/init.d/gwck stop
/etc/init.d/bmx6 stop
/etc/init.d/radvd stop
/etc/init.d/uhttpd stop
}
prepare_wifi
()
{
finish
=
0
i
=
0
while
[
$finish
-eq
0
]
;
do
radios
=
$(
uci show wireless |
grep
wireless
\.
radio.
*
wifi-device
-c
)
while
[
$i
-lt
$radios
]
;
do
uci
set
wireless.radio
${
i
}
.disabled
=
"0"
2>/dev/null
uci
set
wireless.radio
${
i
}
.country
=
"
$country
"
2>/dev/null
finish
=
$?
i
=
$((
$i
+
1
))
done
uci commit wireless
uci commit wireless
wifi up
sleep
10
log WiFi devices:
log
--------------------------------------------------
log
$(
iwinfo
| egrep
"ESSID|Mode|Type"
)
log
$(
iwinfo
)
log
--------------------------------------------------
#To be sure channel is set...
iw reg
set
$country
||
iw reg
set
00
}
configure
()
{
stop_services
log Redirecting stderr to
$QMP_LOG
exec
2>>
$QMP_LOG
exec
2>>
$QMP_LOG
1>&2
log Starting qmp configuration...
log Waiting
3
0 seconds to be sure all is configured
sleep
3
0
log Waiting
1
0 seconds to be sure all is configured
sleep
1
0
# Execute birth hooks if it is the first boot of the device
[
!
-e
"
$BIRTH_FILE
"
]
&&
exechooks birth
&&
touch
"
$BIRTH_FILE
"
# Execute firstboot hooks
log
"[Executing hooks]"
exechooks firstboot
#Generating default wifi configuration
# Generating default wifi configuration
log
"[Configuring wifi]"
country
=
"
$(
uci get qmp.wireless.country 2>/dev/null
)
"
country
=
"
${
country
:-
00
}
"
log Using countrycode
$country
#Configuring wifi using QMP
prepare_wifi
.
$QMP_DIR
/qmp_wireless.sh
.
$QMP_DIR
/qmp_functions.sh
log
"[Configuring initial system]"
qmp_configure_wifi_initial
qmp_configure_wifi
#Reloading network to avoid problems with next functions
log Reloading network
/etc/init.d/network reload
if
/etc/init.d/gwck enabled
then
/etc/init.d/gwck restart
fi
#Configuring networking
log
"[Configuring networking]"
.
$QMP_DIR
/qmp_functions.sh
sleep
1
# Configuring networking and everything else
log
"[Configuring full system]"
qmp_configure_initial
qmp_configure
log Rebooting
touch
"
$CONTROL_FILE
"
[
-f
"
$CONTROL_FILE
"
]
&&
reboot
||
log CRITICAL, cannot write file
$CONTROL_FILE
}
...
...
packages/qmp-system/files/etc/qmp/qmp_functions.sh
View file @
6a9c063f
...
...
@@ -267,11 +267,11 @@ qmp_configure_smart_network() {
}
&&
continue
# if there is already LAN device and it is not wifi, use as WAN
[
-z
"
$wan
"
]
&&
wan
=
"
$dev
"
&&
continue
# else use as LAN and MESH
lan
=
"
$dev
$
lan
"
mesh
=
"
$dev
$mesh
"
[
-z
"
$wan
"
]
&&
wan
=
"
$dev
"
||
{
# else use as LAN and MESH
lan
=
"
$dev
$lan
"
mesh
=
"
$dev
$
mesh
"
}
done
echo
"Network devices found:"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment