#!/bin/sh # Wget script to retrieve Patches from SunSolve.sun.com via https and # supply username and password. # copy from http://sunsolve.sun.com/search/document.do?assetkey=1-9-82023-1 # edit by: jal@jal.tw # ----Begin of user defined values ----- # Patch to wget WGETPATH="/usr/local/bin/" # Patch list file PATCHLIST="patch-list.txt" #Sun Login info. Modify with your account Sun account info. UserID="Change Your Name" UserPWD="Change Your Password" # Patch output directory # DOWNLOADIR="/tmp/patches" DOWNLOADIR="Change this" # Patch log directory # LOGDIR="/tmp/log" LOGDIR="Change this" # Proxy info WEBPROXY="" # Signed or unsigned patch setting # Valid values are "signed" or "unsigned". # "unsigned" patches are in zip format. # "signed" patches are in jar format. PATCHTYPE="unsigned" # ----End of user defined values ----- LOGFILE=$LOGDIR/patchlog_`date +%Y-%m-%d.%H%M%S` # Verify value for PATCHTYPE is correct. if [ ${PATCHTYPE} = "signed" ] || [ ${PATCHTYPE} = "unsigned" ];then echo "" else echo "PATCHVALUE not valid. Please correct." exit fi # Verify patch download directory exists. if [ ! -d $DOWNLOADIR ];then echo "" echo "$DOWNLOADIR patch download directory does not exist." echo "Please create directory $DOWNLOADIR." exit fi if [ ! -d $LOGDIR ];then echo "" echo "$LOGDIR patch log directory does not exist." echo "Please create directory $LOGDIR." exit fi if [ "$PATCHTYPE" = "unsigned" ];then for line in `cat ${PATCHLIST}`;do echo "" echo "Downloading unsigned patch ${line}." echo "" ${WGETPATH}/wget --http-user=${UserID} --http-passwd=${UserPWD} --no-check-certificate "https://sunsolve.sun.com/patchRedirnew.do?item=${line}" -O ${DOWNLOADIR}/${line}_`date +%Y-%m-%d`.zip >> ${LOGFILE} 2>&1 done elif [ "$PATCHTYPE" = "signed" ];then for line in `cat ${PATCHLIST}`;do echo "" echo "Downloading signed patch ${line}." echo "" ${WGETPATH}/wget --http-user=${UserID} --http-passwd=${UserPWD} --no-check-certificate "https://sunsolve.sun.com/patchRedirnew.do?item=${line}" -O ${DOWNLOADIR}/${line}_`date +%Y-%m-%d`.jar >> ${LOGFILE} 2>&1 done fi