Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SteamOS Devkit Service
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
devkit
SteamOS Devkit Service
Commits
b1d29440
Commit
b1d29440
authored
3 years ago
by
Jeremy Whiting
Browse files
Options
Downloads
Patches
Plain Diff
Read ShellUsers from configs and fix /login-name implementation.
parent
b65c290c
No related branches found
No related tags found
1 merge request
!1
Rewrite devkit service in python.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/steamos-devkit-service.py
+25
-0
25 additions, 0 deletions
src/steamos-devkit-service.py
with
25 additions
and
0 deletions
src/steamos-devkit-service.py
+
25
−
0
View file @
b1d29440
...
@@ -38,6 +38,7 @@ DEVKIT_HOOKS_DIR = "/usr/share/steamos-devkit/hooks"
...
@@ -38,6 +38,7 @@ DEVKIT_HOOKS_DIR = "/usr/share/steamos-devkit/hooks"
# root until config is loaded and told otherwise, etc.
# root until config is loaded and told otherwise, etc.
entry_point_user
=
"
root
"
entry_point_user
=
"
root
"
device_users
=
[]
properties
=
{}
properties
=
{}
machine_name
=
''
machine_name
=
''
hook_dirs
=
[]
hook_dirs
=
[]
...
@@ -145,6 +146,9 @@ class DevkitHandler(BaseHTTPRequestHandler):
...
@@ -145,6 +146,9 @@ class DevkitHandler(BaseHTTPRequestHandler):
class
DevkitService
:
class
DevkitService
:
def
__init__
(
self
):
def
__init__
(
self
):
global
entry_point_user
global
device_users
self
.
port
=
SERVICE_PORT
self
.
port
=
SERVICE_PORT
if
'
Settings
'
in
global_config
:
if
'
Settings
'
in
global_config
:
...
@@ -157,6 +161,27 @@ class DevkitService:
...
@@ -157,6 +161,27 @@ class DevkitService:
if
'
Port
'
in
settings
:
if
'
Port
'
in
settings
:
self
.
port
=
int
(
settings
[
"
Port
"
])
self
.
port
=
int
(
settings
[
"
Port
"
])
# Parse users from configs
if
os
.
geteuid
()
==
0
:
# Running as root, maybe warn?
print
(
"
Running as root, Probably shouldn
'
t be
\n
"
)
if
'
Users
'
in
global_config
:
users
=
global_config
[
"
Users
"
]
if
'
ShellUsers
'
in
users
:
device_users
=
users
[
"
ShellUsers
"
]
else
:
if
'
Users
'
in
user_config
:
users
=
user_config
[
"
Users
"
]
if
'
ShellUsers
'
in
users
:
device_users
=
users
[
"
ShellUsers
"
]
else
:
device_users
=
[
os
.
getlogin
()]
# If only one user, that's the entry point user
# Otherwise entry_point_user needs to be root to be able to switch between users
if
len
(
device_users
)
==
1
:
entry_point_user
=
device_users
[
0
]
self
.
httpd
=
socketserver
.
TCPServer
((
""
,
self
.
port
),
DevkitHandler
,
bind_and_activate
=
False
)
self
.
httpd
=
socketserver
.
TCPServer
((
""
,
self
.
port
),
DevkitHandler
,
bind_and_activate
=
False
)
print
(
"
serving at port: {}
"
.
format
(
self
.
port
))
print
(
"
serving at port: {}
"
.
format
(
self
.
port
))
print
(
"
machine name: {}
"
.
format
(
machine_name
))
print
(
"
machine name: {}
"
.
format
(
machine_name
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment