2023-12-28 21:37:18 +02:00
|
|
|
#!/bin/bash
|
2023-11-20 13:55:01 +02:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2024-04-02 12:48:35 +03:00
|
|
|
if [[ -z $BANAN_ARCH ]]; then
|
|
|
|
echo "You must set the BANAN_ARCH environment variable" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-11-20 13:55:01 +02:00
|
|
|
if [[ -z $BANAN_DISK_IMAGE_PATH ]]; then
|
|
|
|
echo "You must set the BANAN_DISK_IMAGE_PATH environment variable" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z $BANAN_BUILD_DIR ]]; then
|
|
|
|
echo "You must set the BANAN_BUILD_DIR environment variable" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z $BANAN_ROOT_DIR ]]; then
|
|
|
|
echo "You must set the BANAN_ROOT_DIR environment variable" >&2
|
|
|
|
exit 1
|
2023-12-28 19:13:27 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z $CMAKE_COMMAND ]]; then
|
|
|
|
echo "You must set the CMAKE_COMMAND environment variable" >&2
|
|
|
|
exit 1
|
2024-01-24 14:43:46 +02:00
|
|
|
fi
|
2023-11-20 13:55:01 +02:00
|
|
|
|
|
|
|
ROOT_PARTITION_INDEX=2
|
|
|
|
ROOT_PARTITION_INFO=$(fdisk -x $BANAN_DISK_IMAGE_PATH | grep "^$BANAN_DISK_IMAGE_PATH" | head -$ROOT_PARTITION_INDEX | tail -1)
|
|
|
|
ROOT_PARTITION_GUID=$(echo $ROOT_PARTITION_INFO | cut -d' ' -f6)
|
|
|
|
|
2024-04-02 12:48:35 +03:00
|
|
|
INSTALLER_BUILD_DIR=$BANAN_ROOT_DIR/bootloader/installer/build/$BANAN_ARCH
|
2023-11-20 13:55:01 +02:00
|
|
|
BOOTLOADER_ELF=$BANAN_BUILD_DIR/bootloader/bios/bootloader
|
|
|
|
|
|
|
|
if ! [ -f $BOOTLOADER_ELF ]; then
|
|
|
|
echo "You must build the bootloader first" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! [ -d $INSTALLER_BUILD_DIR ]; then
|
|
|
|
mkdir -p $INSTALLER_BUILD_DIR
|
|
|
|
cd $INSTALLER_BUILD_DIR
|
2024-04-02 12:48:35 +03:00
|
|
|
$CMAKE_COMMAND ../..
|
2023-11-20 13:55:01 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
cd $INSTALLER_BUILD_DIR
|
|
|
|
make
|
|
|
|
|
|
|
|
echo installing bootloader
|
2024-04-02 12:48:35 +03:00
|
|
|
$INSTALLER_BUILD_DIR/banan_os-bootloader-installer $BOOTLOADER_ELF $BANAN_DISK_IMAGE_PATH $ROOT_PARTITION_GUID
|