Fix doc comments and ignore package checksums

This commit is contained in:
Tim Gover
2020-09-25 17:33:49 +01:00
parent ccd8444501
commit ca647a6b90

View File

@@ -104,7 +104,11 @@ def apply_update(config, eeprom=None):
sys.stdout.write("Updating bootloader EEPROM\n image: %s\nconfig: %s\n%s\n" % sys.stdout.write("Updating bootloader EEPROM\n image: %s\nconfig: %s\n%s\n" %
(eeprom_image, config, config_str)) (eeprom_image, config, config_str))
args = ['sudo', 'rpi-eeprom-update', '-d', '-f', tmp_update]
# Ignore APT package checksums so that this doesn't fail when used
# with EEPROMs with configs delivered outside of APT.
# The checksums are really just a safety check for automatic updates.
args = ['sudo', 'rpi-eeprom-update', '-d', '-i', '-f', tmp_update]
resp = shell_cmd(args) resp = shell_cmd(args)
sys.stdout.write(resp) sys.stdout.write(resp)
@@ -112,15 +116,18 @@ def edit_config(eeprom=None):
""" """
Implements something like visudo for editing EEPROM configs. Implements something like visudo for editing EEPROM configs.
""" """
if 'EDITOR' not in os.environ: # Default to nano if $EDITOR is not defined.
exit_error('EDITOR environment variable not defined') editor='nano'
if 'EDITOR' in os.environ:
editor=os.environ['EDITOR']
create_tempdir() create_tempdir()
current_config = read_current_config() current_config = read_current_config()
tmp_conf = os.path.join(TEMP_DIR, 'boot.conf') tmp_conf = os.path.join(TEMP_DIR, 'boot.conf')
out = open(tmp_conf, 'w') out = open(tmp_conf, 'w')
out.write(current_config) out.write(current_config)
out.close() out.close()
cmd = "\'%s\' \'%s\'" % (os.environ['EDITOR'], tmp_conf) cmd = "\'%s\' \'%s\'" % (editor, tmp_conf)
result = os.system(cmd) result = os.system(cmd)
if result != 0: if result != 0:
exit_error("Aborting update because \'%s\' exited with code %d." % (cmd, result)) exit_error("Aborting update because \'%s\' exited with code %d." % (cmd, result))
@@ -247,7 +254,7 @@ Operating modes:
The new image file can be installed via rpi-eeprom-update The new image file can be installed via rpi-eeprom-update
rpi-eeprom-update -d -f newimage.bin rpi-eeprom-update -d -f newimage.bin
4. Applies a given config file an EEPROM image and invokes rpi-eeprom-update 4. Applies a given config file to an EEPROM image and invokes rpi-eeprom-update
to schedule an update of the bootloader when the system is rebooted. to schedule an update of the bootloader when the system is rebooted.
rpi-eeprom-config --apply boot.conf [pieeprom.bin] rpi-eeprom-config --apply boot.conf [pieeprom.bin]