Fix t0004-server.
authorAndre Noll <maan@systemlinux.org>
Sun, 5 Feb 2012 13:39:37 +0000 (14:39 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 4 Mar 2012 21:16:00 +0000 (22:16 +0100)
Currently we try to generate an ssh key and start para_server
even if the ssh-keygen executable was not found or para_server
was not built.

Fix this by starting para_server only of both executables exist.

t/t0004-server.sh

index c79ea24..3c878eb 100755 (executable)
@@ -57,30 +57,33 @@ missing_objects="$result"
 test_require_executables "ssh-keygen"
 missing_executables="$result"
 
-ssh-keygen -q -t rsa -b 2048 -N "" -f $privkey
-key_gen_result=$?
+if [[ -z "$missing_objects" && -z "$missing_executables" ]]; then
+       ssh-keygen -q -t rsa -b 2048 -N "" -f $privkey
+       key_gen_result=$?
 
-read &>/dev/null < /dev/tcp/localhost/$port
-check_port_result=$?
+       read &>/dev/null < /dev/tcp/localhost/$port
+       check_port_result=$?
 
-cat > $user_list << EOF
-user $LOGNAME $pubkey AFS_READ,AFS_WRITE,VSS_READ,VSS_WRITE
+       cat > $user_list << EOF
+       user $LOGNAME $pubkey AFS_READ,AFS_WRITE,VSS_READ,VSS_WRITE
 EOF
 
-# para_server sends this signal to all processes in the current process group.
-trap "" SIGUSR1
-
-$PARA_SERVER \
-       --logfile "$serverlog" \
-       --config_file /dev/null \
-       --daemon \
-       --loglevel $loglevel \
-       --port $port \
-       --afs_database_dir "$db" \
-       --afs_socket "$sock" \
-       --user_list "$user_list" \
-       --http_port "$stream_port" \
-       --dccp_port "$stream_port"
+       # para_server sends this signal to all processes in the current process group.
+       trap "" SIGUSR1
+
+
+       $PARA_SERVER \
+               --logfile "$serverlog" \
+               --config_file /dev/null \
+               --daemon \
+               --loglevel $loglevel \
+               --port $port \
+               --afs_database_dir "$db" \
+               --afs_socket "$sock" \
+               --user_list "$user_list" \
+               --http_port "$stream_port" \
+               --dccp_port "$stream_port"
+fi
 
 for ((i=0; i < ${#commands[@]}; i++)); do
        command=${commands[$i]}