ATV2 and iOS nightly build semi automatic update scripts - Printable Version
+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: Kodi General Help and Support (/forumdisplay.php?fid=111)
+---- Forum: iOS support (/forumdisplay.php?fid=137)
+---- Thread: ATV2 and iOS nightly build semi automatic update scripts (/showthread.php?tid=108142)
ATV2 and iOS nightly build semi automatic update scripts - durniplot - 2011-08-19 21:18
So, I like to automate things, and I hate to type the same stuff over and over. The script below is what I just put together to simplify updating to the latest nightly build (from the official repository, that is http://mirrors.xbmc.org/nightlies/darwin/atv2/):
What this script does is to first download the file listing from the atv2 builds directory, parse out the name of the topmost build (which should be the newest), and then download and install this package.
I am sure there is plenty of room for improvement, I haven't really made a shell script in about 10 years, so my script-fu is kinda rusty... But hey, this works for me. :-)
The easiest way to get this script on your ATV2 is probably to ssh to the box (I use PuTTY for this) and simply paste the following into your terminal (everything in one go works fine) and press enter:
Do remember to press enter, or your script won't be executable.
Now, whenever you'd like to update, you just ssh to your ATV2 and type this:
With PuTTY, and probably other ssh clients aswell, you can even tell it to run the above command automatically when you connect to the ATV2, if you'd prefer not to type anything at all except login and password. In session settings, go to Connection > SSH and put ./xbmcup.sh in "Remote command" and save your session). Now, when you connect with this session, instead of an interactive shell, PuTTY will trigger the script, and then disconnect and close its window when the update is finished.
Here's a URL to a picture showing the correct spot in the settings dialog:
For absolutely no typing, pair this with ssh keys instead of a logon password and you've got a completely automated updater triggered from your PC.
I will be adapting the script for the iOS (iPad) builds later - if there is any interest I'll post that one, too.
iOS nightly build semi automatic update script - durniplot - 2011-08-20 08:51
Alright, not much interest it seems, but I'll post the iOS (works for iPad 2 - no other devices tested) script anyways.
For this to work you might need to install gawk (type apt-get install gawk) first. Apparently there is no head command on the ipad, so the script is slightly different. Also, obviously the download location and package name is also a little bit different from the atv2 builds
Here is what it looks like:
Once again, the easiest way to get this as a script on your iDevice is probably to just paste the following into your ssh terminal window:
Remember to press enter after the last line.
Performing an update is now as easy as typing the following into your shell:
Hints and tips regarding PuTTY for ATV2 applies here, aswell.
- durniplot - 2011-08-20 08:59
I couldn't figure out how to change the actual thread's title to "ATV2 and iOS nightly build semi automatic update scripts". If someone can, please do.
- djboa - 2011-08-20 09:42
Thanks a bunch! works fine here, and I can tell it will save me lots of time when upgrading to nightlies from now on.
- rickrude - 2011-08-20 09:47
I think it's a good idea, I will probably use this (with cron?), but will add to it so that it SCP's a copy of the nightly build to my server, and perhaps an argument to roll back would be nice too
- Cheunce - 2011-08-20 09:50
Thank you. Excellent script
- rickrude - 2011-08-20 10:37
Cheunce Wrote:Thank you. Excellent script
I must agree, it works well, and now to automate it. I added a quick and dirty if file exists statement to it, and also an scp copy to my nas.
This works for me, but I am not fluent in bash scripting, so if there is a better way, please do tell.
oh, and it works without password for scp'ing because I have added public key to file server.
Thanks for the script!
- Doombelly - 2011-08-20 10:41
This script is great.. thank you!
- canadave - 2011-08-20 13:27
I haven't tried this script yet, but it looks awesome. One question--is there a way to incorporate this into another small script that also automates connecting to the ATV2 via ssh? i.e. something where I could just open my terminal window on my mac, type in a command, and the script will automatically connect to the ATV2 and run the update script?
- durniplot - 2011-08-20 14:47
canadave Wrote:I haven't tried this script yet, but it looks awesome. One question--is there a way to incorporate this into another small script that also automates connecting to the ATV2 via ssh? i.e. something where I could just open my terminal window on my mac, type in a command, and the script will automatically connect to the ATV2 and run the update script?
No clue about Mac OS really, but something like this should work:
.. where iDevice is the hostname or ip-adress assigned to your appletv/ipad/etc.
This will still require you to type in root's password upon connection. Look into ssh keys to get rid of that part too.
You could probably store the above command line in some sort of script file and associate it with an icon in your dock or similar, too, and have a one-click upgrade gadget :-)
- crispytreat - 2011-08-20 21:43
Worked great for me.
- blackranger3d - 2011-08-22 01:53
Woot! Good job thanks man.
- stubbed - 2011-08-22 03:32
The only thing I would suggest is rather than removing the last installed .deb file, why not give the option to keep the last .deb file in case there are issues with the latest nightly?
- davilla - 2011-08-22 04:08
I highly recommend AGAINST automating a nightly download/install. I mean, come on, it's like two commands, wget to fetch and dpkg -i to install.
If you rely on a script to download/install, then you will be lost when it comes time to revert or remove a bad nightly.
- canadave - 2011-08-24 16:52
davilla Wrote:I highly recommend AGAINST automating a nightly download/install. I mean, come on, it's like two commands, wget to fetch and dpkg -i to install.Well, to be fair, there's a *little* more to it than that You have to go find the name of the last nightly too, copy/paste it into Terminal, etc. Agreed, the step-by-step process is not exactly onerous, but..... "./xbmcup.sh" is pretty simple to type in.
davilla Wrote:If you rely on a script to download/install, then you will be lost when it comes time to revert or remove a bad nightly.I'm not sure I understand what you mean by saying we'll be "lost" if we've been using a script and need to revert/remove a nightly. Are you saying we won't know how?