![tomalok](/assets/img/avatar_default.png)
* Allow additional services on the AMI's runlevels I'm using this with my AMIs to add haveged to the boot runlevel to boost the amount of initial entropy on smaller instance types, so sshd can start in under 6s instead of over 2m. add_svcs: boot: - haveged * fix race condition with nvme-ebs /dev linking * copy nvme stuff to build target in one operation * add eu-north-1 region
23 lines
585 B
Bash
Executable File
23 lines
585 B
Bash
Executable File
#!/bin/sh
|
|
|
|
[ -x /usr/sbin/nvme ] || exit
|
|
|
|
case $ACTION in
|
|
add|"")
|
|
BASE=$(echo $MDEV | sed -re 's/^(nvme[0-9]+n[0-9]+).*/\1/')
|
|
PART=$(echo $MDEV | sed -re 's/nvme[0-9]+n[0-9]+p?//g')
|
|
until [ -n "$EBS" ]; do
|
|
EBS=$(/usr/sbin/nvme id-ctrl "/dev/$BASE" -b 2>/dev/null | dd bs=32 skip=96 count=1 2>/dev/null | tr -d ' ')
|
|
done
|
|
EBS=${EBS#/dev/}$PART
|
|
ln -sf "$MDEV" "${EBS/xvd/sd}"
|
|
ln -sf "$MDEV" "${EBS/sd/xvd}"
|
|
;;
|
|
remove)
|
|
for TARGET in sd* xvd*
|
|
do
|
|
[ "$(readlink $TARGET 2>/dev/null)" = "$MDEV" ] && rm -f "$TARGET"
|
|
done
|
|
;;
|
|
esac
|