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
1359501d
Commit
1359501d
authored
Jul 25, 2018
by
SamwiseFilmore
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use shadowfile for user creation
parent
999db45b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
src/install.rs
src/install.rs
+10
-3
No files found.
src/install.rs
View file @
1359501d
...
...
@@ -163,6 +163,7 @@ pub fn install<P: AsRef<Path>, S: AsRef<str>>(config: Config, output: P, cookboo
}
let
mut
passwd
=
String
::
new
();
let
mut
shadow
=
String
::
new
();
let
mut
next_uid
=
1000
;
for
(
username
,
user
)
in
config
.users
{
let
password
=
if
let
Some
(
password
)
=
user
.password
{
...
...
@@ -195,11 +196,17 @@ pub fn install<P: AsRef<Path>, S: AsRef<str>>(config: Config, output: P, cookboo
dir!
(
home
.trim_matches
(
'/'
));
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
()
{
if
!
passwd
.is_empty
()
{
file!
(
"etc/passwd"
,
passwd
.as_bytes
(),
false
);
}
if
!
shadow
.is_empty
()
{
file!
(
"etc/shadow"
,
shadow
.as_bytes
(),
false
);
}
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