Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #79 from gsmc-alx/master
Browse files Browse the repository at this point in the history
Prefs Read/Write Fix
  • Loading branch information
chilcote authored Oct 23, 2020
2 parents 3c8858d + c1f3754 commit 8e73988
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
PKGTITLE="outset"
PKGVERSION="3.0.1"
PKGVERSION="3.0.2"
PKGID=com.github.outset
PROJECT="outset"

#################################################

##Help - Show this help menu
help:
help:
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

## clean - Clean up temporary working directories
Expand Down
25 changes: 16 additions & 9 deletions pkgroot/usr/local/outset/outset
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ def process_items(path, delete_items=False, once=False, override={}):

if once:
try:
d = plistlib.readPlist(run_once_plist)
with open(run_once_plist, 'rb') as fp:
d = plistlib.load(fp)
except:
d = {}

Expand Down Expand Up @@ -367,8 +368,8 @@ def process_items(path, delete_items=False, once=False, override={}):
cleanup(script)

if d:
plistlib.writePlist(d, run_once_plist)

with open(run_once_plist, 'wb') as fp:
plistlib.dump(d, fp)

def main():
"""Main method"""
Expand Down Expand Up @@ -447,7 +448,8 @@ def main():
prefs = {}

if os.path.exists(outset_preferences):
prefs = plistlib.readPlist(outset_preferences)
with open(outset_preferences, 'rb') as fp:
prefs = plistlib.load(fp)
network_wait = prefs.get("wait_for_network", True)
network_timeout = prefs.get("network_timeout", 180)
ignored_users = prefs.get("ignored_users", [])
Expand Down Expand Up @@ -495,7 +497,8 @@ def main():
prefs["network_timeout"] = network_timeout
prefs["ignored_users"] = ignored_users
prefs["override_login_once"] = override_login_once
plistlib.writePlist(prefs, outset_preferences)
with open(outset_preferences, 'wb') as fp:
plistlib.dump(prefs, fp)

logging.info("Boot processing complete")

Expand Down Expand Up @@ -578,7 +581,8 @@ def main():
users_to_ignore = list(set(users_to_add)) if users_to_add else None
if users_to_ignore:
prefs["ignored_users"] = users_to_ignore
plistlib.writePlist(prefs, outset_preferences)
with open(outset_preferences, 'wb') as fp:
plistlib.dump(prefs, fp)

if args.remove_ignored_user:
if os.getuid() != 0:
Expand All @@ -590,7 +594,8 @@ def main():
for user in users_to_remove:
if user in prefs["ignored_users"]:
prefs["ignored_users"].remove(user)
plistlib.writePlist(prefs, outset_preferences)
with open(outset_preferences, 'wb') as fp:
plistlib.dump(prefs, fp)

if args.add_override:
if os.getuid() != 0:
Expand All @@ -611,7 +616,8 @@ def main():
prefs["override_login_once"].update(override_items)
else:
prefs["override_login_once"] = override_items
plistlib.writePlist(prefs, outset_preferences)
with open(outset_preferences, 'wb') as fp:
plistlib.dump(prefs, fp)

if args.remove_override:
if os.getuid() != 0:
Expand All @@ -624,7 +630,8 @@ def main():
script = os.path.join(login_once_dir, script)
if script in prefs["override_login_once"]:
del prefs["override_login_once"][script]
plistlib.writePlist(prefs, outset_preferences)
with open(outset_preferences, 'wb') as fp:
plistlib.dump(prefs, fp)

if args.version:
print(__version__)
Expand Down

0 comments on commit 8e73988

Please sign in to comment.