#!/bin/sh # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #-------------------------------------------------------------------------- # installer.cgi # # Agent Installer CGI Shell Script # # This script is invoked from traffic_manager and does # the following # 1. Download upgrade_info file from ftp host to /tmp # 2. Check if upgrade_type is ADDON. If not quit. # 3. Download upgrade_file from ftp host to /tmp/agent-installer # 4. Unzip and untar upgrade_file # 5. Execute upgrade.sh as a background process # 6. Store output of upgrade.sh in $HTMLDIR/agent-installer/Mmm-DD-HH-MM-SS.txt file # #- echo "" echo "
" if [ -r etc/trafficserver/records.config.shadow ] then HTMLDIR=`grep "proxy\.config\.admin\.html_doc_root " etc/trafficserver/records.config.shadow | awk '{print $4}'` SERVERPORT=`grep "proxy\.config\.http\.server_port " etc/trafficserver/records.config.shadow | awk '{print $4}'` elif [ -r conf/yts/records.config ] then HTMLDIR=`grep "proxy\.config\.admin\.html_doc_root " etc/trafficserver/records.config | awk '{print $4}'` SERVERPORT=`grep "proxy\.config\.http\.server_port " etc/trafficserver/records.config | awk '{print $4}'` else HTMLDIR="../ui" SERVERPORT=8080 fi # Find out what OS we are running on OS=`uname` case $HTMLDIR in [!/]*) HTMLDIR=`pwd`\/$HTMLDIR echo "
" esac TSDIR="$ROOT" [ -z "$TSDIR" ] && TSDIR="$INST_ROOT" if [ "$OS" = "IRIX64" ] then [ -z "$TSDIR" ] && TSDIR=`/usr/bsd/head -1 /etc/traffic_server 2>/dev/null` else [ -z "$TSDIR" ] && TSDIR=`/usr/bin/head -1 /etc/traffic_server 2>/dev/null` fi [ -z "$TSDIR" ] && TSDIR="/home/trafficserver" echo Traffic Server is running in $TSDIR echo "
" #parse out parameters from QUERY_STRING eval `echo $QUERY_STRING | sed -e 's/'"'"'/%27/g' | \ awk 'BEGIN { RS="&"; FS="=" } $1 ~ /^[a-zA-Z][a-zA-Z0-9_]*$/ { printf "QS_%s=%c%s%c\n", $1, 39, $2, 39 }' | sed -e 's/+/ /g' ` echo FTP Server is $QS_ftp_server echo "
" QS_ftp_directory=`echo $QS_ftp_directory | sed -e 's/\%2F/\//g'` QS_ftp_directory=`echo $QS_ftp_directory | sed -e 's/\%7E/\~/g'` if [ "$QS_ftp_server" = "" ] then echo "Please go back using Back Button and fill in all four fields.
" echo "" exit fi if [ "$QS_ftp_directory" = "" ] then echo "Please go back using Back Button and fill in all four fields.
" echo "