burrow-pi-img/stageX/02-greengrass/00-run.sh

25 lines
1.0 KiB
Bash
Raw Normal View History

#!/bin/bash -e
install -m 755 files/install-greengrass.sh "${ROOTFS_DIR}/bin/"
install -m 644 files/greengrass.service "${ROOTFS_DIR}/etc/systemd/system/greengrass.service"
install -m 755 files/S02greengrass "${ROOTFS_DIR}/etc/init.d/S02greengrass"
sed -i.bak -e 's/$/"splash plymouth.ignore-serial-consoles cgroup_enable=memory cgroup_memory=1"/' "${ROOTFS_DIR}/boot/cmdline.txt"
[ -f "${ROOTFS_DIR}/etc/sysctl.d/98-rpi.conf" ] || touch "${ROOTFS_DIR}/etc/sysctl.d/98-rpi.conf"
cat >> "${ROOTFS_DIR}/etc/sysctl.d/98-rpi.conf" << EOF
fs.protected_hardlinks = 1
fs.protected_symlinks = 1
EOF
wget -c -q -O greengrass.tar.gz "https://d1onfpft10uf5o.cloudfront.net/greengrass-core/downloads/1.10.0/greengrass-raspbian-armv7l-1.10.0.tar.gz"
tar xfvz greengrass.tar.gz -C ${ROOTFS_DIR}/
rm -f greengrass.tar.gz
sudo wget -O ${ROOTFS_DIR}//greengrass/certs/root.ca.pem https://www.amazontrust.com/repository/AmazonRootCA1.pem
on_chroot << EOF
adduser --system ggc_user
addgroup --system ggc_group
systemctl enable greengrass.service
EOF