Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
init
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Anhad Singh
init
Commits
d038cfea
Verified
Commit
d038cfea
authored
1 year ago
by
Anhad Singh
Browse files
Options
Downloads
Patches
Plain Diff
init: set the `DISPLAY` environment variable to the VT#
Signed-off-by:
Anhad Singh
<
andypythonappdeveloper@gmail.com
>
parent
b9ea46e2
No related branches found
Branches containing commit
Tags
4.0.3
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.rs
+1
-29
1 addition, 29 deletions
src/main.rs
with
1 addition
and
29 deletions
src/main.rs
+
1
−
29
View file @
d038cfea
...
...
@@ -78,35 +78,7 @@ pub fn run(file: &Path) -> Result<()> {
println!
(
"init: failed to run: no argument"
);
},
"run.d"
=>
if
let
Some
(
new_dir
)
=
args
.next
()
{
// On startup, the VESA display driver is started which basically makes use of the framebuffer
// provided by the firmware. The GPU device are latter started by `pcid` (such as `virtio-gpu`).
let
mut
devices
=
vec!
[];
let
schemes
=
std
::
fs
::
read_dir
(
":"
)
.unwrap
();
for
entry
in
schemes
{
let
path
=
entry
.unwrap
()
.path
();
let
path_str
=
path
.into_os_string
()
.into_string
()
.expect
(
"init: failed to convert path to string"
);
if
path_str
.contains
(
"display"
)
{
println!
(
"init: found display scheme {}"
,
path_str
);
devices
.push
(
path_str
);
}
}
let
device
=
devices
.iter
()
.filter
(|
d
|
!
d
.contains
(
"vesa"
))
.collect
::
<
Vec
<
_
>>
();
let
device
=
if
device
.is_empty
()
{
// No GPU available, fallback to VESA display which *should* always be accessible.
"vesa"
}
else
{
// :/display/virtio-gpu
// ^^^^^^^^^^
device
[
0
]
.split
(
"/"
)
.nth
(
2
)
.unwrap
()
};
std
::
env
::
set_var
(
"DISPLAY"
,
&
format!
(
"display/{}:3/activate"
,
device
));
std
::
env
::
set_var
(
"DISPLAY"
,
"3"
);
let
mut
entries
=
vec!
[];
match
read_dir
(
&
new_dir
)
{
...
...
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