Browse Source

Updated method init

Paolo Galli 4 years ago
parent
commit
5f39d33d89
1 changed files with 24 additions and 25 deletions
  1. 24 25
      lcmlog-server-utils

+ 24 - 25
lcmlog-server-utils

@@ -37,7 +37,6 @@ method_init()
 {
 	if ! [ -d $DIR ]; then
 		echo "Folder $DIR not present: you should create it first!"
-		exit 0
 	else
 		# auth folder
 		if [ -d $DIR/auth ]; then
@@ -69,37 +68,37 @@ method_init()
 			mkdir $DIR/logs
 			echo "Completed."
 		fi
+	fi
 
-		# chmod to let everyone write their logs
-		echo "To correct run the program, you should set the following permissions:"
-		echo "  755 for $(cd $DIR/.. && pwd) , $DIR and $DIR/auth"
-		echo "  777 for $DIR/data and $DIR/logs"
+	# chmod to let everyone write their logs
+	echo "To correct run the program, you should set the following permissions:"
+	echo "  755 for $(cd $DIR/.. && pwd) , $DIR and $DIR/auth"
+	echo "  777 for $DIR/data and $DIR/logs"
 
-		echo "Do you want to set these permissions (chmod)? [y|n]"
+	echo "Do you want to set these permissions (chmod)? [y|n]"
 
+	read ANSWER
+	while [ -z $ANSWER ]; do
+		echo "Yes (y) or no (n)? "
 		read ANSWER
-		while [ -z $ANSWER ]; do
-			echo "Yes (y) or no (n)? "
-			read ANSWER
-		done
+	done
 
-		while [ $ANSWER != "y" ] && [ $ANSWER != "n" ]; do
-			echo "Yes (y) or no (n)? "
-			read ANSWER
+	while [ $ANSWER != "y" ] && [ $ANSWER != "n" ]; do
+		echo "Yes (y) or no (n)? "
+		read ANSWER
 
-			while [ -z $ANSWER ]; do
-				echo  "Yes (y) or no (n)? "
-				read ANSWER
-			done
+		while [ -z $ANSWER ]; do
+			echo  "Yes (y) or no (n)? "
+			read ANSWER
 		done
-
-		if [ $ANSWER == "y" ]; then
-			chmod 755 $DIR/..
-			chmod 755 $DIR
-			chmod 755 $DIR/auth
-			chmod 777 $DIR/data
-			chmod 777 $DIR/logs
-		fi
+	done
+
+	if [ $ANSWER == "y" ]; then
+		chmod 755 $DIR/..
+		chmod 755 $DIR
+		chmod 755 $DIR/auth
+		chmod 777 $DIR/data
+		chmod 777 $DIR/logs
 	fi
 }