print('Program "' + args.start + '" is now started') elif args.command == 'insmod': modfile = parrot_utils.split_into_path_and_file(args.file) print('Uploading \'' + modfile[1]) parrot_utils.uploadfile(ftp, modfile[1], file(args.file, "rb")) print(parrot_utils.execute_command(tn, "insmod /data/ftp/" + modfile[1])) elif args.command == 'upload_file_and_run': # Split filename and path f = parrot_utils.split_into_path_and_file(args.file) #check firmware version v = parrot_utils.check_version(tn, '') print("Checking Bebop firmware version... " + str(v)) if ((v < parrot_utils.ParrotVersion(args.min_version)) or (v > parrot_utils.ParrotVersion(args.max_version))): print("Error: please upgrade your Bebop firmware to version between " + args.min_version + " and " + args.max_version + "!") else: print("Kill running " + f[1] + " and make folder " + args.folder) parrot_utils.execute_command(tn, "killall -9 " + f[1]) sleep(1) parrot_utils.execute_command(tn, "mkdir -p /data/ftp/" + args.folder) print('Uploading \'' + f[1] + "\' from " + f[0] + " to " + args.folder) parrot_utils.uploadfile(ftp, args.folder + "/" + f[1], file(args.file, "rb")) sleep(0.5) from datetime import datetime parrot_utils.execute_command(
print('Program "' + args.start + '" is now started') elif args.command == 'insmod': modfile = parrot_utils.split_into_path_and_file(args.file) print('Uploading \'' + modfile[1]) parrot_utils.uploadfile(ftp, modfile[1], file(args.file, "rb")) print(parrot_utils.execute_command(tn, "insmod /data/ftp/" + modfile[1])) elif args.command == 'upload_file_and_run': # Split filename and path f = parrot_utils.split_into_path_and_file(args.file) #check firmware version v = parrot_utils.check_version(tn, '') print("Checking Bebop firmware version... " + v) if ((v < parrot_utils.ParrotVersion('3.2.0')) or (v > parrot_utils.ParrotVersion('3.9.0'))): print( "Error: please upgrade your Bebop firmware to version between 3.2.0 and 3.9.0!" ) else: print("Kill running " + f[1] + " and make folder " + args.folder) parrot_utils.execute_command(tn, "killall -9 " + f[1]) sleep(1) parrot_utils.execute_command(tn, "mkdir -p /data/ftp/" + args.folder) print('Uploading \'' + f[1] + "\' from " + f[0] + " to " + args.folder) parrot_utils.uploadfile(ftp, args.folder + "/" + f[1], file(args.file, "rb")) sleep(0.5) parrot_utils.execute_command( tn, "chmod 777 /data/ftp/" + args.folder + "/" + f[1])