summarylogtreecommitdiffstats
path: root/hadoop.install
blob: a7b1b075ec42fa0abf06067fff33398428b64b9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
post_install() {
  getent group 'hadoop' >/dev/null 2>&1 || groupadd -r 'hadoop' >/dev/null
  getent passwd 'hadoop' /dev/null 2>&1 || useradd -r -g 'hadoop' -d '/etc/hadoop' 'hadoop' >/dev/null

  if [ ! -d '/etc/hadoop/.ssh' ] ; then
    mkdir -p '/etc/hadoop/.ssh'
  fi

  chown -R 'hadoop:hadoop' '/etc/hadoop'

  if [ ! -e '/etc/hadoop/.ssh/id_rsa' ] ; then
    su -s '/usr/bin/bash' -c "ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa" - 'hadoop'
    su -s '/usr/bin/bash' -c "cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys" - 'hadoop'
  fi

  echo 'An SSH key-pair has been created. Depending on your SSHD configuration you may'
  echo 'need to connect to localhost as user "hadoop" to make sure Hadoop can connect.'
  echo ''
  echo '$ ssh localhost'

  echo ''
  echo '===> Read https://wiki.archlinux.org/index.php/Hadoop for more information'
}

post_upgrade() {
  :
}

post_remove() {
  getent passwd 'hadoop' >/dev/null 2>&1 && userdel 'hadoop' >/dev/null
  getent group 'hadoop' >/dev/null 2>&1 && groupdel 'hadoop' >/dev/null
}