sonic-buildimage/files/initramfs-tools/mke2fs
byu343 6d8f57631b [Arista]: Add support to convert vfat file system to ext4 (#201)
This commit will convert the existing file system of flash drive on Arista switches from VFAT to EXT4 in the booting of SONiC. It will take the whole flash and therefore remove the recovery partition. There is a check in the script making sure that the conversion operation will not happen on a non-Arista switch or if the existing file system is not VFAT.
2017-01-23 22:25:47 -08:00

51 lines
1.0 KiB
Bash

#!/bin/sh
#Part of the code is revised based on initramfs-tools/hooks/fsck and initramfs-tool is under GPL v2.
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)
prereqs
exit 0
;;
esac
. /usr/share/initramfs-tools/hook-functions
copy_exec /sbin/mke2fs
copy_exec /sbin/sfdisk
copy_exec /sbin/fdisk
fstypes="ext4"
for type in $fstypes; do
prog="/sbin/mkfs.${type}"
if [ -h "$prog" ]; then
link=$(readlink -f "$prog")
copy_exec "$link"
ln -s "$link" "${DESTDIR}/$prog"
elif [ -x "$prog" ] ; then
copy_exec "$prog"
else
echo "Warning: /sbin/mkfs.${type} doesn't exist, can't install to initramfs, ignoring."
fi
done
for type in $fstypes; do
prog="/sbin/fsck.${type}"
if [ -h "$prog" ]; then
link=$(readlink -f "$prog")
copy_exec "$link"
ln -s "$link" "${DESTDIR}/$prog"
elif [ -x "$prog" ] ; then
copy_exec "$prog"
else
echo "Warning: /sbin/fsck.${type} doesn't exist, can't install to initramfs, ignoring."
fi
done