Format = False
Device = ""
File = ""
+Yes = False
class DebugFormatter(logging.Formatter):
def format(self, record):
def check_args(args):
global Format
+ global Yes
logging.info(f"Device: {args.device}")
logging.info("Fusing binar{}: {}".format("y" if len(args.binaries) == 1 else "ies",
", ".join(args.binaries)))
+ if args.YES:
+ Yes = True
+
if args.create:
Format = True
+ Yes = True
- if args.format or Format:
- response = input(f"{args.device} will be formatted. Is it OK? [y/N] ")
- if response.lower() in ('y', 'yes'):
+ if args.format:
+ if Yes:
Format = True
+ else:
+ response = input(f"{args.device} will be formatted. Continue? [y/N] ")
+ if response.lower() in ('y', 'yes'):
+ Format = True
+ else:
+ Format = False
def check_device(args):
global Format
do_fuse_file(f, os.path.basename(img), target)
def fuse_image(args, target):
+ global Yes
+
if args.binaries is None or len(args.binaries) == 0:
return
+
+ if not Yes and not Format:
+ print(f"The following images will be written to {args.device} and the "
+ "existing data will be lost.\n")
+ for b in args.binaries:
+ print(" " + b)
+ response = input("\nContinue? [y/N] ")
+ if not response.lower() in ('y', 'yes'):
+ return
+
with tempfile.TemporaryDirectory() as tmpd:
for b in args.binaries:
if re.search('\.(tar|tar\.gz|tgz)$', b):
help="Choose partition set to update: a or b.")
parser.add_argument("--version", action="version",
version=f"%(prog)s {__version__}")
+ parser.add_argument("--YES", action="store_true",
+ help="agree to to destroy data on ")
args = parser.parse_args()
if args.target == 'list':