Developing lightweight computation at the DSG edge

Commit 2fcbe6b9 authored by Roger Pueyo Centelles's avatar Roger Pueyo Centelles
Browse files

[qmp-system] Make qmp_autoconf log more readable

Signed-off-by: default avatarRoger Pueyo Centelles <>
parent 99616e6c
......@@ -52,19 +52,24 @@ stop_services() {
prepare_wifi() {
radios=$(uci show wireless | grep wireless\.radio.*wifi-device -c)
log "Detected $radios WiFi device(s)"
while [ $i -lt $radios ]; do
log "Enabling radio${i}"
uci set${i}.disabled="0" 2>/dev/null
uci set${i}.country="$country" 2>/dev/null
uci commit wireless
log "Enabling WiFi and waiting 5 seconds to come up..."
wifi up
sleep 10
sleep 5
log ""
log WiFi devices:
log "Detected WiFi devices:"
log --------------------------------------------------
log $(iwinfo)
log "$(iwinfo)"
log --------------------------------------------------
......@@ -72,60 +77,79 @@ configure() {
log Redirecting stderr to $QMP_LOG
exec 2>>$QMP_LOG 1>&2
log Starting qmp configuration...
log Waiting 10 seconds to be sure all is configured
sleep 10
log "[Starting qMp autoconfiguration]"
log "Waiting 15 seconds to make sure everything else is ready..."
sleep 15
log "... done!"
log ""
log "[Preparing wifi]"
log "[WiFi devices detection]"
country="$(uci get 2>/dev/null)"
log Using countrycode $country
log "Using country code $country."
log "Preparing wifi devices"
log "... done!"
log ""
# Execute birth hooks if it is the first boot of the device
log "[Birth hooks]"
[ ! -e "$BIRTH_FILE" ] && exechooks birth && touch "$BIRTH_FILE"
log "... done!"
log ""
# Configure system and reboot
log "[Loading qMp functions]"
log "[Configuring initial system]"
log "... done!"
log ""
log "[Initial qMp system configuration]"
log "[Configuring full system]"
log "... done!"
log ""
log "[Full qMp system configuration]"
log "... done!"
log ""
log Rebooting
log "[Finishing qMp autoconfiguration]"
[ -f "$CONTROL_FILE" ] && reboot || log CRITICAL, cannot write file $CONTROL_FILE
[ -f "$CONTROL_FILE" ] && log "Rebooting..." && reboot || log "CRITICAL ERROR, cannot write file $CONTROL_FILE"
# This function is executed in each boot
# This function is executed on each boot
startup() {
# Set HostName
[ $(qmp_uci_get services.bwtest) -eq 1 ] && qmp_enable_netserver
# Run hooks
exechooks anyboot
# Generate current qmp key
logread | md5sum | awk '{print $1}' > $QMP_KEY
# Start firewall
# Start firewall
sh /etc/firewall.user
start() {
if [ ! -e "$CONTROL_FILE" ]; then
echo "qMp is not configured. Starting autoconfiguration..."
echo ""
echo "qMp already configured. Remove $CONTROL_FILE to force reconfiguration"
echo "qMp is already configured. Delete file $CONTROL_FILE to force reconfiguration."
stop() {
log Nothing to do
log "Nothing to do"
restart() {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment