diff --git a/ports/install.sh b/ports/install.sh index aca103f5..106603c0 100755 --- a/ports/install.sh +++ b/ports/install.sh @@ -13,7 +13,7 @@ source "$BANAN_ROOT_DIR/script/config.sh" export PATH="$BANAN_TOOLCHAIN_PREFIX/bin:$PATH" -export PKG_CONFIG='pkg-config --static' +export PKG_CONFIG_DIR='' export PKG_CONFIG_SYSROOT_DIR="$BANAN_SYSROOT" export PKG_CONFIG_LIBDIR="$PKG_CONFIG_SYSROOT_DIR/usr/lib/pkgconfig" export PKG_CONFIG_PATH="$PKG_CONFIG_SYSROOT_DIR/usr/share/pkgconfig" @@ -21,6 +21,13 @@ export PKG_CONFIG_PATH="$PKG_CONFIG_SYSROOT_DIR/usr/share/pkgconfig" export CC="$BANAN_TOOLCHAIN_TRIPLE-gcc" export CXX="$BANAN_TOOLCHAIN_TRIPLE-g++" export LD="$BANAN_TOOLCHAIN_TRIPLE-ld" +export AR="$BANAN_TOOLCHAIN_TRIPLE-ar" +export RANLIB="$BANAN_TOOLCHAIN_TRIPLE-ranlib" +export READELF="$BANAN_TOOLCHAIN_TRIPLE-readelf" +export OBJCOPY="$BANAN_TOOLCHAIN_TRIPLE-objcopy" +export OBJDUMP="$BANAN_TOOLCHAIN_TRIPLE-objdump" +export STRIP="$BANAN_TOOLCHAIN_TRIPLE-strip" +export CXXFILT="$BANAN_TOOLCHAIN_TRIPLE-c++filt" if [ ! -f "$BANAN_SYSROOT/usr/lib/libc.a" ]; then pushd "$BANAN_ROOT_DIR" >/dev/null @@ -102,28 +109,29 @@ if [ "$VERSION" = "git" ]; then exit 1 fi else - regex=".*/(.*\.tar\..*)#(.*)" + regex='.*/(.*)#(.*)' if [[ $DOWNLOAD_URL =~ $regex ]]; then - TAR_NAME="${BASH_REMATCH[1]}" - TAR_HASH="${BASH_REMATCH[2]}" + FILE_NAME="${BASH_REMATCH[1]}" + FILE_HASH="${BASH_REMATCH[2]}" - if [ -f "$TAR_NAME" ]; then - if ! echo "$TAR_HASH $TAR_NAME" | sha256sum --check >/dev/null; then + if [ -f "$FILE_NAME" ]; then + if ! echo "$FILE_HASH $FILE_NAME" | sha256sum --check >/dev/null; then clean fi fi - if [ ! -f "$TAR_NAME" ]; then + if [ ! -f "$FILE_NAME" ]; then wget "$DOWNLOAD_URL" || exit 1 fi - if ! echo "$TAR_HASH $TAR_NAME" | sha256sum --check >/dev/null; then - echo "Tar hash does not match" >&2 + if ! echo "$FILE_HASH $FILE_NAME" | sha256sum --check >/dev/null; then + echo "File hash does not match" >&2 exit 1 fi - if [ ! -d "$build_dir" ]; then - tar xf "$TAR_NAME" || exit 1 + regex='(.*\.tar\..*)' + if [[ $FILE_NAME =~ $regex ]] && [ ! -d "$build_dir" ]; then + tar xf "$FILE_NAME" || exit 1 : "${TAR_CONTENT:=$NAME-$VERSION}" mv "$TAR_CONTENT" "$build_dir" || exit 1 @@ -133,6 +141,10 @@ else patch -ruN -p1 -d "$build_dir" < "$patch" || exit 1 done fi + else + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" || exit 1 + fi fi else echo "Invalid format in DOWNLOAD_URL" >&2 diff --git a/script/image-create.sh b/script/image-create.sh index 176d0161..5e9f1915 100755 --- a/script/image-create.sh +++ b/script/image-create.sh @@ -63,4 +63,4 @@ sudo mkfs.ext2 -q $PARTITION2 sudo losetup -d $LOOP_DEV # install bootloader -$BANAN_SCRIPT_DIR/install-bootloader.sh +$BANAN_SCRIPT_DIR/install-bootloader.sh || exit 1 diff --git a/script/image.sh b/script/image.sh index ea10f1d5..9a73beb8 100755 --- a/script/image.sh +++ b/script/image.sh @@ -16,7 +16,7 @@ if [ -z $BANAN_BUILD_DIR ]; then fi if [ "$1" == "full" ] || [ ! -f $BANAN_DISK_IMAGE_PATH ]; then - $BANAN_SCRIPT_DIR/image-create.sh + $BANAN_SCRIPT_DIR/image-create.sh || exit 1 fi set -u diff --git a/script/install-bootloader.sh b/script/install-bootloader.sh index 2d37fa00..df291476 100755 --- a/script/install-bootloader.sh +++ b/script/install-bootloader.sh @@ -62,9 +62,8 @@ install_grub_uefi() { } install_banan_legacy() { - 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) + ROOT_DISK_INFO=$(fdisk -x "$BANAN_DISK_IMAGE_PATH" | tr -s ' ') + ROOT_PART_GUID=$(echo "$ROOT_DISK_INFO" | grep "^$BANAN_DISK_IMAGE_PATH" | head -2 | tail -1 | cut -d' ' -f6) INSTALLER_BUILD_DIR=$BANAN_ROOT_DIR/bootloader/installer/build/$BANAN_ARCH BOOTLOADER_ELF=$BANAN_BUILD_DIR/bootloader/bios/bootloader @@ -84,7 +83,7 @@ install_banan_legacy() { ninja echo installing bootloader - $INSTALLER_BUILD_DIR/banan_os-bootloader-installer $BOOTLOADER_ELF $BANAN_DISK_IMAGE_PATH $ROOT_PARTITION_GUID + $INSTALLER_BUILD_DIR/banan_os-bootloader-installer "$BOOTLOADER_ELF" "$BANAN_DISK_IMAGE_PATH" "$ROOT_PART_GUID" } install_banan_uefi() {