Commits

Erik Southworth  committed d899c19 Draft

init support for Steam Console Client (c) Valve Corporation

  • Participants
  • Parent commits 1f01d88

Comments (0)

Files changed (2)

File src/boiler.in

 : ${REMOVE="rm"}
 : ${REMOVE_EMPTY_DIR="rmdir"}
 : ${SYMLINK="ln --symbolic --force --no-dereference"}
+: ${UNPACK="tar -xvf"}
 
 # [steam]
 CONFDIR="$HOME"/Steam
 HLDSUPDATETOOL=${PKGDATADIR}/hldsupdatetool
 STEAMBIN=${CONFDIR}/steam
 
+# [steamcmd]
+STEAMCMD=${PKGDATADIR}/steamcmd.tar.gz
+CONSOLEBIN=${CONFDIR}/steam.sh
+
 usage()
 {
 cat << EOT
   -a, --verify_all          verifies all files are up to date (over-write control)
   -r, --retry               retry every 30sec if Steam Network is busy
   -s, --nobootstrapupdate   do not check for updates to the update tool
+  -i, --interactive         drop into the Steam Console Client (c) Valve Corporation
 EOT
 )
 
 	usage_login=$(cat << EOT
   -u, --username=USERNAME   steam account username (only needed to access limited content)
   -p, --password=PASSWORD   steam account password (only needed to access limited content)
-  -t, --remember_password   remember password (if a username is supplied)
+  -f, --remember_password   remember password (if a username is supplied)
 EOT
 )
 
   -V, --version             display version and copyright information
   -w, --wipe, wipe [PATH]   remove blob files (ClientRegistry, InstallRecord from PATH)
   -b, --beta=NAME           name of beta update
-  -i, --info                beta help information
+  -e, --info                beta help information
   -m, --manual              output manual text
   -v, --verbose             verbose operation
   -n, --noionice            disable ionice operation
 )
 
 	# policy: acceptable options
-	_short_opts=c:g:d:arsu:p:thVwb:imvn
-	_long_opts=command:,game:,dir:,verify_all,retry,nobootstrapupdate,username:,password:,remember_password,help,version,wipe,beta:,info,manual,verbose,noionice
+	_short_opts=c:g:d:arsu:p:fhVwb:emvni
+	_long_opts=command:,game:,dir:,verify_all,retry,nobootstrapupdate,username:,password:,remember_password,help,version,wipe,beta:,info,manual,verbose,noionice,console
 
 	# disable shell errexit
 	if test -o errexit; then set +e; _errexit=1; fi
 	    -s|--nobootstrapupdate) cmd+=("-nobootstrapupdate"); shift;;
 	    -u|--username) cmd+=("-username" "${2}"); shift 2;;
 	    -p|--password) cmd+=("-password" "${2}"); shift 2;;
-	    -t|--remember_password) cmd+=("-remember_password"); shift;;
+	    -f|--remember_password) cmd+=("-remember_password"); shift;;
 	    -h|--help) opt_is_help=1; shift;;
 	    -V|--version) version;;
 	    -w|--wipe) cmd+=("-wipe"); opt_is_wipe=1; shift;;
 	    -b|--beta) cmd+=("-beta" "${2}"); shift 2;;
-	    -i|--info) betainfo;;
+	    -e|--info) betainfo;;
 	    -m|--manual) manual;;
 	    -v|--verbose) opt_is_verbose=1; shift;;
 	    -n|--noionice) opt_is_noionice=1; shift;;
+	    -i|--interactive) steam_cmd;;
 	       --) shift; break;;
 	    *) echo "internal error: uncaught option \`${1}'" >/dev/stderr; exit 2;;
 	    esac
 	# parse positional arguments
 	if test $# -gt 0; then
 	    case "${1}" in
+	    console) steam_cmd;;
 	    help) opt_is_help=1; shift;;
 	    wipe)
 		cmd+=("-wipe"); opt_is_wipe=1;
 	${error:?Executing: \`${BIN} ${cmd[@]}\' in ($iter) tries: exited with exit code ${RETVAL-$?}}
 }
 
+# call steam console
+steam_cmd()
+{
+	_check_steamcmd_install
+
+	# retry N times if there is an update/failure
+	i=0; iter=3
+	while [ $i -lt $iter ]; do
+	    [ $i -gt 0 ] && test ! ${operation_is_silent} && printf "${YELLOW}+ Retrying command ...${NORMAL}\n"
+
+	    if test ${operation_is_silent}; then
+		(STEAMEXE=steamcmd "${CONSOLEBIN}" &>/dev/null)
+	    elif test ${opt_is_verbose}; then
+		(STEAMEXE=steamcmd "${CONSOLEBIN}")
+	    else
+		(STEAMEXE=steamcmd "${CONSOLEBIN}" 2>/dev/null)
+	    fi
+
+	    if [ $? -eq 0 ]; then break; fi
+	    i=$(($i+1))
+	done
+	[ $i -eq 3 ] &&
+	${error:?Executing: \`${BIN} ${cmd[@]}\' in ($iter) tries: exited with exit code ${RETVAL-$?}}
+	exit
+}
+
 # steam program installation
 _check_steambin_install()
 {
 	fi
 }
 
+# steam console installation
+_check_steamcmd_install()
+{
+	# sanity check, steamcmd executable?
+	if ! test -x "${CONSOLEBIN}"; then
+	    # sanity check, CONFDIR exists?
+	    if ! test -d "${CONFDIR}"; then
+		$INSTALL_DIR "${CONFDIR}" &&
+		printf "${YELLOW}+ Creating directory ${CONFDIR} ...${NORMAL}\n" ||
+		${error:?Creating directory ${CONFDIR}: exited with exit code ${RETVAL-$?}}
+	    fi
+
+	    # install users steamcmd
+	    cd "${CONFDIR}"
+	    $UNPACK "${STEAMCMD}" &&
+	    printf "${YELLOW}+ Installing ${STEAMCMD} to ${CONFDIR} ...${NORMAL}\n" ||
+	    ${error:?Installing ${STEAMCMD} to ${CONSOLEBIN}: exited with exit code ${RETVAL-$?}}
+	fi
+}
+
 # check steam workon dir
 _check_steam_installdir()
 {
 APPNAME = 'steam-boiler'
 
 NAME = 'Steam Boiler'
-VERSION = '49'
+VERSION = '50'
 BUGREPORT = 'http://bitbucket.org/superstition/steam-boiler/issues/'
 HOMEPAGE = 'http://bitbucket.org/superstition/steam-boiler/wiki/'
 RELEASE = '2009,2010,2011,2012'
-REVISION = '29 July 2012'
+REVISION = '04 August 2012'
 
 top = '.'
 out = 'build'
 	ctx.env['PKGDATADIR'] = ctx.env['DATADIR'] + '/' + APPNAME
 
 def build(ctx):
-	ctx.recurse(['hldsupdatetool', 'src'])
+	ctx.recurse(['hldsupdatetool', 'src', 'steamcmd'])
 
 	# build requirements
 	if ctx.env['MAINTAINER']:
 		ctx.recurse(['doc'])
 
 def dist_hook():
+	# pkg steamcmd(console)
+	dir = os.path.join(os.pardir, out, '../steamcmd/')
+	for file in ['steamcmd.tar.gz']:
+		shutil.copy2(dir+file, 'steamcmd')
+
 	# pkg steam(hldsupdatetool)
 	dir = os.path.join(os.pardir, out, 'default/hldsupdatetool/')
 	for file in ['hldsupdatetool', 'LICENSE', 'README']: