Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate user data from program logic #11

Closed
timthelion opened this issue Feb 12, 2014 · 3 comments
Closed

Separate user data from program logic #11

timthelion opened this issue Feb 12, 2014 · 3 comments
Labels
Milestone

Comments

@timthelion
Copy link
Contributor

It should be possible to have the "programsThatCanBeInstalled" and the "bin" directory somewhere other than the subuser directory. The subuser directory should be able to be installed somewhere separate from the user data.

@peter1000
Copy link
Contributor

Why not add a small: conf-subuser file in the subuser base directory

simples option: using a 'conf-subuser.py' and import it when executing subuser (which should stay in the subuser base directory /bin or so

programsThatCanBeInstalledPath = "/blabla/bla"
subuser-binPath = "/blabla/bla"

or use a 'conf-subuser.json' and use json to handle it

@timthelion
Copy link
Contributor Author

I think that the proper approach is to add optional json files to the users home dir and the /etc/ directory which would specify alternate locations for things. Like:

~/.subuser/conf.json

and

/etc/subuser/conf.json

The key thing is that these config files have to be optional, so that the run-in-place variety of subuser still works without hitch.

@timthelion
Copy link
Contributor Author

subuser/logic/subuserCommands/subuserlib/paths.py will look for paths in the following order:

First it will look for paths in ~/.subuser/paths.json then /etc/subuser/paths.json then $SUBUSERDIR/paths.json. This will be a partial fallback method, so that ~/.subuser/paths.json and /etc/subuser/paths.json may contain some but not all of the paths. $SUBUSERDIR/paths.json must contain all paths though as it defines the paths. When expanding these paths the ENV_VAR $SUBUSER must be set appropriately.

Run os.path.expandvars(path) on the paths.

$SUBUSER/paths.json will look like:

{
  "repositories" : ["$SUBUSERDIR/programsThatCanBeInstalled"],
  "bin" : "$SUBUSERDIR/bin",
  "installed-programs.json" : "$SUBUSERDIR/installed-programs.json",
  "user-set-permissions-dir" : "$SUBUSERDIR/permissions/",
  "program-home-dirs-dir" : "$SUBUSERDIR/homes/"
}

paths.json will be documented the same way permissions.json is documented.

Once this is done, #12 (comment) will be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants