From 0ef1c381d061d964fe5431a49ed691b802bffd60 Mon Sep 17 00:00:00 2001
From: Jondy Zhao <jondy.zhao@gmail.com>
Date: Tue, 28 May 2013 08:12:27 +0800
Subject: [PATCH] Remove timeout when configure node is over. The
 init-slapos-node.bat isn't generated.

---
 windows/scripts/init-slapos-node.sh     | 2 +-
 windows/scripts/post-install.sh         | 4 ++--
 windows/scripts/slapos-client-config.sh | 2 +-
 windows/scripts/slapos-node-config.sh   | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/windows/scripts/init-slapos-node.sh b/windows/scripts/init-slapos-node.sh
index 9409e0a..4206bc9 100755
--- a/windows/scripts/init-slapos-node.sh
+++ b/windows/scripts/init-slapos-node.sh
@@ -27,7 +27,7 @@ echo "Start re6stent (pid:$!)in the background OK."
 
 # Run slapformat
 echo "Initializing SlapOS Node ..."
-/bin/bash --login -i /opt/slapos/bin/slapos node format -c --now
+/opt/slapos/bin/slapos node format -c --now
 if (( $? )) ; then
     echo "Initialize SlapOS Node failed."
 else
diff --git a/windows/scripts/post-install.sh b/windows/scripts/post-install.sh
index 218ab82..131677e 100755
--- a/windows/scripts/post-install.sh
+++ b/windows/scripts/post-install.sh
@@ -25,11 +25,11 @@ else
     cp /etc/passwd /etc/passwd.orig
 fi
 
-sed -i -e "s/Administrator:unused:500:/Administrator:unused:0:/g" /etc/passwd
+# sed -i -e "s/Administrator:unused:500:/Administrator:unused:0:/g" /etc/passwd
 grep -q "^root:" /etc/passwd
 if (( $? != 0 )) ; then
     myaccount=$(grep "^Administrator:" /etc/passwd | \
-              sed -e "s/Administrator:/root:/g")
+              sed -e "s/Administrator:unused:500:/root:unused:0:/g")
     if [[ "${myaccount:0:4}" == root ]] ; then
         echo $myaccount >> /etc/passwd
     else
diff --git a/windows/scripts/slapos-client-config.sh b/windows/scripts/slapos-client-config.sh
index 4afeefc..896988c 100755
--- a/windows/scripts/slapos-client-config.sh
+++ b/windows/scripts/slapos-client-config.sh
@@ -74,5 +74,5 @@ sed -i -e "s%^cert_file.*$%cert_file = $client_certificate_file%" \
        $client_configure_file
 
 echo SlapOS Client configure successfully.
-read -n 1 -t 10 -p "Press any key to exit..."
+read -n 1 -p "Press any key to exit..."
 exit 0
diff --git a/windows/scripts/slapos-node-config.sh b/windows/scripts/slapos-node-config.sh
index d582379..c5cc46d 100755
--- a/windows/scripts/slapos-node-config.sh
+++ b/windows/scripts/slapos-node-config.sh
@@ -264,7 +264,7 @@ password_file=/etc/passwd
 password_orig=/etc/slapos-format-passwd.orig
 cygroot=$(cygpath -w -a /)
 echo "Add ${init_script}.sh as Windows startup item."
-[[ -f ${init_script}.bat ]] && cat <<EOF > ${init_script}.bat
+[[ ! -f ${init_script}.bat ]] && cat <<EOF > ${init_script}.bat
 @ECHO OFF
 SETLOCAL
 
@@ -288,5 +288,5 @@ regtool -q set "$run_key\\$slapos_run_entry" \
     show_error_exit "Add startup item failed."
 
 echo SlapOS Node configure successfully.
-read -n 1 -t 10 -p "Press any key to exit..."
+read -n 1 -p "Press any key to exit..."
 exit 0
-- 
2.30.9