add mdev conf, links NVMEe devs to EBS xvd/sd devs
This commit is contained in:
parent
80807fa647
commit
b669fc0a21
@ -53,6 +53,12 @@ builders:
|
|||||||
|
|
||||||
|
|
||||||
provisioners:
|
provisioners:
|
||||||
|
- type: "file"
|
||||||
|
source: "nvme-ebs-links.sh"
|
||||||
|
destination: "/tmp/"
|
||||||
|
- type: "file"
|
||||||
|
source: "nvme-ebs-mdev.conf"
|
||||||
|
destination: "/tmp/"
|
||||||
- type: "shell"
|
- type: "shell"
|
||||||
script: "make_ami.sh"
|
script: "make_ami.sh"
|
||||||
environment_vars:
|
environment_vars:
|
||||||
|
@ -133,6 +133,7 @@ install_core_packages() {
|
|||||||
chroot "$target" apk --no-cache add \
|
chroot "$target" apk --no-cache add \
|
||||||
linux-virt \
|
linux-virt \
|
||||||
alpine-mirrors \
|
alpine-mirrors \
|
||||||
|
nvme-cli \
|
||||||
chrony \
|
chrony \
|
||||||
openssh \
|
openssh \
|
||||||
sudo \
|
sudo \
|
||||||
@ -153,6 +154,13 @@ install_core_packages() {
|
|||||||
sed -i "s/^export PS1='/&\\\\u@/" "$target"/etc/profile
|
sed -i "s/^export PS1='/&\\\\u@/" "$target"/etc/profile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setup_mdev() {
|
||||||
|
local target="$1"
|
||||||
|
|
||||||
|
cp -a /tmp/nvme-ebs-links.sh "$target"/lib/mdev
|
||||||
|
sed -n -i -e '/# fallback/r /tmp/nvme-ebs-mdev.conf' -e 1x -e '2,${x;p}' -e '${x;p}' "$target"/etc/mdev.conf
|
||||||
|
}
|
||||||
|
|
||||||
create_initfs() {
|
create_initfs() {
|
||||||
local target="$1"
|
local target="$1"
|
||||||
|
|
||||||
@ -327,6 +335,7 @@ main() {
|
|||||||
install_extlinux "$target"
|
install_extlinux "$target"
|
||||||
|
|
||||||
einfo "Configuring system"
|
einfo "Configuring system"
|
||||||
|
setup_mdev "$target"
|
||||||
setup_fstab "$target"
|
setup_fstab "$target"
|
||||||
setup_networking "$target"
|
setup_networking "$target"
|
||||||
enable_services "$target"
|
enable_services "$target"
|
||||||
|
20
nvme-ebs-links.sh
Executable file
20
nvme-ebs-links.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/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')
|
||||||
|
EBS=$(/usr/sbin/nvme id-ctrl "/dev/$BASE" -b 2>/dev/null | dd bs=32 skip=96 count=1 2>/dev/null | tr -d ' ')
|
||||||
|
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
|
3
nvme-ebs-mdev.conf
Normal file
3
nvme-ebs-mdev.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# ebs nvme links
|
||||||
|
nvme[0-9]+n[0-9]+.* root:root 0660 */lib/mdev/nvme-ebs-links.sh
|
||||||
|
|
Loading…
Reference in New Issue
Block a user