Software: Apache/2.0.54 (Fedora). PHP/5.0.4 uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 uid=48(apache) gid=48(apache) groups=48(apache) Safe-mode: OFF (not secure) /usr/bin/ drwxr-xr-x |
Viewing file: Select action/file-type: #!/bin/bash # This is a script to run to get a system bootstrapped for rhn # # This script needs to run as root # create /var/spool/up2date if it doesnt exist # use that dir since it's root read only and will # need to be around for up2date anyway. Avoid all # the /tmp madness that way SPOOLDIR=/var/spool/up2date if [ ! -d $SPOOLDIR ] ; then mkdir -p $SPOOLDIR fi SCRIPT_URL="http://rhn.redhat.com/bootstrap/update-up2date.py" # this is a root only dir, shouldnt need to worry about predictable filenames # but we can add a mkstemp here if needbe FILENAME="$SPOOLDIR/update-up2date.py" # we need to fetch a file from the network, heres # rundown of the methods available to us: # fetchFile_lynx() { echo "using lynx" URL="$1" filename="$2" if [ ! -f /usr/bin/lynx ] ; then return 1 fi lynx -source $URL > $filename return $? } fetchFile_wget() { echo "attempting to use wget" if [ ! -f /usr/bin/wget ] ; then return 1 fi URL="$1" filename="$2" wget -q $URL -O $filename return $? } fetchFile_curl() { echo "Attempting to use curl" if [ ! -f /usr/bin/curl ] ; then return 1 fi URL="$1" filename="$2" curl -o $filename $URL return $? } # this is just twisted # most of the code for this is actually from nalin, so blame him ;-> fetchFile_bash2() { #FIXME: find a way to tell if were bash1/bash2 # Break up the URL. URL="$1" filename="$2" tmphost=`echo "$URL" | (IFS=/ read scheme blank host get; echo ${host})` get=`echo "$URL" | (IFS=/ read scheme blank host get; echo ${get})` host=`echo "$tmphost" | (IFS=: read host port; echo ${host})` port=`echo "$tmphost" | (IFS=: read host port; echo ${port})` if [ "x$port" == "x" ] ; then port=80 fi # Save a copy of the stdout stream, and then redirect stdio to the web. exec 3>&1 exec < /dev/tcp/${host}/${port} >&0 # Send the query. We even support virtual hosting by sending a Host: header. echo GET /${get} HTTP/1.1 echo User-Agent: bash ${BASH_VERSION} echo Host: ${host} echo "" # Print the results, switching from stderr to stdout when a blank CR-LF # is sent without anything else. > $filename file="/dev/null" while read line ; do if [ "$line" = ] ; then file="$filename" continue fi echo "$line" >> $file done #umm, one minor detail is that I havent quite figured out how to #get stdout back yet return 0 } fetchmethods="fetchFile_lynx fetchFile_wget fetchFile_curl fetchFile_bash2" fetchFile() { URL="$1" filename="$2" for method in $fetchmethods do $method $URL $filename retval=$? if [ $retval -ne 1 ] ; then break fi done } fetchFile "$SCRIPT_URL" "$FILENAME" exit_status=$? # okay, now run the script chmod a+x $FILENAME exec $FILENAME |
:: Command execute :: | |
--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0032 ]-- |