(self)
| 787 | self.u.grab("Press [enter] to return to the main menu...") |
| 788 | |
| 789 | def main(self): |
| 790 | # Start out with our cd in the right spot. |
| 791 | os.chdir(os.path.dirname(os.path.realpath(__file__))) |
| 792 | # Let's make sure we have the required files needed |
| 793 | self.u.head("Checking Required Tools") |
| 794 | print("") |
| 795 | if not self.check_dd(): |
| 796 | print("Couldn't find or install {} - aborting!\n".format(self.dd_name)) |
| 797 | self.u.grab("Press [enter] to exit...") |
| 798 | exit(1) |
| 799 | if not self.check_7z(): |
| 800 | print("Couldn't find or install {} - aborting!\n".format(self.z_name)) |
| 801 | self.u.grab("Press [enter] to exit...") |
| 802 | exit(1) |
| 803 | if not self.check_bi(): |
| 804 | print("Couldn't find or install {} - aborting!\n".format(self.bi_name)) |
| 805 | self.u.grab("Press [enter] to exit...") |
| 806 | exit(1) |
| 807 | # Let's just setup a real simple interface and try to write some data |
| 808 | self.u.head("Gathering Disk Info") |
| 809 | print("") |
| 810 | print("Populating list...") |
| 811 | self.d.update() |
| 812 | print("") |
| 813 | print("Done!") |
| 814 | # Let's serve up a list of *only* removable media |
| 815 | self.u.head("Potential Removable Media") |
| 816 | print("") |
| 817 | rem_disks = self.get_disks_of_type(self.d.disks) if not self.show_all_disks else self.d.disks |
| 818 | |
| 819 | # Types: 0 = Unknown, 1 = No Root Dir, 2 = Removable, 3 = Local, 4 = Network, 5 = Disc, 6 = RAM disk |
| 820 | |
| 821 | if self.show_all_disks: |
| 822 | print("!WARNING! This list includes ALL disk types.") |
| 823 | print("!WARNING! Be ABSOLUTELY sure before selecting") |
| 824 | print("!WARNING! a disk!") |
| 825 | else: |
| 826 | print("!WARNING! This list includes both Removable AND") |
| 827 | print("!WARNING! Unknown disk types. Be ABSOLUTELY sure") |
| 828 | print("!WARNING! before selecting a disk!") |
| 829 | print("") |
| 830 | for disk in sorted(rem_disks,key=lambda x:int(x)): |
| 831 | print("{}. {} - {} ({})".format( |
| 832 | disk, |
| 833 | rem_disks[disk].get("model","Unknown"), |
| 834 | self.dl.get_size(rem_disks[disk].get("size",-1),strip_zeroes=True), |
| 835 | ["Unknown","No Root Dir","Removable","Local","Network","Disc","RAM Disk"][rem_disks[disk].get("type",0)] |
| 836 | )) |
| 837 | if not len(rem_disks[disk].get("partitions",{})): |
| 838 | print(" No Mounted Partitions") |
| 839 | else: |
| 840 | parts = rem_disks[disk]["partitions"] |
| 841 | for p in sorted(parts,key=lambda x:int(x)): |
| 842 | print(" {}. {} ({}) {} - {}".format( |
| 843 | p, |
| 844 | parts[p].get("letter","No Letter"), |
| 845 | "No Name" if not parts[p].get("name",None) else parts[p].get("name","No Name"), |
| 846 | parts[p].get("file system","Unknown FS"), |
no test coverage detected