mkcephfs.in: Use $user when copying files using scp
diff mbox

Message ID 1287701664-6945-1-git-send-email-tytso@mit.edu
State New, archived
Headers show

Commit Message

Theodore Y. Ts'o Oct. 21, 2010, 10:54 p.m. UTC
None

Patch
diff mbox

diff --git a/src/mkcephfs.in b/src/mkcephfs.in
index 9359118..6bb3b3c 100644
--- a/src/mkcephfs.in
+++ b/src/mkcephfs.in
@@ -185,9 +185,15 @@  for name in $what; do
     check_host || continue
 
     if [ -n "$ssh" ] && ( echo $pushed_to | grep -v -q " $host " ); then
-	scp -q $conf $host:$conf
-	scp -q $osdmap $host:$osdmap
-	scp -q $monmap $host:$monmap
+	if [ -n "$user" ]; then
+	  scp -q $conf $user@$host:$conf
+	  scp -q $osdmap $user@$host:$osdmap
+	  scp -q $monmap $user@$host:$monmap
+        else
+	  scp -q $conf $host:$conf
+	  scp -q $osdmap $host:$osdmap
+	  scp -q $monmap $host:$monmap
+        fi
 	pushed_to="$pushed_to $host "
     fi
 
@@ -239,7 +245,13 @@  for name in $what; do
 	    do_root_cmd "umount $btrfs_path ; for f in $btrfs_devs ; do umount \$f ; done ; modprobe btrfs ; mkfs.btrfs $btrfs_devs ; modprobe btrfs ; btrfsctl -a ; mount -t btrfs $btrfs_opt $first_dev $btrfs_path ; chown $osd_user $btrfs_path ; chmod +w $btrfs_path "
 	fi
 
-	[ -n "$ssh" ] && scp $monmap $host:$monmap
+	if [ -n "$ssh" ]; then
+          if [ -n "$user" ]; then
+            scp $monmap $user@$host:$monmap
+          else
+            scp $monmap $host:$monmap
+          fi
+        fi
 	do_cmd "$BINDIR/cosd -c $conf --monmap $monmap -i $num --mkfs --osd-data $osd_data"
 
 	if [ -n "$keyring" ]; then