Packaging with the Solaris IPS
I needed to package some software for Solaris 11 and of course wanted to use the Image Packaging System, IPS, the new package management system that replaces the old SVR4 package format that Solaris 10 and previous releases used. To the casual observer, it looks like IPS brings "easy" package management to Solaris - it is now possible to quickly search for - and install - a package from the internet, and updates are easily retrieved as well. This seems to work smoothly - just like on Debian for example - which has had this functionality for more than a decade... Well, better late than never!
Since the system is not just new, but quite different from what it replaces, I started looking for primers and tutorials to figure out how to get started. A word of caution: IPS does things differently, and there are some tutorials on the net which attempt to fight IPS instead of working with it - this leads to complicated and silly ways of building packages the wrong way, and this will cause problems for your end users. What you really want, is to go to the official Oracle documentation and read the developer guide which is well written and does a very good job of explaining why IPS is different and walks you through an example of creating a package.
So far, I am fairly impressed with IPS - it is the first packaging system (and I have used quite a few - from DEC Unix and HP-UX to NetWare, Debian, Red Hat, Windows and what have you) where I did not have to script to create a user account. Scripting, by the way, is disallowed by IPS for the simple reason that you cannot validate a package if the installation executes scripts because you cannot (generally) validate the result of a script. Instead of using all the provided tools for generating manifests from older packages, I simply wrote the .p5m manifest files myself and generated .p5p repository archives from them. In the future I guess I should make sure the repositories are on-line, so that the users can get their software updates along with the operating system updates when they run pkg update.
Autologin on (Oracle) Sun Unified 7000 systems
Having just received a Sun Unified storage system at work (basically two amd64 based servers and two disk shelves full of high capacity disks coupled with some read flash and fancy write optimized flash), I wanted to put the "dashboard" page from the web UI on a big screen on the wall so that everyone that walks by can see the current status of the system.
The system has an absolutely fantastic web based user interface. It even supports the creation of "kiosk" users - accounts that are limited to viewing only the dashboard. Just what I needed... However, there is no (documented) way of actually having a kiosk session automatically log on to the system, so that it could function like, well, a kiosk session.
The usual way of accomplishing this in a web interface, would be to allow the user to supply a &username= and &password= argument on the URL. It is simple and it works, and for a kiosk session that is locked down anyway, it is perfectly safe. This, however, is not possible on the 7000 series as the entire login page is not a form - it is a fairly empty piece of HTML that is then populated with DIVs by a lot of JavaScript.
Firefox, firebug and greasemonkey to the rescue! Using firebug I managed to figure out how to fill in the username and password values in the input fields and call the .click() method on the "login" button. To my surprise, even though the username and password fields were visibly filled in correctly, the click on the button prompted an error messaage saying I should "Enter a username". It seems someone really went out of their way to make sure that I would not get any real work done today...
After reading a lot of the JavaScript that was used to build up the login page, I could see that the "keyup" event was significant. It caused the input elemen .value to be assigned to some other variable which was then later used in other methods for the actual user authentication. Calling all those methods in the right order and even accessing them turned out to be a bit out of my JavaScript abilities.
In order to get the login code to run, I simply assigned the username of the kiosk user to the username input element .value, then create a UIEvent of type keyup and dispatch it to that element. Then the same is done for the password input, and finally the .click() method is called on the login button. This solved the problem in my test setup.
Then, a greasemonkey .user.js was created to automate this whenever the logon page would be shown. This, however, did not work. Of course, since the page is almost blank once it finishes loading and greasemonkey runs the JavaScritp that I supplied, there is no way my code can find the username and password entries - they simply do not exist yet. The JavaScript referenced from the nearly empty page must finish executing first. The solution - ugly but functional - is to delay the execution of my code by five seconds. This gives plenty of time for the page to materialize.
So, if you decide to purchase a Sun Unified 7000 series storage system and you want a kiosk user to access the dashboard, you can download the greasemonkey user script here.