prepare for multiple initramfs infrastructures
This commit is contained in:
parent
b848efafbf
commit
d8c42d382a
1 changed files with 68 additions and 17 deletions
|
@ -6,39 +6,90 @@ function make_BACKUP () {
|
||||||
|
|
||||||
if [ ! -d "$BACKUPDIR" ];
|
if [ ! -d "$BACKUPDIR" ];
|
||||||
then
|
then
|
||||||
# Make the backup directories
|
# Make the backup directories and backup the files
|
||||||
mkdir -p "$BACKUPDIR/etc/initramfs-tools"
|
if [ -d "/etc/initramfs-tools" ];
|
||||||
mkdir -p "$BACKUPDIR/etc/modprobe.d"
|
then
|
||||||
mkdir -p "$BACKUPDIR/etc/default"
|
mkdir -p "$BACKUPDIR/etc/initramfs-tools"
|
||||||
|
cp -v "/etc/initramfs-tools/modules" "$BACKUPDIR/etc/initramfs-tools/modules"
|
||||||
|
cp -v "/etc/modules" "$BACKUPDIR/etc/modules"
|
||||||
|
|
||||||
# Backup system files
|
elif [ -d "/etc/dracut.conf.d" ];
|
||||||
sudo cp -v "/etc/modules" "$BACKUPDIR/etc/modules"
|
then
|
||||||
sudo cp -v "/etc/initramfs-tools/modules" "$BACKUPDIR/etc/initramfs-tools/modules"
|
mkdir -p "$BACKUPDIR/etc/dracut.conf.d"
|
||||||
sudp cp -v "/etc/default/grub" "$BACKUPDIR/etc/default/grub"
|
if [ -f "/etc/dracut.conf.d/10-vfio.conf" ];
|
||||||
|
then
|
||||||
|
cp -v "/etc/dracut.conf.d/10-vfio.conf" "$BACKUPDIR/etc/dracut.conf.d/10-vfio.conf"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [ -f "/etc/mkinitcpio.conf" ];
|
||||||
|
then
|
||||||
|
mkdir -p "$BACKUPDIR/etc"
|
||||||
|
cp -v "/etc/mkinitcpio.conf" "$BACKUPDIR/etc/mkinitcpio.conf"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "/etc/default/grub" ];
|
||||||
|
then
|
||||||
|
mkdir -p "$BACKUPDIR/etc/default"
|
||||||
|
cp -v "/etc/default/grub" "$BACKUPDIR/etc/default/grub"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$BACKUPDIR/etc/modprobe.d"
|
||||||
|
|
||||||
# If a vfio.conf file exists, backup that too
|
# If a vfio.conf file exists, backup that too
|
||||||
if [ -f "/etc/modprobe.d/vfio.conf" ];
|
if [ -f "/etc/modprobe.d/vfio.conf" ];
|
||||||
then
|
then
|
||||||
sudo cp -v "/etc/modprobe.d/vfio.conf" "$BACKUPDIR/etc/modprobe.d/vfio.conf"
|
cp -v "/etc/modprobe.d/vfio.conf" "$BACKUPDIR/etc/modprobe.d/vfio.conf"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Backup completed!"
|
printf "Backup completed!\n"
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "A backup already exists!
|
echo "
|
||||||
backup skipped."
|
A backup already exists!
|
||||||
|
backup skipped.
|
||||||
|
"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function copy_FILES () {
|
function copy_FILES () {
|
||||||
echo "Starting copying files to the system!"
|
echo "Starting copying files to the system!"
|
||||||
sudo cp -v "$SCRIPTDIR/$ETCMODULES" "/etc/modules"
|
|
||||||
sudo cp -v "$SCRIPTDIR/$INITRAMFS/modules" "/etc/initramfs-tools/modules"
|
|
||||||
sudo cp -v "$SCRIPTDIR/$MODPROBE/vfio.conf" "/etc/modprobe.d/vfio.conf"
|
sudo cp -v "$SCRIPTDIR/$MODPROBE/vfio.conf" "/etc/modprobe.d/vfio.conf"
|
||||||
|
|
||||||
echo ""
|
if [ -d "/etc/initramfs-tools" ];
|
||||||
echo "Rebuilding initramfs"
|
then
|
||||||
sudo update-initramfs -u
|
sudo cp -v "$SCRIPTDIR/$ETCMODULES" "/etc/modules"
|
||||||
|
sudo cp -v "$SCRIPTDIR/$INITRAMFS/modules" "/etc/initramfs-tools/modules"
|
||||||
|
echo "
|
||||||
|
Rebuilding initramfs"
|
||||||
|
sudo update-initramfs -u
|
||||||
|
|
||||||
|
elif [ -d "/etc/dracut.conf.d" ];
|
||||||
|
then
|
||||||
|
cp -v "$SCRIPTDIR/$DRACUT/10-vfio.conf" "/etc/dracut.conf.d/10-vfio.conf"
|
||||||
|
echo "
|
||||||
|
Rebuilding initramfs"
|
||||||
|
sudo dracut -f -kver "$(uname -r)"
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "
|
||||||
|
Unsupported initramfs infrastructure
|
||||||
|
In order to make vfio work, please add these modules to your
|
||||||
|
initramfs and make them load early, then rebuild initramfs.
|
||||||
|
|
||||||
|
vfio
|
||||||
|
vfio_iommu_type1
|
||||||
|
vfio_pci
|
||||||
|
vfio_virqfd
|
||||||
|
"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function apply_CHANGES () {
|
function apply_CHANGES () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue