Back to the main page

A system registration with Sun

The smpatch is great toor for analyze/download/apply/remove Solaris patches (has so many features so check man page).
But in order to use it, you'll have to register with Sun (so ask your company to get Sun Online Account :)
Once you have the account, you can use the script below for a host registration. The script will prompt you for username/password and that's it.
The script is using sconadm utility for registration.
After this you'll be able to enjoy 'smpatch' tool.
# script for registering host with registration server   
#set -x    
stty -echo # turn off automatic printing = echoing   
echo "\n This script will registed the system with Sun, so you can use smpatch command."   
printf "Please enter your Sun service username (not shown on the screen) : \n"   
read username < /dev/tty 
printf "Please enter your password (not shown on the screen): \n"   
read password < /dev/tty   
stty echo # restore automatic printing = echoing   
cd /tmp || exit 1   

umask 022   
sleep 1   

echo Creating file registrationprofile.`uname -a |awk '{print $2}'`   

# Creating file registration profile
touch registrationprofile.`uname -a |awk '{print $2}'`   
	echo userName="$username" > registrationprofile.`uname -a |awk '{print $2}'`   
	echo password="$password" >> registrationprofile.`uname -a |awk '{print $2}'`   
	echo hostName=`uname -a |awk '{print $2}'` >> registrationprofile.`uname -a |awk '{print $2}'`   
	echo subscriptionKey= >> registrationprofile.`uname -a |awk '{print $2}'`   
	echo portalEnabled=false >> registrationprofile.`uname -a |awk '{print $2}'`   
	echo proxyHostName= >> registrationprofile.`uname -a |awk '{print $2}'` 
	echo proxyPort= >> registrationprofile.`uname -a |awk '{print $2}'`   
	echo proxyUserName= >> registrationprofile.`uname -a |awk '{print $2}'`   
	echo proxyPassword= >> registrationprofile.`uname -a |awk '{print $2}'`   
sleep 1   
echo The file registrationprofile.`uname -a |awk '{print $2}'` has been created   
chmod 600 registrationprofile.`uname -a |awk '{print $2}'` || exit 2   
echo "\n Registering the system with Sun, please wait."   

/usr/sbin/sconadm register -a -r /tmp/registrationprofile.`uname -a |awk '{print $2}'` || exit 3   
sleep 3   
echo "Deleting file registrationprofile.`uname -a |awk '{print $2}'` (contains username and password) \n "   

rm /tmp/registrationprofile.`uname -a |awk '{print $2}'` || exit 4   

exit 0   

Back to the main page