I'm trying to automate below actions using uci-defaults so that i don't have todo these commands manually every time i try a new image.
I'm currently keep building images to make a very cheap openwrt domoticz solution and i am even creating a new circuit board which will include 433,92 Mhz sender and receiver, and if it all works out i'm gonna try to expand it with zwave, zigbee and other hardware solutions that can directly be inserted in this openwrt router.
Todo all this i'm currently adding usb support to the router and then copy the overlay to the usb mount it reboot the router then install the domoticz package etc etc etc.
To simplify this process would it be possible to;
Copy the overlay to the usb using uci-default commands?
If not, what is the easiest way todo this automaticly during first boot?
copy domoticz package from any location during first boot and install it.
What is the easiest way todo this automaticly during first boot?
And last question for now.
which packages are best to add support for 433,92 Mhz transmitter/receiver connected to GPIO pin ( 1 datapin is used for transmitter and 1 for receiver).
lol between my post and your reply the wiki has been changed
I managed to add the usb and mount it as overlay so if i understand you correctly.
#!/bin/sh
mount /dev/sda1 /mnt
tar -C /overlay -cvf - . | tar -C /mnt -xf -
umount /mnt
should copy the overlay to the usb?
if this file is saved in uci-defaults.
Since all i could find was indeed saving to config files.
The only other thing i found that came closest was using Luci commands but havn't figured out yet how to call those from shell.
using normall scripts in uci-default seems to work fine.
I did run into another thing and that is a reboot after the files in uci-default have run.
calling another sh file that removes the uci-default file and reboots openwrt doesn't seem to work and turns out to create a loop on rebooting.
And anyone perhaps know what the best way is to the below question?
which packages are best to add support for 433,92 Mhz transmitter/receiver connected to GPIO pin ( 1 datapin is used for transmitter and 1 for receiver).
uci-defaults scripts are automatically removed in the active overlay when they run successfully. You probably need to “remove” this one, and perhaps others on your “new” overlay as well.
I tried that but somehow it ends up in a reboot loop.....
When i make a reboot command inside the uci-default folder like;
#!/bin/sh -e
reboot
exit 0
It won't delete the file so it keeps rebooting, i think because it waits for the reboot to complete
I need the reboot so the overlay will be activated on the mounted usb.
Thats why i tried to call another script from outside the uci-default folder that first deletes the file in the uci-default folder and then reboots..... But even then i get a loop in rebooting.
Note that only /overlay has grown but not the /
Final steps
Reboot the device
Verify that the partitions were mounted properly:
via LuCI
System - Software should show free space of overlay partition
System - Mount Points should show USB partition mounted as overlay
via CLI
mount should show USB partition mounted as /overlay
Simply put the reboot script in a detached shell and prepend the reboot command with a sleep command. Then the calling script does not wait for the reboot script to complete (which it naturally never does, as the router reboots immeaditely before the script reaches its end...)
in the calling script
#!/bin/sh
( /some/path/to/rebootscript )&
exit 0
In the reboot script
#!/bin/sh
sleep 75
reboot
Ps.
I have no extroot experience, and I just wonder how well the "create extroot from uci-defaults" actually goes. You need to ensure that the extroot overlay's /etc/uci-defaults does not contain the extroot creation & this reboot uci-defaults scripts. You may need to delete them in the overlay file-copy script (which you probably run before you run the reboot script).
then reboot with appropriate /usb/etc/config/fstab in place
so 99-romcopy-genextrootfstabreboot - possibly not even as a uci-default... if further initialisation needs to take place.... first boot is a DOTHIS or don't.... once.... i'd kinda like to have more leeway with re-initialising / fault handling.
Sorry for the late reply, but since the default downloadable domoticz package didnt update in the download section because of boost update.....
There is a patch in github for 8 days now for it but that isn't applied yet.
I had to learn how to compile the package with openwrt.
I got that covered now...
Creating the extroot using uci-default actually works pretty well
Althoug the wiki containing the explanation did change several times since my initial post and this reply and not everything in there is correct as i had to make some changes to make it work well.
If anyone is interested i can post a complete howto in here after i got everything working and well tested.
As of now i'm struggling on 1 part and that is adding a 433,92 Mhz receiver and transmitter using gpio. Since there isn't much user lvl documentation on this part for making that work under openwrt that is my last puzzle to make everything work.
What i got now is;
~10 dollar equipment (excluding usb drive)
Openwrt running stable under latest version build with all patches on 3-5-2019
Domoticz running stable with motherboad sensors and weatherstation.
I got 2 gpio's left on the router but somehow i can't make the receiver and/or transmitter been seen by either openwrt or domoticz.
If anyone has any clues on this i would be thankfull
is it i2c?... generally python / c is used ... the latter being more lightweight.
you could also interface via a micro-over-usb-serial. this has the advantage of many many more gpio... but the middleware can be time consuming. or pcf then 433... works nicely too.