Disable zap on init for new devices (#418)
The device chroot shouldn't exist yet anyways. Also add a 'device_exists' variable that can be used to determine if the device entered earlier in the init has a deviceinfo under aports/device/device-*
This commit is contained in:
parent
c323f21ca5
commit
2d6f9befca
|
@ -72,6 +72,8 @@ def init(args):
|
||||||
cfg["pmbootstrap"]["device"] = pmb.helpers.cli.ask(args, "Device",
|
cfg["pmbootstrap"]["device"] = pmb.helpers.cli.ask(args, "Device",
|
||||||
None, args.device, False, "[a-z0-9]+-[a-z0-9]+")
|
None, args.device, False, "[a-z0-9]+-[a-z0-9]+")
|
||||||
|
|
||||||
|
device_exists = os.path.exists(args.aports + "/device/device-" + cfg["pmbootstrap"]["device"] + "/deviceinfo")
|
||||||
|
|
||||||
# UI and work folder
|
# UI and work folder
|
||||||
cfg["pmbootstrap"]["ui"] = ask_for_ui(args)
|
cfg["pmbootstrap"]["ui"] = ask_for_ui(args)
|
||||||
cfg["pmbootstrap"]["work"] = ask_for_work_path(args)
|
cfg["pmbootstrap"]["work"] = ask_for_work_path(args)
|
||||||
|
@ -104,11 +106,10 @@ def init(args):
|
||||||
# Save config
|
# Save config
|
||||||
pmb.config.save(args, cfg)
|
pmb.config.save(args, cfg)
|
||||||
|
|
||||||
if len(glob.glob(args.work + "/chroot_*")) and pmb.helpers.cli.confirm(args, "Zap existing chroots to apply configuration?", default=True):
|
if (device_exists and
|
||||||
if not os.path.exists(args.aports + "/device/device-" + args.device + "/deviceinfo"):
|
len(glob.glob(args.work + "/chroot_*")) and
|
||||||
setattr(args, "deviceinfo", None)
|
pmb.helpers.cli.confirm(args, "Zap existing chroots to apply configuration?", default=True)):
|
||||||
else:
|
setattr(args, "deviceinfo", pmb.parse.deviceinfo(args, device=cfg["pmbootstrap"]["device"]))
|
||||||
setattr(args, "deviceinfo", pmb.parse.deviceinfo(args))
|
|
||||||
# Do not zap any existing packages or cache_http directories
|
# Do not zap any existing packages or cache_http directories
|
||||||
pmb.chroot.zap(args, confirm=False)
|
pmb.chroot.zap(args, confirm=False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue