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
257c2063
Commit
257c2063
authored
Jul 15, 2013
by
p4u
Browse files
Add save_state, recover_state, safe_test and configure_all to qmpcontrol
Small cosmetic changes
parent
4c0bb7fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
packages/qmp-system/files/etc/qmp/qmp_control.sh
View file @
257c2063
...
...
@@ -102,25 +102,83 @@ hard_reboot() {
echo
b
>
/proc/sysrq-trigger
}
configure_all
()
{
configure_system
configure_wifi
configure_network
apply_netserver
}
safe_test
()
{
[
-e
"/tmp/qmp.save.tar.gz"
]
&&
echo
"Found saved state! Make sure you want to use it"
\
||
{
echo
"Cannot found saved state, saving it..."
save_state
}
touch
/tmp/qmp.safe.test
echo
"File /tmp/qmp.safe.test has been created, after configuring the system you will have
240 seconds to remove it or the previous state will be recovered"
read
-p
'Do you agree?[y,N] '
a
[
"
$a
"
!=
"y"
]
&&
return
configure_all
(
sleep
240
[
-e
"/tmp/qmp.safe.test"
]
&&
{
recover_state
hard_reboot
}
||
rm
-f
"/tmp/qmp.safe.test"
)
&
}
save_state
()
{
echo
"Saving state at
$(
date
)
in file /tmp/qmp.save.tar.gz"
tar
czf /tmp/qmp.save.tar.gz /overlay/
}
recover_state
()
{
echo
"Recovering state at
$(
date
)
from /tmp/qmp.save.tar.gz"
cp
-f
/etc/config/qmp /etc/config/qmp.wrong
[
-e
"/tmp/qmp.save.tar.gz"
]
&&
tar
xzf /tmp/qmp.save.tar.gz
-C
/
||
\
echo
"Cannot recover state because it has not been saved before"
}
help
()
{
echo
"Use:
$0
<function> [params]"
echo
""
echo
"Available functions:"
echo
" offer_default_gw [ipv4|ipv6] : Offers default gw to the network IPv4 or IPv6, both versions if no value."
echo
" search_default_gw [ipv4|ipv6] : Search for a default gw in the network IPv4 or IPv6, both versions if no value."
echo
" disable_default_gw [ipv4|ipv6] : Disables the search/offer of default GW IPv4 and/or IPv6"
echo
" configure_wifi : Configure all WiFi devices"
echo
" reset_wifi : Reset, rescan and configure all the WiFi devices"
echo
"Configuration:"
echo
" configure_all : Configure and apply all settings"
echo
" configure_network : Configure and apply network settings"
echo
" configure_system : Configure and apply system settings (qmp.node section and so on)"
echo
" configure_wifi : Configure all WiFi devices"
echo
" reset_wifi : Reset, rescan and configure all the WiFi devices"
echo
""
echo
"Safe configuration apply:"
echo
" save_state : Saves current state of configuration files"
echo
" recover_state : Recovers previous saved state"
echo
" safe_test : Performs a safe configure_all. If something wrong it comes back to old state"
echo
""
echo
"Gateways:"
echo
" offer_default_gw [ipv4|ipv6] : Offers default gw to the network IPv4 or IPv6, both versions if no value"
echo
" search_default_gw [ipv4|ipv6] : Search for a default gw in the network IPv4 or IPv6, both versions if no value"
echo
" disable_default_gw [ipv4|ipv6] : Disables the search/offer of default GW IPv4 and/or IPv6"
echo
" publish_hna : Publish an IP range (v4 or v6): publish_hna <IP/NETMASK> [ID]"
echo
" unpublish_hna : Unpublish a current HNA: unpublish_hna <ID>"
echo
""
echo
"Other:"
echo
" apply_netserver : Start/stop nerserver depending on qmp configuration"
echo
" enable_ns_ppt : Enable POE passtrought from NanoStation M2/5 devices. Be careful with this"
echo
" upgrade [URL] : Upgrade system. By default to the last version, but image url can be provided to force"
echo
" hard_reboot : Performs a hard reboot (using kernel sysrq)"
echo
""
exit
1
exit
0
}
...
...
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