Reading password into script without echoing it

Have You ever wondered how to read password to the variable in the script without echoing it to the screen?
This is quite simple and can be written in just few lines:

oldSTTY=$(stty --save)
stty -echo
read -p "Password: " PASSWD; echo
stty $oldSTTY

1: You save all current settings of the terminal
2: You disable echoing of input characters to the screen
3: You read password into PASSWD variable
4: You restore all your terminal settings as it was before

As I said it is very simple and straightforward, isn’t it?

Firmware update for SUN/Oracle SPARC server

As I had to face this task recently I would like to describe in few steps how to perform firmware update on SUN Sparc servers using T4-1 as an example.

Phase 1. Preparation

1. We do not want any surprises later so before start we should do sanity system reboot, service processor restart and perform all required backups.
From the Solaris level:

# shutdown -i6 -g0 -y

From the ILOM level:

-> reset /SP

2. Download firmware from Oracle website, upload to the server and unzip.
3. Using sysfwdownload utility load new firmware to SP:

# ./sysfwdownload -g
# ./sysfwdownload Sun_System_Firmware-8_9_9-SPARC_T4-1.pkg

4. Next we stop our system:

 # /usr/sbin/shutdown -i0 -g0 -y

Phase 2. Update

1. Open ssh ILOM session and save base configuration:

->show /HOST/bootmode
->show /HOST
->show /SYS

2. Stop our server

->stop /SYS

3. Make sure that option keyswitch_state for /SYS is set to Normal:

-> show /SYS
-> set /SYS keyswitch_state=Normal

4. Check if firmware was uploaded properly and start the update

-> show /SP/firmware/localimage
-> load -source /SP/firmware/localimage

5. We can look on the update process and wait the ILOM restart and we can log in again.

Phase 3. Checks and system start

1. We have to ensure that host bootmode did not change. If You are using LDOM it might be critical for You.

-> show /HOST/bootmode

If needed we can change it:

-> set /HOST/bootmode="our-config-name"

2. Start system:

-> start /SYS

3. Open console and watch system booting:

-> start /HOST/console

4. If everything went fine and Solaris boots up we can finally confirm our new firmware version:

# prtdiag -v