2N/A# The contents of this file are subject to the terms of the 2N/A# Common Development and Distribution License (the "License"). 2N/A# You may not use this file except in compliance with the License. 2N/A# See the License for the specific language governing permissions 2N/A# and limitations under the License. 2N/A# When distributing Covered Code, include this CDDL HEADER in each 2N/A# If applicable, add the following below this CDDL HEADER, with the 2N/A# fields enclosed by brackets "[]" replaced with your own identifying 2N/A# information: Portions Copyright [yyyy] [name of copyright owner] 2N/A# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 2N/Ax86 Solaris Boot variables backend support for pybootmgmt 2N/A """This class supports manipulation of boot variables stored in the 2N/A # if the property name contains whitespace, it's invalid 2N/A if value is None:
# Not allowed -- there must be a real value here 2N/A # All we need to do is update the value portion of the list 2N/A # (this automatically "updates" the value stored in _rawlines) 2N/A # The _vardict must use the same object that's added to _rawlines 2N/A # so that updates are seamless across both containers 2N/A # The values stored in the dictionary are 2-element lists 2N/A # The first element is the prop name and the second is the value 2N/A # Clear the list first so that _rawlines is "updated" to contain 2N/A # a 0-length list for this property 2N/A # Now remove the property from the _vardict dict 2N/A """Reads the set of properties from the bootenv.rc file under 2N/A sysroot. Keeps a copy of the file in memory so comments can 2N/A # skip comment lines 2N/A # Store the property in the _rawlines list as a 2N/A # list so that we can make changes via the _vardict 2N/A # The form of a line is: 2N/A # setprop <propname> <propval> 2N/A # If we find a line that's malformed, ignore it and 2N/A # Open a new file that will contain the new bootenv.rc, dump all 2N/A # the variables to that file, then move that file over to be the 2N/A # BOOTENV_DOT_RC has a leading slash: 2N/A # Write each line to the output file -- if the item in 2N/A # _rawlines is a list, construct a setprop command string, 2N/A # otherwise, just copy it verbatim 2N/A # Now move the file over the become the new bootenv.rc: 2N/A # Try to clean up by deleting the temporary file 2N/A 'bootenv.rc (%s) to %s' %
2N/A 'root',
'sys',
0644)]