Ver Fonte

Some bugs fixed in the agent install script. Tested.

DieFeM há 12 anos atrás
pai
commit
68e830bf2e
2 ficheiros alterados com 11 adições e 4 exclusões
  1. 4 2
      agent_conf.sh
  2. 7 2
      install.sh

+ 4 - 2
agent_conf.sh

@@ -21,11 +21,11 @@
 #
 
 if [ ! -z "$1" ]; then
-	opType="$1"
+	sudo_password="$1"
 fi
 
 if [ ! -z "$2" ]; then
-	sudo_password="$2"
+	opType="$2"
 fi
 
 readonly DEFAULT_PORT=12679
@@ -145,6 +145,8 @@ then
 	if [ $? != 0 ]
 	then
 		failed "Failed to write config file."
+	else
+		chmod 600 ${cfgfile} || failed "Failed to chmod ${cfgfile} to 600."
 	fi 
 
 	echo;

+ 7 - 2
install.sh

@@ -48,6 +48,12 @@ if [ ! -z "$4" ]; then
 	ogpInsPath="$4"
 fi
 
+failed()
+{
+	echo "ERROR: ${1}"
+	exit 1
+}
+
 if [ "X`which screen &> /dev/null;echo $?`" != "X0" ]; then
     failed "You need to install software called 'screen', before you can install OGP agent.";
 fi
@@ -228,7 +234,6 @@ echo;
 echo "Setting Permissions on files in ${agent_home}..."
 chmod 750 ${init_dir}/ogp_agent || failed "Failed to chmod ${init_dir}/ogp_agent to 750."
 chmod 750 ${agent_home}/ogp_agent.pl || failed "Failed to chmod ${agent_home}/ogp_agent.pl to 750."
-chmod 600 ${cfgfile} || failed "Failed to chmod ${cfgfile} to 600."
 chmod 750 ${agent_home}/ogp_agent_run || failed "Failed to chmod ${agent_home}/ogp_agent_run to 750."
 
 echo "Chmodding files to user ${username}...";
@@ -242,7 +247,7 @@ echo ""
 
 # Run the configuration script
 chmod +x ${agent_home}/agent_conf.sh
-bash ${agent_home}/agent_conf.sh $opType $sudo_password
+bash ${agent_home}/agent_conf.sh $sudo_password $opType
 
 echo;echo 
 echo "Installation complete!"