Check if device was renamed

This commit is contained in:
Grant Miller 2018-08-22 21:30:16 +00:00 committed by Oliver Smith
parent d3780364c1
commit 8c9c0ce999
2 changed files with 9 additions and 6 deletions

View file

@ -222,6 +222,11 @@ def ask_for_device(args):
device_exists = os.path.exists(args.aports + "/device/device-" + device_exists = os.path.exists(args.aports + "/device/device-" +
device + "/deviceinfo") device + "/deviceinfo")
if not device_exists: if not device_exists:
if device == args.device:
raise RuntimeError(
"This device does not exist anymore, check"
" <https://postmarketos.org/renamed>"
" to see if it was renamed")
logging.info("You are about to do a new device port for '" + logging.info("You are about to do a new device port for '" +
device + "'.") device + "'.")
if not pmb.helpers.cli.confirm(args, default=True): if not pmb.helpers.cli.confirm(args, default=True):

View file

@ -57,12 +57,10 @@ def deviceinfo(args, device=None):
aport = args.aports + "/device/device-" + device aport = args.aports + "/device/device-" + device
if not os.path.exists(aport) or not os.path.exists(aport + "/deviceinfo"): if not os.path.exists(aport) or not os.path.exists(aport + "/deviceinfo"):
logging.fatal("You will need to create a device-specific package") raise RuntimeError(
logging.fatal("before you can continue. Please create at least the") "Device '" + device + "' not found. Run 'pmbootstrap init' to"
logging.fatal("following files:") " start a new device port or to choose another device. It may have"
logging.fatal(aport + "/APKBUILD") " been renamed, see <https://postmarketos.org/renamed>")
logging.fatal(aport + "/deviceinfo")
raise RuntimeError("Incomplete device information")
ret = {} ret = {}
path = aport + "/deviceinfo" path = aport + "/deviceinfo"