Rooting multiple devices let's say I have about 100 old kindle fires to root (or other android devices). Of course I don't want to waste days to root them one by one, is there any way to optimize the process? 

Thanks
The first step must be done manually, and one extra tap (confirm a prompt) for each device is required.


Enable USB debugging (after unlocking Developer Options) for every device
Prepare the files. A custom recovery (you should find it by yourself) and a SuperSU flashable ZIP
Prepare a script and place the downloaded SuperSU ZIP and recovery IMG in the same directory. Rename the SuperSU ZIP file to SuperSU.zip and your recovery image to recovery.img
Plug in one device and run the script. Tap "Authenticate" if it prompts for USB debugging. It will reboot several times. When the device shows the normal operating system, unplug it
Repeat step 4 until all are finished.


Script (Unix version):

#!/bin/sh
echo "install /sdcard/SuperSU.zip" &gt; openrecoveryscript
echo "cmd reboot" &gt;&gt; openrecoveryscript
adb wait-for-device
adb reboot bootloader
fastboot wait-for-device
fastboot flash recovery recovery.img
fastboot boot recovery.img
adb wait-for-device
adb push SuperSU.zip /sdcard/SuperSU.zip
adb push openrecoveryscript /cache/recovery/openrecoveryscript
adb reboot recovery
# You're done!