2015-05-19 09:06:54 +00:00
|
|
|
#!/bin/sh
|
2015-06-16 09:14:50 +00:00
|
|
|
set -e
|
2015-05-19 09:06:54 +00:00
|
|
|
|
2015-06-16 09:14:50 +00:00
|
|
|
here=$(pwd -P)
|
2015-05-19 09:06:54 +00:00
|
|
|
|
|
|
|
initramfs_dir=$(mktemp -d /tmp/cdist-preos.XXXXXXX)
|
|
|
|
# initramfs_dir=$1
|
|
|
|
|
2015-05-19 09:38:06 +00:00
|
|
|
for dir in bin sbin etc proc sys newroot usr/bin usr/sbin; do
|
2015-05-19 09:06:54 +00:00
|
|
|
mkdir -p ${initramfs_dir}/$dir
|
|
|
|
done
|
|
|
|
touch ${initramfs_dir}/etc/mdev.conf
|
|
|
|
|
|
|
|
cp init "${initramfs_dir}/init"
|
|
|
|
cp $(which busybox) "${initramfs_dir}/bin"
|
2015-05-19 09:38:06 +00:00
|
|
|
|
|
|
|
for link in sh mount; do
|
|
|
|
ln -fs busybox "${initramfs_dir}/bin/$link"
|
|
|
|
done
|
2015-05-19 09:06:54 +00:00
|
|
|
|
|
|
|
cd "${initramfs_dir}"
|
|
|
|
|
2015-06-15 19:57:48 +00:00
|
|
|
# Add Arch Linux initramfs with kernel modules included
|
|
|
|
zcat /boot/initramfs-linux-fallback.img | cpio -i
|
2015-05-19 09:06:54 +00:00
|
|
|
|
2015-06-16 09:14:50 +00:00
|
|
|
# Add helper binaries
|
|
|
|
"$here/copy_bin_with_libs.sh" "$initramfs_dir" >/dev/null 2>&1
|
|
|
|
"$here/sshd_config.sh" "$initramfs_dir"
|
|
|
|
|
2015-05-19 09:06:54 +00:00
|
|
|
|
2015-06-15 19:57:48 +00:00
|
|
|
# Create new initramfs
|
|
|
|
find . | cpio -H newc -o | gzip
|
|
|
|
|
|
|
|
# echo ${initramfs_dir}
|
|
|
|
rm -rf "${initramfs_dir}"
|
|
|
|
|
|
|
|
exit 0
|