Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
installer
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
Container Registry
Model registry
Operate
Environments
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
redox-os
installer
Commits
39f4b1c8
Verified
Commit
39f4b1c8
authored
1 year ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Make bootloader install directory per-process
parent
ba2fc38a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib.rs
+21
-18
21 additions, 18 deletions
src/lib.rs
with
21 additions
and
18 deletions
src/lib.rs
+
21
−
18
View file @
39f4b1c8
...
@@ -329,20 +329,20 @@ pub fn with_redoxfs<D, T, F>(disk: D, password_opt: Option<&[u8]>, callback: F)
...
@@ -329,20 +329,20 @@ pub fn with_redoxfs<D, T, F>(disk: D, password_opt: Option<&[u8]>, callback: F)
}
}
pub
fn
fetch_bootloaders
<
S
:
AsRef
<
str
>>
(
config
:
&
Config
,
cookbook
:
Option
<
S
>
,
live
:
bool
)
->
Result
<
(
Vec
<
u8
>
,
Vec
<
u8
>
)
>
{
pub
fn
fetch_bootloaders
<
S
:
AsRef
<
str
>>
(
config
:
&
Config
,
cookbook
:
Option
<
S
>
,
live
:
bool
)
->
Result
<
(
Vec
<
u8
>
,
Vec
<
u8
>
)
>
{
//TODO: make it safe to run this concurrently
let
bootloader_dir
=
format!
(
"/tmp/redox_installer_bootloader_{}"
,
process
::
id
());
let
bootloader_dir
=
"/tmp/redox_installer_bootloader"
;
if
Path
::
new
(
bootloader_dir
)
.exists
()
{
if
Path
::
new
(
&
bootloader_dir
)
.exists
()
{
fs
::
remove_dir_all
(
&
bootloader_dir
)
?
;
fs
::
remove_dir_all
(
&
bootloader_dir
)
?
;
}
}
fs
::
create_dir
(
bootloader_dir
)
?
;
fs
::
create_dir
(
&
bootloader_dir
)
?
;
let
mut
bootloader_config
=
Config
::
default
();
let
mut
bootloader_config
=
Config
::
default
();
bootloader_config
.general
=
config
.general
.clone
();
bootloader_config
.general
=
config
.general
.clone
();
bootloader_config
.packages
.insert
(
"bootloader"
.to_string
(),
PackageConfig
::
default
());
bootloader_config
.packages
.insert
(
"bootloader"
.to_string
(),
PackageConfig
::
default
());
install_packages
(
&
bootloader_config
,
bootloader_dir
,
cookbook
.as_ref
());
install_packages
(
&
bootloader_config
,
&
bootloader_dir
,
cookbook
.as_ref
());
let
boot_dir
=
Path
::
new
(
bootloader_dir
)
.join
(
"boot"
);
let
boot_dir
=
Path
::
new
(
&
bootloader_dir
)
.join
(
"boot"
);
let
bios_path
=
boot_dir
.join
(
if
live
{
let
bios_path
=
boot_dir
.join
(
if
live
{
"bootloader-live.bios"
"bootloader-live.bios"
}
else
{
}
else
{
...
@@ -353,18 +353,21 @@ pub fn fetch_bootloaders<S: AsRef<str>>(config: &Config, cookbook: Option<S>, li
...
@@ -353,18 +353,21 @@ pub fn fetch_bootloaders<S: AsRef<str>>(config: &Config, cookbook: Option<S>, li
}
else
{
}
else
{
"bootloader.efi"
"bootloader.efi"
});
});
Ok
((
if
bios_path
.exists
()
{
let
bios_data
=
if
bios_path
.exists
()
{
fs
::
read
(
bios_path
)
?
fs
::
read
(
bios_path
)
?
}
else
{
}
else
{
Vec
::
new
()
Vec
::
new
()
},
};
if
efi_path
.exists
()
{
let
efi_data
=
if
efi_path
.exists
()
{
fs
::
read
(
efi_path
)
?
fs
::
read
(
efi_path
)
?
}
else
{
}
else
{
Vec
::
new
()
Vec
::
new
()
},
};
))
fs
::
remove_dir_all
(
&
bootloader_dir
)
?
;
Ok
((
bios_data
,
efi_data
))
}
}
//TODO: make bootloaders use Option, dynamically create BIOS and EFI partitions
//TODO: make bootloaders use Option, dynamically create BIOS and EFI partitions
...
...
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