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
0
Merge Requests
0
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
Kristopher Ruzic
slapos.package
Commits
159cdc39
Commit
159cdc39
authored
Sep 18, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cygwin: assing primary group to users, no special handling for grp_*
parent
b443828c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
4 deletions
+25
-4
windows/scripts/set_primary_group
windows/scripts/set_primary_group
+16
-0
windows/scripts/slapos-all-in-one.iss
windows/scripts/slapos-all-in-one.iss
+1
-0
windows/scripts/useradd
windows/scripts/useradd
+3
-1
windows/scripts/usermod
windows/scripts/usermod
+5
-3
No files found.
windows/scripts/set_primary_group
0 → 100644
View file @
159cdc39
#!/bin/bash
USER
=
$1
GROUP
=
$2
[
-z
"
$USER
"
]
&&
echo
"User name is required"
>
&2
&&
exit
1
[
-z
"
$GROUP
"
]
&&
echo
"Group name is required"
>
&2
&&
exit
2
GID
=
$(
egrep
"^
$GROUP
"
/etc/group |
cut
-f3
-d
':'
)
[
-z
"
$GID
"
]
&&
echo
"User
$USER
not in passwd"
>
&2
&&
exit
3
sed
-i
"s/^
$USER
:unused:
\(
[0-9]*
\)
:[0-9]*:/
$USER
:unused:
\1
:
$GID
:/"
/etc/passwd
echo
"User
$USER
: primary group set to
$GROUP
"
windows/scripts/slapos-all-in-one.iss
View file @
159cdc39
...
...
@@ -46,6 +46,7 @@ Source: "cygwin\opt\git\slapos.package\windows\scripts\ip"; DestDir: "{app}\cygw
Source: "cygwin\opt\git\slapos.package\windows\scripts\useradd"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "cygwin\opt\git\slapos.package\windows\scripts\usermod"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "cygwin\opt\git\slapos.package\windows\scripts\groupadd"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "cygwin\opt\git\slapos.package\windows\scripts\set_primary_group"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "cygwin\opt\git\slapos.package\windows\scripts\brctl"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "cygwin\opt\git\slapos.package\windows\scripts\tunctl"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "cygwin\opt\git\slapos.package\windows\scripts\slapos-cron-config"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
...
...
windows/scripts/useradd
View file @
159cdc39
...
...
@@ -153,7 +153,7 @@ function add_member_to_group()
{
local
name
=
$1
local
grpname
=
$2
net localgroup
$grpname
>
/dev/null 2>&1
||
grpname
=
"
grp_
$grpname
"
net localgroup
$grpname
>
/dev/null 2>&1
||
grpname
=
"
$grpname
"
net localgroup
$grpname
>
/dev/null 2>&1
||
return
1
if
!
net localgroup
$grpname
|
grep
-q
-e
"^
$name
$"
;
then
net localgroup
$grpname
$name
/add
...
...
@@ -206,6 +206,8 @@ for grpname in ${USER_INIT_GROUP} ${USER_OTHER_GROUP} ; do
(
echo
"Failed to add
${
USER_NAME
}
to group
$group
"
;
exit
1
)
done
set_primary_group
$USER_NAME
$USER_INIT_GROUP
# net user "${USER_NAME}" /delete ||
# (echo "Failed to delete user ${USER_NAME}" ; exit 1)
# sed -i -e "/^${USER_NAME}/d" /etc/passwd
windows/scripts/usermod
View file @
159cdc39
...
...
@@ -45,10 +45,10 @@ while getopts "Dd:g:G:p:s:r" opt ; do
USER_HOME
=
$OPTARG
;;
g
)
USER_INIT_GROUP
=
grp_
$OPTARG
USER_INIT_GROUP
=
$OPTARG
;;
G
)
USER_OTHER_GROUP
=
grp_
$OPTARG
USER_OTHER_GROUP
=
$OPTARG
;;
p
)
USER_PASSWORD
=
$OPTARG
...
...
@@ -76,4 +76,6 @@ USER_HOME=${USER_HOME:=/home/$USER_NAME}
grep
-q
"^
${
USER_NAME
}
"
/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
[[
!
"
$USER_HOME
"
==
""
]]
&&
[[
!
-f
$USER_HOME
]]
&&
mkdir
-p
$USER_HOME
&&
chown
$USER_NAME
.
$USER_INIT_GROUP
$USER_HOME
set_primary_group
$USER_NAME
$USER_INIT_GROUP
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