[OpenWrt-Devel] First boot provisioning
Lukáš Macura
macura at opf.slu.cz
Wed Dec 9 09:31:36 EST 2015
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hello,
I would want to start some discussion about first boot provisioning and theoretical inclusion of some script into default images.
Today, if somebody want some automatic way to autoconfigure OpenWrt boxes, he has to create its own image. But if there is some possibility directly in OpenWrt, how to do some well-documented procedure during first boot, first boot auto configuration could be offloaded from image. I know there are some security issues. But I think that such procedure could be very tiny and efficient.
For example, it is very easy to write handler for reset button /etc/rc.button/reset :
if [ "$SEEN" -lt 1 ]
then
echo "REBOOT" > /dev/console
sync
reboot
elif [ "$SEEN" -gt 10 ]
then
( echo "PROVISIONING"
wget -q -O- http://openwrt-prov/opkg.repo >/etc/opkg/provisioned.conf
packages=$(wget -q -O- http://openwrt-prov/default/opkg.install)
[ -n "$packages" ] && opkg update && opkg install $packages
) 2>&1 | logger
elif [ "$SEEN" -gt 5 ]
then
echo "FACTORY RESET" > /dev/console
jffs2reset -y && reboot &
fi
so if you press reset button for more than 10 seconds, box will download two files from some server. One which can add some local repositories and second to get package names to install. Next to this, it will do opkg update and install.
There are more ways how to trigger first boot procedure. This is only proof of concept.
Another way is to include this procedure in uci-defaults and run each time when device is in factory defaults mode.
Some questions:
- - How to form url? Which url?
- - Is it secure to download some external content by default? No, but this will hapen only during first boot.
- - Should this procedure be manual? eg. it needs to press button or automaticaly?
Thank you for any comments/opinions :)
regards,
Lukas Macura
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJWaDtIAAoJEITo2zD2c2OSgM8QAI0poNY6aLUm6tgxqPm3h/5b
l9PR8tlEQjmG8Q8NSHlnk6kgxoDipZ34MdbdRRVI1P5IYa72yoB2MD7Wz5L8rq6D
CsIUBvUxcBlUsLWGEb8mC1iEjJFRXFjz6GuQAJ7ChAJTi++YCbWjPLhnew75svY4
PsvvSZsOY7oDeAjcXpnJBMpU4OzvfdJWM5jvT1ee6Jp+WfuU7fnXEnll5JLMDhTO
I9OZB/O5XMIYgk81o5awyPQRAiW9tbsmbmoMmsphnEmjjTpRE7vmzMU1B5DlXj6B
Q7ZHyGEtIgw77s8JcS5sQs60Jg6lVbrC2icNP9HO8POoPQQpJyHEzO60AjDJVzUG
PRgnLlEQtqFu3SGQzPts70o8OKZaj6AiV5ulCyEZ+juulExDLD+bLBfD15vZvhNV
S/GAhzDbZ2lzmjEKpTYbdXsWwx9qU6/40NbN9no7xcSCZtz4S8kRI9FjXW7rPNqP
RZ3jP0J5gA6R1U8ib2mRNX8uoG2vU3c3TMUPrIgsYP6YkSUp9o0FNl8To+onwTTH
ZqD0u3IxU/lRuKSZA5S+PjiwZB/iysRzgHKnDhgU4hW+1H7TTjoy7lSY+UeuJGLj
8Z258C8Nfdle1yWZ4RECe0z8MTSTBDRBn713D2Upl7Pq/0jCL3V7uHo5cMZ17EXp
0/5/Q4/Kxj11yWADZZDD
=ud97
-----END PGP SIGNATURE-----
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list