Comments (17)
Works great! I made a cronjob for a quick test and it also works.
Thanks for your hard work. I would definitely let LEDE and OpenWrt users know what you've created. I am sure there are lots who would use this as well.
from opkg-upgrade.
Just had an update come through. Script works as expected. Nice and neat html table.
I think you can close this enhancement now as a rousing success!
from opkg-upgrade.
BIG MAYBE on sending mails with telnet, as described here:
This would increase the complexity of opkg-upgrade quite a lot, but it would be portable and it would not depend on external packages. Not sure if feasible yet though.
Also forgot to mention the package mini-sendmail
, but that has no auth support and seems kind of deprecated (and not available for ChaosCalmer).
I will keep researching, but for now I will probably just implement the two flags mentioned above and let the user do the mailing part.
EDIT: My test router is currently with other system and the other one I can use to test stuff currently has no extroot and I can't really install much else there (to test e-mail or even opkg-upgrade). I may finally set up a x86
VM for easier development. Anyways, bear with me, may take a while, suggestions welcome in the meantime.
from opkg-upgrade.
I have ssmtp configured now for using a gmail account I have for my server related emails. I have successfully sent a test message from my LEDE install.
Once you post the new code I'll give it a go.
from opkg-upgrade.
Looks great!
from opkg-upgrade.
Not getting the html output to show-up however that may be a byproduct of having no updates available.
Is the following supposed to be shown?:
root@Router:~# ./opkg-upgrade.sh -e -a -s [email protected]
Subject: opkg-upgrade report - 2017/06/25 19:49:57
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8
<h2>Simple OPKG Updater v0.2.0</h2>
<h3>Report for: Router</h3>
<h3>Packages available for upgrade: 1</h3><br>
<br><br><h3>No packages to install.</h3>
<h4>Generated on: 2017/06/25 19:49:57 by <a href="https://github.com/tavinus/opkg-upgrade">opkg-upgrade</a></h4>
Note I do not get an email when using the -e flag
Also getting this error when running the script from commandline:
Proceed with upgrade? (Y/y to proceed)
from opkg-upgrade.
Ok understood. Looks like it's working as planned. I just won't see anything until there's an actual update to a package.
The Y/y was just a question if it should be Y/n instead. And only happens when running from the command line with no switches.
from opkg-upgrade.
Hi! Interesting idea.
I have no experience on mailing from OpenWRT/LEDE, do you currently use one of the solutions available?
From this article, our choices seem to be:
- msmtp
- mailsend
- ssmtp
All of them would have options with or without SSL.
Seems a bit tricky to include the mailer into opkg-upgrade.
It would probably be easier to just create flags to check
and list
.
So the user can configure whatever mailer they want and use something like this:
opkg-upgrade --hasUpgrade && opkg-upgrade --list | mail -s "opkg-upgrade list $(date '+%Y-%m-%d_%H:%M:%S')" [email protected]
(not so sure about the mail call, not tested)
What this does:
- Check if we have upgrades
- If yes, send email with the list of upgrades
So, then we need:
--hasUpgrade
: returns 0 only if we have upgrades, used to check if we should email--list
: only prints the list of updates and exits, used for email contents
Having these options would make it possible to do what you want (I think).
But as mentioned, you would need to configure the mailer yourself and also create the cronjob.
References:
- https://wiki.openwrt.org/doc/howto/smtp.client
- https://fixmynix.com/send-mail-command-line-linux-openwrt/
- https://forum.openwrt.org/viewtopic.php?id=18669
Let me know what you think
Cheers!
Gus
from opkg-upgrade.
Hi, I have a working version with the mentioned modes of operation and also the option to use ssmtp directly from opkg-upgrade. You would still need to install and configure the ssmtp package. I had some trouble to make it work with gmail (had no enable unsecure apps, etc), but worked in the end. After you have a working ssmtp config installed, it is as easy as calling:
opkg-upgrade -s '[email protected]'
And the report will be sent to [email protected], but only if there are new updates.
You can force it to always send the e-mail (even when no updates are available) with the -a flag
, as in:
opkg-upgrade -a -s '[email protected]'
I still need to do some more testing and to clean up the code. I was thinking of also having the option to send an HTML e-mail, but maybe I will leave that for a future version.
As mentioned, I have also implemented the -u, --upgrade-check
and -l, --list-upgrades
modes, so it is possible to also use those with any mail client with something like:
opkg-upgrade -u && opkg-upgrade -l | ssmtp '[email protected]'
I will see if it is worthy to also implement the other available mailers.
@txcanyon , do you currently use any mailer already?
from opkg-upgrade.
Cool! At least you are using ssmtp with gmail, so this should be a breeze..
It was my mother's birthday today so... u know.. had to separate some time to her...
from opkg-upgrade.
anyways,... I have a cool html email version for ya.
in 1 or 2 days it will be there... (I am a bit drunk to finish it today)
from opkg-upgrade.
I have done the html email, this is an example of it:
from opkg-upgrade.
@txcanyon , I have pushed v0.2.0 to the master branch.
Can you try it please?
I will make a release after testing a bit more and finishing the readme.
To send the email report, just use:
mail upgrade report only if have new updates
# opkg-upgrade -s '[email protected]'
mail upgrade report even if there are no new updates
# opkg-upgrade -a -s '[email protected]'
Please adjust the script name to your local install name/location.
After you have tested that, you can just use that on your cron line.
It is probably a good a idea to use the full path on cron, like: /usr/sbin/opkg-upgrade
.
By default, there is no output when running it, unless there is an error.
Cheers!
Gus
from opkg-upgrade.
You should never really use the -e
option with the -s
option.
-e
is to print the html message to stdout (if someone wants to use something either than ssmtp)-s
is to send the e-mail using ssmtp.
-e
can also be used to test/see the output of the email without actually sending it.
So as I posted above, try using just this:
./opkg-upgrade.sh -a -s '[email protected]'
It should send an email even if there are no updates.
Instead of the table with packages you will get the message 'No packages to install'
.
I have just realized that it counts as 1 package though (I'll fix that).
And then, are you being asked if you want to continue the upgrade even when sending e-mails?
Not sure I understand, but I don't get that here...
from opkg-upgrade.
Just pushed v0.2.2 with two fixes:
- Fix to package count on e-mail when there are no updates (was showing 1).
- Fix to asking to confirm upgrade when no upgrades are available (detection was broken there).
You will receive a message with 'No packages to install.'
if using the -a
option. If you want it to send e-mails only when updates are available, just remove the -a
option.
About the confirmation message, it works and reads as it says.
Y
and y
will update, anything else will cancel.
You made me notice that it was asking that even when no updates were available though, fixed.
EDIT I have upgraded stuff and now I can't push from there because it went back to dropbear's ssh. I will fix and push soon. done! had to --force-reinstall
the package openssh-client
for git to use it again.
Please let me know if you have any problems.
v0.2.3 released with a minor fix.
Cheers!
Gus
from opkg-upgrade.
Cool! Thanks for the feedback and suggestions.
I wish there was an easier way to resolve config file conflicts though.
I may create some functionality for helping with that.
For now I can suggest this little script for using git diff to compare config files.
It is a lot better than the diff
program in diffutils
and if git is already there, no need for extra packages.
You use it like this:
# diff-git /etc/config/dhcp /etc/config/dhcp-opkg
Even so, can still be annoying to decide if should merge/discard/migrate to a new config file.
from opkg-upgrade.
Thx for the feedback.
Glad it works! :)
Things are a bit busy right now, but I can think of many ways to improve this functionality.
I am pretty glad on what could be done in a couple of days anyways.
And for people wanting to use other mailers, the option -e
will print the e-mail so you can pipe it to your mailer (or to a temporary file you can use). If you want to send e-mail only when new updates are available you will need a -u
check before. To speed things up the second call can include the -n
parameter, since the package list will be updated on the first call anyways.
So, it would be something like this:
opkg-upgrade -u && opkg-upgrade -n -e | othermailer '[email protected]'
For plain-text e-mails, there is the -t
flag. Plain text flag works for both -e
and -s
.
If by any reason the email string provided is not good for anyone, there is still the option of using the -l
flag to just list the packages.
thanks @txcanyon for all the ideas and feedback, feel free to post here even though I am closing this.
Cheers!
Gus
from opkg-upgrade.
Related Issues (13)
- Just thought I would let you know your script still works OpenWRT 19.07.0 first release candidate HOT 1
- [Contribution] How to run from Luci HOT 2
- Integrating opkg-upgrade in .profile - how to use background checking for new packages HOT 2
- ssmtp is not available on OpenWrt 21.02 and later
- Script ends with cancelled by user HOT 10
- Wish List - 2019/2020/2021/2022/2023 HOT 13
- Package for openwrt HOT 4
- Incorrect statement when no packages need updates HOT 8
- Optional removal of *-opkg from /etc/config after upgrade HOT 2
- Automatically check for new versions of opkg-upgrade HOT 3
- Does opkg: bump to version 2019-06-14 affect us? HOT 2
- Blacklist packages HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opkg-upgrade.