 Okay, this month we are talking about Android devices, Android devices, which as you can see I have a few. I have my main phone. My last one, Nexus 5, which I still love, and the only reason I got a new one was because my wife's broke and they had a good deal on buying too, so I got the Motorola 4X or X4 I can never remember. Then I have these Motorola G4s from 2014. Again, I really like these at the time I use them now. I do realize they were slow and I didn't notice that at the time. And again, my wife, hers got a cracked screen, so it was time to buy a new one. She went like this with this cracked screen. It still works for a while, but then we upgraded to the Nexus phones. So I have these, the cracked one my kids use, but they're great for testing because I try to keep my main phone clean, but I'll have these other ones for testing out applications and trying to fiddle-faddle with stuff, fiddle-faddle. But with all of them, I like to use Torp a lot. And I don't like installing Torp on my devices, it's just not for any particular reason other than I try to not modify stuff that doesn't need modifications. So what I usually do, and you'll probably have seen me do this in videos a lot, you can install Torp to a recovery partition. Usually it's just flashing over that image except for this, the Moto X, it's a little different but there is a process I guess to get it on that partition. But what I normally do is I have the Torp images on my desktop and you can just boot from it. So I hook up through USB and I say, I go to the bootloader and I use fastboot, I say fastboot, boot this image and basically it pushes over a Torp image to the device and boots from it. It's just from RAM. It's like booting a live USB of Linux that loads to RAM. You know, it's a small little partition image and it only takes three to five seconds to copy over. You've got Torp and then when you reboot, it's gone. So that's what I normally do but it's kind of a pain to plug in the phone, go find the directory where I have those images available and then type in the command Torp to this device. So what I did is I wrote a little script that kind of makes it simpler for me and that's what we're going to look at today. So if you have more than one Android device where they have more than one phone, a phone and a tablet and they're all running fastboot and you like to use Torp but you don't want to install it similar to me, maybe you can use this. It's only like maybe four or five lines of code and super simple to use. So we're just going to look over that code and I'll demonstrate it. So let's get started looking at that. Okay. I got my Android device hooked up here through USB. Before we even look at that, let's look on my computer. I've created a folder in my home directory. I've been starting to put all my, you know, accessory files from my scripts into a hidden folder in my home directory called .fbk for films by Chris and then I'm putting stuff under a sub folder of that called Android for Android stuff and then in a folder called Torp. So I'm going to list out the files in there and as you can see, I have three images for Torp. So I have Bullhead, Payton and Titan for the three different phones I have. So now normally if I wanted to boot into Torp, I'm going to have to go into these, this folder and choose one of those and tell it to boot and then I have to remember which ones for which of course I can always rename the file to match the device. But I've created a script. So real quick here, I'm going to Vim into my user local bin and I have a script called Torp. And as you can see here, I set the directory which we just looked at and I'm using the home variable. So all you would have to do if you were to use a script, you can always change us but make this folder and put your Torp files in there. And then here I'm kind of creating an array out of a string which is a little weird to do, but that's how I tend to do it. Basically I'm saying there's a variable called images and then I give the name of the phone, backslash t is for tab that just makes it look cleaner when we're searching through the files and then the name of the image. And I have it for all three phones here. And then I take that and I pipe, I echo it out using the desks E option that allows these tabs to act as tabs. And I put it in the fuzzy finder which I've talked about before which is a great way to search through files. We don't have a lot to search through but it makes it very easy to up, down, arrow or type what you're looking for. And then after we select one, it's going to cut it at the tab and get the second field so it's going to get the name of the image. So basically we're going to load it up, going to choose one of these things from the menu, it's going to grab the name of that image and then it's going to run fast boot and boot that image. So it's not going to install it, it's just going to copy it over to the device to its RAM and boot from it and we'll get into twerk. So let's go ahead and what I'm going to do is I'm going to get ADB reboot boot loader. Of course you have to have ADB installed and enable or not installed but enable. I'm going to click that and my phone should restart and go to the boot loader. In this case, you know, fast boot loader. There we go. And now all I have to do is type in twerk. In fact, I could probably put that reboot command into my twerk because I'm almost always going to want to but I'm at my boot loader now. I type twerk and look I get my options of my three different phones and I can choose one and you can see again that tab just makes it easy for you to read. This is the name of the phone. That's the image and I can type one if I want. So I can come up here if I type in NEX, it's going to narrow it down to that one. Or if I do 2014, it goes to that one or any of those. This is the Nexus 5. Nexus 5, hit enter and it copied over that image to the RAM of the device and now it's booting into twerk. And that's all I have to do. So again, all I have to do is plug in one of my other phones, reboot to the boot loader, type in twerk, choose the one I want and it will boot for it from it. So I thought I'd show you that little script and again, I will show you it right there. And I'll post this online and put a link in the description. I actually had a different version of this I think I put on my laptop where I modified this instead of listing them all here. It actually just did the list command on that folder and listed them all and I put the name of each device into the file name so that I can just add an image and not have to modify the script. That was the benefit of that. This version with the tab, I think it's a little bit easier to read. So I'll post this online but I might also post a modified version where you don't have to modify the script to get the image. You just have to copy the image to the folder that you want and then obviously name it so you know which one's which unless you know the code names for each of your devices. So that's it. I do thank you for watching. Please visit filmsbychrist.com. That's Chris with the K. There's a link in the description. As always, I hope that you have a great day. So I just finished recording that video and I decided I was going to rewrite that script real quick. It was real simple to do. And that way people don't have to modify the script. All they have to do is create this directory, put their images in there, name them whatever they want. So as you can see I renamed them. I just called them MotoG for 2014 IMG. MotoX4.IMG, Nexus5X.IMG. And then I rewrote the script. It's even shorter now so it doesn't have that list in here. Basically all it does is we give it the directory where we have our images and then I just list that out, put all those in there and then I echo that and we don't even need that dash E anymore but it doesn't hurt to have it in there. Into Fuzzy Finder and boot. So it's even a shorter script now, quit out of that. And now it doesn't matter what directory I'm in. My phone's already at the boot loader. I type in twerp, it gives me a list of them. This is Nexus5X, I can go up and down or I can just type NE and hit enter and now it pushed that over to the phone, checked it, booted to it and it's done in 1.117 seconds. So yeah, I'll link in the description. I'm gonna have both versions of the script. Again, the other one, I had it to where it gives you the name but you had to modify the script to enter in your information which is bad, it's fine if I was just using it but since I'm sharing it with you, I wanted to make it simpler. So all you have to do is create this directory, put your images in there, rename them if you want unless you know which ones are which code and then put the script in one of your path directories and run it. So I hope you found that useful. Again, filmsbychrist.com, that's Chris at the K. There's a link in the description. Also, there should be a link to both versions of the script in there. I hope that you have a great day.