melawy-archiso-config/Melawy-Linux-NetInstall/airootfs/usr/local/bin/copy-refind-theme_v2

42 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
efi_refind_path=(
/boot/EFI/refind
/efi/EFI/refind
/boot/efi/EFI/refind
)
for REFIND_DIR in "${efi_refind_path[@]}"; do
echo "${REFIND_DIR}"
if [ -d "${REFIND_DIR}" ]; then
if [ -d "$(dirname ${REFIND_DIR})/boot" ]; then
EFI_BOOT_DIR="$(dirname ${REFIND_DIR})/boot"
elif [ -d "$(dirname ${REFIND_DIR})/Boot" ]; then
EFI_BOOT_DIR="$(dirname ${REFIND_DIR})/Boot"
elif [ -d "$(dirname ${REFIND_DIR})/BOOT" ]; then
EFI_BOOT_DIR="$(dirname ${REFIND_DIR})/BOOT"
else
EFI_BOOT_DIR="$(dirname ${REFIND_DIR})/boot"
mkdir -p "${EFI_BOOT_DIR}"
fi
if [ -d "/usr/share/refind/themes" ]; then
mkdir -p "${REFIND_DIR}/themes"
cp -vrf "/usr/share/refind/themes/." "${REFIND_DIR}/themes/."
cp -vrf "${REFIND_DIR}/." "${EFI_BOOT_DIR}/."
fi
if [ -f "/etc/refind-menu-generator/refind.conf" ]; then
cp -vf "/etc/refind-menu-generator/refind.conf" "${REFIND_DIR}/"
fi
cp -vf "${REFIND_DIR}/refind_x64.efi" "${EFI_BOOT_DIR}/bootx64.efi"
rm "${EFI_BOOT_DIR}/refind_x64.efi"
fi
done