Explorar el Código

Agent fix: Now install.sh passes the variable called "sudo_password" to agent_conf.sh as argument, and, if you run agent_conf.sh, it gets the password from Cfg/Config.pm.

DieFeM hace 12 años
padre
commit
8651b82fee
Se han modificado 2 ficheros con 10 adiciones y 1 borrados
  1. 9 0
      agent_conf.sh
  2. 1 1
      install.sh

+ 9 - 0
agent_conf.sh

@@ -24,6 +24,10 @@ if [ ! -z "$1" ]; then
 	opType="$1"
 	opType="$1"
 fi
 fi
 
 
+if [ ! -z "$2" ]; then
+	sudo_password="$2"
+fi
+
 readonly DEFAULT_PORT=12679
 readonly DEFAULT_PORT=12679
 readonly DEFAULT_IP=0.0.0.0
 readonly DEFAULT_IP=0.0.0.0
 readonly AGENT_VERSION='v1.0'
 readonly AGENT_VERSION='v1.0'
@@ -67,6 +71,11 @@ fi
 
 
 if [ "X${overwrite_config}" == "X1" ]
 if [ "X${overwrite_config}" == "X1" ]
 then
 then
+	if [ -z "$sudo_password" ]; then
+		if [ -f "$cfgfile" ]; then
+			sudo_password=`awk '/sudo_password/{print $3}' $cfgfile|sed -e "s#\('\)\(.*\)\(',\)#\2#"`
+		fi
+	fi
 	echo "#######################################################################"
 	echo "#######################################################################"
 	echo ""
 	echo ""
 	echo "OGP agent uses basic encryption to prevent unauthorized users from connecting"
 	echo "OGP agent uses basic encryption to prevent unauthorized users from connecting"

+ 1 - 1
install.sh

@@ -242,7 +242,7 @@ echo ""
 
 
 # Run the configuration script
 # Run the configuration script
 chmod +x ${agent_home}/agent_conf.sh
 chmod +x ${agent_home}/agent_conf.sh
-bash ${agent_home}/agent_conf.sh $opType
+bash ${agent_home}/agent_conf.sh $opType $sudo_password
 
 
 echo;echo 
 echo;echo 
 echo "Installation complete!"  
 echo "Installation complete!"