# AnyKernel3 Ramdisk Mod Script
# osm0sis @ xda-developers

# set up working directory variables
test "$home" || home=$PWD;
bootimg=$home/boot.img;
bin=$home/tools;
patch=$home/patch;
ramdisk=$home/ramdisk;
split_img=$home/split_img;

## AnyKernel setup
eval $(cat $home/props | grep -v '\.')

## AnyKernel methods (DO NOT CHANGE)
# import patching functions/variables - see for reference
. tools/ak3-core.sh;

install() {
  ## AnyKernel install
  dump_boot;

  # Force-install dtbo.img
  rm -f "$home/dtbo_flashed"

  # Install the boot image
  write_boot;

  if [ -e "$home/vendor_boot" ]; then
    block=/dev/block/bootdevice/by-name/vendor_boot

    reset_ak;
    split_boot;
    flash_boot;
  fi
}

install;

case $is_slot_device in
  1|auto)
    ui_print " ";
    ui_print "Installing to the secondary slot";
    slot_select=inactive;
    unset block;
    eval $(cat $home/props | grep '^block=' | grep -v '\.')
    reset_ak;
    install;
  ;;
esac

## end install
