Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
13
Merge Requests
13
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.package
Commits
9f9ea659
Commit
9f9ea659
authored
May 01, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace default home path in /etc/passwd
Report error when no group name specifed
parent
bf5a1ade
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
13 deletions
+20
-13
windows/scripts/groupadd
windows/scripts/groupadd
+12
-8
windows/scripts/useradd
windows/scripts/useradd
+8
-5
No files found.
windows/scripts/groupadd
View file @
9f9ea659
...
...
@@ -30,12 +30,16 @@
#
ACTION
=
ADD
GROUP_NAME
=
$1
net localgroup
"
${
GROUP_NAME
}
"
/
${
ACTION
}
if
((
$?
==
0
))
;
then
if
[[
$ACTION
==
"ADD"
]]
;
then
grep
-q
"^
${
GROUP_NAME
}
"
/etc/group
&&
sed
-i
-e
"/^
${
GROUP_NAME
}
/d"
/etc/group
mkgroup |
grep
"^
${
GROUP_NAME
}
:"
>>
/etc/group
elif
[[
$ACTION
==
"DELETE"
]]
;
then
grep
-q
"^
${
GROUP_NAME
}
"
/etc/group
&&
sed
-i
-e
"/^
${
GROUP_NAME
}
/d"
/etc/group
fi
if
[[
"
$GROUP_NAME
"
==
""
]]
;
then
echo
Error: no group name specified.
exit
1
fi
if
[[
$ACTION
==
"ADD"
]]
;
then
NET LOCALGROUP
"
${
GROUP_NAME
}
"
/ADD
grep
-q
"^
${
GROUP_NAME
}
"
/etc/group
&&
sed
-i
-e
"/^
${
GROUP_NAME
}
/d"
/etc/group
mkgroup |
grep
"^
${
GROUP_NAME
}
:"
>>
/etc/group
elif
[[
$ACTION
==
"DELETE"
]]
;
then
NET LOCALGROUP
"
${
GROUP_NAME
}
"
/DELETE
grep
-q
"^
${
GROUP_NAME
}
"
/etc/group
&&
sed
-i
-e
"/^
${
GROUP_NAME
}
/d"
/etc/group
fi
windows/scripts/useradd
View file @
9f9ea659
...
...
@@ -45,8 +45,11 @@ while getopts "Dd:g:G:p:s:r" opt ; do
d
)
USER_HOME
=
$OPTARG
;;
g|G
)
USER_GROUP
=
$OPTARG
g
)
USER_INIT_GROUP
=
grp_
$OPTARG
;;
G
)
USER_OTHER_GROUP
=
grp_
$OPTARG
;;
p
)
USER_PASSWORD
=
$OPTARG
...
...
@@ -77,10 +80,10 @@ if (( $? == 0 )) ; then
NET USER
"
${
USER_NAME
}
"
"
${
USER_PASSWORD
}
"
/ADD
grep
-q
"^
${
USER_NAME
}
"
/etc/passwd
&&
sed
-i
-e
"/^
${
USER_NAME
}
/d"
/etc/passwd
mkpasswd |
grep
"^
${
USER_NAME
}
:"
>>
/etc/passwd
[[
$USER_HOME
==
"/home/
$USER_NAME
"
]]
||
sed
-i
-e
"s%:/home/
${
USER_NAME
}
:%:
${
USER_HOME
}
:%g"
/etc/passwd
[[
!
"
$USER_HOME
"
==
""
]]
&&
[[
!
-f
$USER_HOME
]]
&&
mkdir
-p
$USER_HOME
&&
chown
$USER_NAME
$USER_HOME
if
[[
!
"
$USER_GROUP
"
==
""
]]
;
then
NET LOCALGROUP
$USER_GROUP
$USER_NAME
/ADD
fi
[[
"
$USER_INIT_GROUP
"
==
""
]]
||
NET LOCALGROUP
$USER_INIT_GROUP
$USER_NAME
/ADD
[[
"
$USER_OTHER_GROUP
"
==
""
]]
||
NET LOCALGROUP
$USER_OTHER_GROUP
$USER_NAME
/ADD
elif
[[
$ACTION
==
"DELETE"
]]
;
then
NET USER
"
${
USER_NAME
}
"
/DELETE
grep
-q
"^
${
USER_NAME
}
"
/etc/passwd
&&
sed
-i
-e
"/^
${
USER_NAME
}
/d"
/etc/passwd
...
...
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