Преглед на файлове

Changes to Windows Installer - Removed SF Mirror and Defaulted FTP to FileZilla

own3mall преди 9 години
родител
ревизия
078015aa1f
променени са 3 файла, в които са добавени 60 реда и са изтрити 123 реда
  1. 3 63
      OGP/agent_conf.sh
  2. 56 51
      OGP/ogp_agent_run
  3. 1 9
      bin/ogp_agent

+ 3 - 63
OGP/agent_conf.sh

@@ -264,66 +264,6 @@ then
 		fi
 		fi
 		echo "You need to type 'yes', 'no' or leave empty for default value [yes]."
 		echo "You need to type 'yes', 'no' or leave empty for default value [yes]."
 	done
 	done
-
-	echo;
-	echo "What mirror you want to use for updating the agent?: "
-	echo;
-	echo "1  - SourceForge, Inc. (Chicago, Illinois, US)"
-	echo "2  - AARNet (Melbourne, Australia, AU)"
-	echo "3  - CityLan (Moscow, Russian Federation, RU)"
-	echo "4  - Free France (Paris, France, FR)"
-	echo "5  - garr.it (Ancona, Italy, IT)"
-	echo "6  - HEAnet (Ireland, IE)"
-	echo "7  - HiVelocity (Tampa, FL, US)"
-	echo "8  - Internode (Adelaide, Australia, AU)"
-	echo "9  - Japan Advanced Institute of Science and Technology (Nomi, Japan, JP)"
-	echo "10 - kaz.kz (Almaty, Kazakhstan, KZ)"
-	echo "11 - University of Kent (Canterbury, United Kingdom, GB)"
-	echo "12 - NetCologne (Köln, Germany, DE)"
-	echo "13 - Optimate-Server (Germany, DE)"
-	echo "14 - Softlayer (Dallas, TX, US)"
-	echo "15 - SURFnet (Zurich, Switzerland, CH)"
-	echo "16 - SWITCH (Zurich, Switzerland, CH)"
-	echo "17 - Centro de Computacao Cientifica e Software Livre (Curitiba, Brazil, BR)"
-	read setmirror
-	case ${setmirror} in
-		1) mirror="master"
-		;;
-		2) mirror="aarnet"
-		;;
-		3) mirror="citylan"
-		;;
-		4) mirror="freefr"
-		;;
-		5) mirror="garr"
-		;;
-		6) mirror="heanet"
-		;;
-		7) mirror="hivelocity"
-		;;
-		8) mirror="internode"
-		;;
-		9) mirror="jaist"
-		;;
-		10) mirror="kaz"
-		;;
-		11) mirror="kent"
-		;;
-		12) mirror="netcologne"
-		;;
-		13) mirror="optimate"
-		;;
-		14) mirror="softlayer-dal"
-		;;
-		15) mirror="surfnet"
-		;;
-		16) mirror="switch"
-		;;
-		17) mirror="ufpr"
-		;;
-		*) mirror="master"
-		;;
-	esac
 	
 	
 	echo;
 	echo;
 	while [ 1 ]
 	while [ 1 ]
@@ -584,7 +524,7 @@ then
 					echo "If you have installed the FileZilla Server,"
 					echo "If you have installed the FileZilla Server,"
 					echo "the agent can use it to create FTP accounts instead of using Pure-FTPd."
 					echo "the agent can use it to create FTP accounts instead of using Pure-FTPd."
 					echo "Would you like to configure this agent to use it?"
 					echo "Would you like to configure this agent to use it?"
-					echo -n "(yes|no) [Default no]: "
+					echo -n "(yes|no) [Default yes]: "
 					read FZ
 					read FZ
 					if [ "${FZ}" == "yes" -o "${FZ}" == "no" -o -z "${FZ}" ]
 					if [ "${FZ}" == "yes" -o "${FZ}" == "no" -o -z "${FZ}" ]
 					then
 					then
@@ -594,7 +534,7 @@ then
 				done
 				done
 			fi
 			fi
 			
 			
-			if [ "${FZ}" == "yes" ]; then
+			if [ "${FZ}" == "yes" ] || [ -z "${FZ}" ]; then
 				ftpMethod="FZ"
 				ftpMethod="FZ"
 				PF=$(cmd /Q /C echo %PROGRAMFILES\(X86\)% | sed 's/\r$//')
 				PF=$(cmd /Q /C echo %PROGRAMFILES\(X86\)% | sed 's/\r$//')
 				if [ "X${PF}" == "X" ];then PF=$(cmd /Q /C echo %PROGRAMFILES% | sed 's/\r$//'); fi
 				if [ "X${PF}" == "X" ];then PF=$(cmd /Q /C echo %PROGRAMFILES% | sed 's/\r$//'); fi
@@ -706,7 +646,7 @@ then
 
 
 	echo "Writing bash script preferences file - $bashprefsfile"
 	echo "Writing bash script preferences file - $bashprefsfile"
 	
 	
-	echo -e "agent_auto_update=${autoUpdate}\nsf_update_mirror=${mirror}\nrun_pureftpd=${run_pureftpd}\nftp_port=${ftp_port}\nftp_ip=${ftp_ip}\nftp_pasv_range=${ftp_pasv_range}" > $bashprefsfile
+	echo -e "agent_auto_update=${autoUpdate}\nrun_pureftpd=${run_pureftpd}\nftp_port=${ftp_port}\nftp_ip=${ftp_ip}\nftp_pasv_range=${ftp_pasv_range}" > $bashprefsfile
 	
 	
 	if [ $? != 0 ]
 	if [ $? != 0 ]
 	then
 	then

+ 56 - 51
OGP/ogp_agent_run

@@ -7,6 +7,13 @@
 #
 #
 # The ogp_agent_run script should be at the top level of the agent tree
 # The ogp_agent_run script should be at the top level of the agent tree
 # Make sure we are in that directory since the script assumes this is the case
 # Make sure we are in that directory since the script assumes this is the case
+
+
+########################
+#       NOTICE         #
+########################
+# THIS FILE IS NOT USED FOR OGP WIN AGENT?  It looks like it uses ogp_agent in BIN folder
+
 AGENTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 AGENTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 BASH_PREFS_CONF="$AGENTDIR/Cfg/bash_prefs.cfg" 
 BASH_PREFS_CONF="$AGENTDIR/Cfg/bash_prefs.cfg" 
 chmod -Rf 770 $AGENTDIR
 chmod -Rf 770 $AGENTDIR
@@ -56,16 +63,8 @@ init() {
 		then
 		then
 			AUTO_UPDATE="yes"
 			AUTO_UPDATE="yes"
 		fi
 		fi
-		
-		if [ -z "$sf_update_mirror" ]
-		then
-			MIRROR="master"
-		else
-			MIRROR=$sf_update_mirror
-		fi
 	else
 	else
 		AUTO_UPDATE="yes"
 		AUTO_UPDATE="yes"
-		MIRROR="master"
 	fi
 	fi
 	
 	
 	while test $# -gt 0; do
 	while test $# -gt 0; do
@@ -140,58 +139,64 @@ update() {
 			fi
 			fi
 			cd $AGENTDIR
 			cd $AGENTDIR
 			rm -Rf tmp
 			rm -Rf tmp
-			CURRENT=$(cat $AGENTDIR/Cfg/Config.pm | grep version | grep -Eo '[0-9]{1,6}')
-			REVISION=$(curl -L -b "FreedomCookie=true;path=/;expires=$expires" -s https://sourceforge.net/projects/ogpextras/rss?path=/Alternative-Snapshot\&limit=3 | grep -m 1 "title.*hldstart-code-" | grep -o -P '(?<=hldstart-code-).*(?=.zip)')
-			if [ "$CURRENT" == "$REVISION" ]; then
-				echo "The agent is up to date."
-			else
-				URL=https://${MIRROR}.dl.sourceforge.net/project/ogpextras/Alternative-Snapshot/linux-agent-${REVISION}.zip
-				HEAD=$(curl -L --insecure -b "FreedomCookie=true;path=/;expires=$expires" -Os --head -w "%{http_code}" "$URL")
-				if [ "$HEAD" == "200" ]; then
-					echo "Updating agent using curl."
-					curl -L --insecure -b "FreedomCookie=true;path=/;expires=$expires" -Os $URL
-					if test $? -ne 0; then
-						echo "`date`: curl failed to download the update package."
-					else
-						unzip -oq linux-agent-${REVISION}.zip
+			CURRENT=$(cat $AGENTDIR/Cfg/Config.pm | grep version | egrep -o "([a-f0-9]{40})")
+			REVISION=`curl -L -k -s https://github.com/OpenGamePanel/OGP-Agent-Windows/commits/master.atom | egrep -o "([a-f0-9]{40})" | awk 'NR==1{print $1}'`
+			if [ ! -z "$REVISION" ]; then
+				if [ "$CURRENT" == "$REVISION" ]; then
+					echo "The agent is up to date."
+				else
+					URL=https://github.com/OpenGamePanel/OGP-Agent-Windows/archive/master.zip
+					HEAD=$(curl -LOks --head -w "%{http_code}" "$URL")
+					if [ "$HEAD" == "200" ]; then
+						echo "Updating agent using curl."
+						curl -LOks "$URL"
 						if test $? -ne 0; then
 						if test $? -ne 0; then
-							echo "`date`: Unable to unzip the update package."
-							echo "cleaning up..."
-							rm -Rf linux-agent-* &> /dev/null
+							echo "`date`: curl failed to download the update package."
 						else
 						else
-							cd linux-agent-${REVISION}
-							cp -avf Schedule Time FastDownload php-query ogp_agent.pl ogp_screenrc ogp_agent_run agent_conf.sh $AGENTDIR &> /dev/null
+							unzip -oq master.zip
 							if test $? -ne 0; then
 							if test $? -ne 0; then
-								echo "`date`: The agent files cannot be overwritten."
-								echo "Cleaning up..."
-								cd ..
+								echo "`date`: Unable to unzip the update package."
+								echo "cleaning up..."
 								rm -Rf linux-agent-* &> /dev/null
 								rm -Rf linux-agent-* &> /dev/null
-								echo "Agent update failed."
 							else
 							else
-								if test ! -d "$AGENTDIR/IspConfig"; then
-									cp -Rf IspConfig $AGENTDIR/IspConfig &> /dev/null
-								fi
-								if test ! -d "$AGENTDIR/EHCP"; then
-									cp -Rf EHCP $AGENTDIR/EHCP &> /dev/null
-								fi
-								if test ! -f "$AGENTDIR/Cfg/Preferences.pm"; then
-									cp -f Cfg/Preferences.pm $AGENTDIR/Cfg/Preferences.pm &> /dev/null
+								if [ -e "OGP-Agent-Windows-master/OGP" ]; then
+									cd OGP-Agent-Windows-master/OGP
+									cp -avf Schedule Time FastDownload php-query ogp_agent.pl ogp_screenrc ogp_agent_run agent_conf.sh $AGENTDIR &> /dev/null
+									if test $? -ne 0; then
+										echo "`date`: The agent files cannot be overwritten."
+										echo "Cleaning up..."
+										cd ..
+										cd ..
+										rm -Rf OGP-Agent-Windows* &> /dev/null
+										echo "Agent update failed."
+									else
+										if test ! -d "$AGENTDIR/IspConfig"; then
+											cp -Rf IspConfig $AGENTDIR/IspConfig &> /dev/null
+										fi
+										if test ! -d "$AGENTDIR/EHCP"; then
+											cp -Rf EHCP $AGENTDIR/EHCP &> /dev/null
+										fi
+										if test ! -f "$AGENTDIR/Cfg/Preferences.pm"; then
+											cp -f Cfg/Preferences.pm $AGENTDIR/Cfg/Preferences.pm &> /dev/null
+										fi
+										echo "Fixing permissions..."
+										chmod ug+x $AGENTDIR/ogp_agent.pl &> /dev/null
+										chmod ug+x $AGENTDIR/ogp_agent_run &> /dev/null
+										chmod ug+x $AGENTDIR/agent_conf.sh &> /dev/null
+										echo "Cleaning up..."
+										cd ..
+										cd ..
+										rm -Rf OGP-Agent-Windows* &> /dev/null
+										sed -i "s/version.*/version => 'v${REVISION}',/" $AGENTDIR/Cfg/Config.pm
+										echo "Agent updated successfully."
+									fi
 								fi
 								fi
-								echo "Fixing permissions..."
-								chmod ug+x $AGENTDIR/ogp_agent.pl &> /dev/null
-								chmod ug+x $AGENTDIR/ogp_agent_run &> /dev/null
-								chmod ug+x $AGENTDIR/agent_conf.sh &> /dev/null
-								echo "Cleaning up..."
-								cd ..
-								rm -Rf linux-agent-* &> /dev/null
-								sed -i "s/version.*/version => 'v${REVISION}',/" $AGENTDIR/Cfg/Config.pm
-								echo "Agent updated successfully."
 							fi
 							fi
 						fi
 						fi
+					else
+						echo "There is a update available (${REVISION}) but the download source is not ready.";
+						echo "Try again later."
 					fi
 					fi
-				else
-					echo "There is a update available (${REVISION}) but the download source is not ready.";
-					echo "Try again later."
 				fi
 				fi
 			fi
 			fi
 		else
 		else

+ 1 - 9
bin/ogp_agent

@@ -58,16 +58,8 @@ then
 	else
 	else
 		FTP_PASV_STRING=""
 		FTP_PASV_STRING=""
 	fi
 	fi
-	
-	if [ -z "$sf_update_mirror" ]
-	then
-		MIRROR="master"
-	else
-		MIRROR=$sf_update_mirror
-	fi
 else
 else
 	AUTO_UPDATE="yes"
 	AUTO_UPDATE="yes"
-	MIRROR="master"
 	RUN_PUREFTPD="yes"
 	RUN_PUREFTPD="yes"
 	FTP_IP="0.0.0.0"
 	FTP_IP="0.0.0.0"
 	FTP_PORT="21"
 	FTP_PORT="21"
@@ -300,4 +292,4 @@ init $*
 run
 run
 
 
 # Quit normally
 # Quit normally
-quit 0
+quit 0