sahara-image-elements/elements/zookeeper/post-install.d/50-zookeeper

22 lines
580 B
Bash
Executable File

#!/bin/bash
# We have to chown the Zookeeper directories to make it usable for the default user
# Unfortunately the Ubuntu user does not exists when DIB is creating the image
# and we need to execute this code the first time the VM boots.
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
sed -i -e 's,^exit 0$,[ -f /opt/zookeeper/firstboot.sh ] \&\& sh /opt/zookeeper/firstboot.sh; exit 0,' /etc/rc.local
cat >> /opt/zookeeper/firstboot.sh <<EOF
#!/bin/sh
chown -R ubuntu:ubuntu /opt/zookeeper
chown -R ubuntu:ubuntu /var/zookeeper
rm \$0
EOF