Updated Branches: refs/heads/master b709cd500 -> 7d04b7cf6
BIGTOP-846. The helper script introduced in BIGTOP-547 doesn't create /user/$USER directories on HDFS Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/7d04b7cf Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/7d04b7cf Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/7d04b7cf Branch: refs/heads/master Commit: 7d04b7cf632c4597837179c2ed7a429c76171286 Parents: b10e974 Author: Anatoli Fomenko <[email protected]> Authored: Wed May 29 17:17:47 2013 -0700 Committer: Roman Shaposhnik <[email protected]> Committed: Thu May 30 14:43:35 2013 -0700 ---------------------------------------------------------------------- bigtop-packages/src/common/hadoop/init-hdfs.sh | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/7d04b7cf/bigtop-packages/src/common/hadoop/init-hdfs.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/hadoop/init-hdfs.sh b/bigtop-packages/src/common/hadoop/init-hdfs.sh index 43f3d62..a152581 100755 --- a/bigtop-packages/src/common/hadoop/init-hdfs.sh +++ b/bigtop-packages/src/common/hadoop/init-hdfs.sh @@ -80,3 +80,15 @@ fi if ls /usr/lib/pig/{lib/,}*.jar &> /dev/null; then su -s /bin/bash hdfs -c '/usr/bin/hadoop fs -put /usr/lib/pig/{lib/,}*.jar /user/oozie/share/lib/pig' fi + +# Create home directory for the current user if it does not exist +if [ "$1" = "-u" ] ; then + USER="$2" + USER=${USER:-$(id -un)} + su -s /bin/bash hdfs -c "/usr/bin/hadoop fs -ls /user/${USER}" + if [ ! $? -eq 0 ]; then + su -s /bin/bash hdfs -c "/usr/bin/hadoop fs -mkdir /user/${USER}" + su -s /bin/bash hdfs -c "/usr/bin/hadoop fs -chmod -R 755 /user/${USER}" + su -s /bin/bash hdfs -c "/usr/bin/hadoop fs -chown ${USER} /user/${USER}" + fi +fi
