Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
installer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
redox-os
installer
Commits
03cae0ca
Commit
03cae0ca
authored
Aug 17, 2018
by
SamwiseFilmore
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement shadowfile
parent
66b24d11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
src/lib.rs
src/lib.rs
+15
-1
No files found.
src/lib.rs
View file @
03cae0ca
...
...
@@ -151,6 +151,7 @@ pub fn install<P: AsRef<Path>, S: AsRef<str>>(config: Config, output_dir: P, coo
}
let
mut
passwd
=
String
::
new
();
let
mut
shadow
=
String
::
new
();
let
mut
next_uid
=
1000
;
for
(
username
,
user
)
in
config
.users
{
...
...
@@ -197,7 +198,8 @@ pub fn install<P: AsRef<Path>, S: AsRef<str>>(config: Config, output_dir: P, coo
let
password
=
hash_password
(
&
password
)
?
;
passwd
.push_str
(
&
format!
(
"{};{};{};{};{};file:{};file:{}
\n
"
,
username
,
password
,
uid
,
gid
,
name
,
home
,
shell
));
passwd
.push_str
(
&
format!
(
"{};{};{};{};file:{};file:{}
\n
"
,
username
,
uid
,
gid
,
name
,
home
,
shell
));
shadow
.push_str
(
&
format!
(
"{};{}
\n
"
,
username
,
password
));
}
if
!
passwd
.is_empty
()
{
...
...
@@ -212,6 +214,18 @@ pub fn install<P: AsRef<Path>, S: AsRef<str>>(config: Config, output_dir: P, coo
gid
:
None
}
.create
(
&
output_dir
)
?
;
}
if
!
shadow
.is_empty
()
{
FileConfig
{
path
:
"/etc/shadow"
.to_string
(),
data
:
shadow
,
symlink
:
false
,
directory
:
false
,
mode
:
Some
(
0o0600
),
uid
:
Some
(
0
),
gid
:
Some
(
0
)
}
.create
(
&
output_dir
)
?
;
}
Ok
(())
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment