관리-도구
편집 파일: CP058234.scexe
#!/bin/bash CPBASENAME="$(basename $0 .scexe)" RUNDIR='/usr/lib/x86_64-linux-gnu/firmware-nic-is-marvell-flq-8.55.12-1.1' INSTALL_EXE_NAME="hpsetup" _TMPDIR=${CPBASENAME}-$$ ############### # Script Die ############### Die() { rm -rf $_TMPFILE $_TMPDIR; exit $@; } ############### # Script Unpack ############### Unpack() { _UNPACK_DIR=$1 #if the directory exists we can proceed. If not, create it. if [ -d $_UNPACK_DIR ] #if the FILE exists AND is a direcotry... then : #do nothing else if [ -f $_UNPACK_DIR ] #the FILE exists but isn't a directory then echo "$0: File already exists: $_UNPACK_DIR" >&2 Die 3 else #if the FILE does not exist... mkdir -p $_UNPACK_DIR if [ "$?" != "0" ] then echo "$0: cannot create directory $_UNPACK_DIR" >&2 Die 3 fi fi fi cp -r "${RUNDIR}"/. "${_UNPACK_DIR}"/ if [ "$?" != "0" ] then echo $0: Cannot decompress $0 >&2 Die 3 fi _RESULT=0 } while true do case $1 in --) shift; break ;; --unpack) echo "$0: Required parameter missing" >&2; Die 3 ;; --unpack=*) { _TARGET_DIR=`echo $1 | cut -b 10- -`; if test -z $_TARGET_DIR; then { echo "$0: Required parameter missing" >&2; Die 3; } else { _UNPACK=1; } fi } break ;; --tmp) echo "$0: Required parameter missing" >&2; Die 3 ;; --tmp=*) { _TMPDIR=`echo $1 | cut -b 7- -`; shift; if test -z $_TMPDIR; then { echo "$0: Required parameter missing" >&2; Die 3; } fi if test -d "$_TMPDIR"; then { _TMPDIR="$_TMPDIR"/sctmpdir$$ } else { echo "$0: The path specified by the --tmp option is not valid or does not exist" >&2; Die 3; } fi } break ;; *) break ;; esac done for argss in $@ do if [ "$argss" = "-SMPJTB" ] || [ "$argss" = "--SMPJTB" ] || [ "$argss" = "/SMPJTB" ] then _HPSUM=1 fi done # #check that all programs we need are present on the path. _DEPS="tar gzip tail sleep rm ln mkdir mktemp echo" which $_DEPS > /dev/null if [ "$?" != "0" ] then echo "$0: cannot find a required program." >&2 echo "Make sure these programs are on the path: $_DEPS" >&2 Die 3 fi if [ "$_UNPACK" = "1" ] then Unpack $_TARGET_DIR else CWD=$(pwd) cd /var/tmp test -d ./${_TMPDIR} && rm -rf ./${_TMPDIR} mkdir -p ./${_TMPDIR} cp -r "${RUNDIR}"/. ./"${_TMPDIR}"/ cd ./"${_TMPDIR}" OLDIFW=${IFS} IFS=$'\0' ./"${INSTALL_EXE_NAME}" --skip-pre $* RETCODE=$? IFS=${OLDIFW} cd /var/tmp rm -rf ./"${_TMPDIR}" cd "${CWD}" exit "${RETCODE}" fi