2014-06-27 11:54:29 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-09-04 04:56:29 +00:00
|
|
|
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
2014-06-27 11:54:29 +00:00
|
|
|
set -eu
|
|
|
|
set -o pipefail
|
|
|
|
|
2014-09-04 04:56:29 +00:00
|
|
|
|
2014-06-27 11:54:29 +00:00
|
|
|
[ -n "$TARGET_ROOT" ]
|
|
|
|
|
|
|
|
source $_LIB/img-functions
|
|
|
|
|
2014-12-13 17:14:06 +00:00
|
|
|
IMAGE_PATH=$(readlink -f $IMAGE_NAME)
|
2014-06-27 11:54:29 +00:00
|
|
|
cd $TARGET_ROOT
|
|
|
|
|
|
|
|
echo "#disabled" > ./tmp/fstab.new
|
|
|
|
sudo mv ./tmp/fstab.new ./etc/fstab
|
|
|
|
sudo ln -s ./sbin/init ./
|
|
|
|
|
2015-09-08 10:43:09 +00:00
|
|
|
# Remove python object files, they're not particularly useful for a ramdisk
|
|
|
|
sudo find . -name "*.pyc" -or -name "*.pyo" -delete
|
|
|
|
|
2015-08-25 08:29:37 +00:00
|
|
|
sudo find . -path './sys/*' -prune -o -path './proc/*' -prune -o -path './tmp/*' -prune -o -path './boot/*' -prune -o -path './root/*' -prune -o -path './usr/lib/locale/*' -prune -o -path './usr/share/doc/*' -prune -o -path './usr/share/man/*' -prune -o -path './usr/share/info/*' -prune -o -path './usr/share/licenses/*' -prune -o -path './usr/share/misc/*' -prune -o -print | sudo cpio -o -H newc | gzip > ${IMAGE_PATH}.initramfs
|
2014-06-27 11:54:29 +00:00
|
|
|
|
|
|
|
select_boot_kernel_initrd $TARGET_ROOT
|
2015-08-07 12:45:12 +00:00
|
|
|
sudo cp $BOOTDIR/$KERNEL ${IMAGE_PATH}.kernel
|
|
|
|
|
|
|
|
# TODO(lucasagomes): Create a hard link for the .vmlinuz file to keep
|
|
|
|
# it backward compatible. Remove it after it has been consistent and
|
|
|
|
# documented in both places for at least one full OpenStack release cycle
|
|
|
|
echo "WARNING: The kernel extension .vmlinuz has been deprecated. Please rely on the file with the extension .kernel instead."
|
|
|
|
sudo ln ${IMAGE_PATH}.kernel ${IMAGE_PATH}.vmlinuz
|