Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
users-openslx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
cdn
users-openslx
Commits
a0633dd8
Commit
a0633dd8
authored
9 years ago
by
Thiago Abdo
Browse files
Options
Downloads
Patches
Plain Diff
Update sketch_hd_user
Signed-off-by:
Thiago Abdo
<
tja14@inf.ufpr.br
>
parent
5ba9d6e8
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
hdd/sketch_hd_user.sh
+79
-10
79 additions, 10 deletions
hdd/sketch_hd_user.sh
with
79 additions
and
10 deletions
hdd/sketch_hd_user.sh
+
79
−
10
View file @
a0633dd8
#!/bin/
b
ash
#!/bin/ash
#Check if the user running this code has permissoes to run it
if
[
"
$(
/usr/bin/id
-r
-u
)
"
!=
"0"
]
;
then
...
...
@@ -8,26 +8,95 @@ if [ "$(/usr/bin/id -r -u)" != "0" ]; then
#echo $0": Você tem permissoes para executar esse programa"
fi
if
[
-z
"
$1
"
]
;
then
.
/opt/openslx/config
||
{
echo
"Could not source config!"
;
exit
23
;
}
else
.
"
$1
"
||
{
echo
"Could not source custom config!"
;
exit
23
;
}
fi
unset
IFS
set
$SLX_USERS
while
((
$#)
)
;
do
#Get infos from file
passwdf
=
$(
echo
$1
|
cut
-d
'='
-f2
)
shift
shadowf
=
$(
echo
$1
|
cut
-d
'='
-f2
)
shift
groupf
=
$(
echo
$1
|
cut
-d
'='
-f2
)
shift
username
=
$(
echo
$passwdf
|
cut
-d
':'
-f1
)
uID
=
$(
echo
$passwdf
|
cut
-d
':'
-f3
)
globalID
=
$(
echo
$uID
|
grep
-e
"^3....$"
)
groupname
=
$(
echo
$groupf
|
cut
-d
':'
-f1
)
gID
=
$(
echo
$groupf
|
cut
-d
':'
-f3
)
globalGID
=
$(
echo
$gID
|
grep
-e
"^3....$"
)
#group == username
if
[
"
$username
"
=
"
$groupname
"
]
;
then
#id no range certo(local user)
if
[
-n
"
$globalID
"
]
&&
[
-n
"
$globalGID
"
]
;
then
#add to files;
./adduser.sh
"
$passwdf
"
"
$groupf
"
"
$shadowf
"
"global"
fi
fi
done
#add groups to global users
#for line in SLX_GROUPS; do
# IFS=,
# set $line
# username=$1
# shift
# while (($#)); do
# addusertogroup "$username" "$1"
# temp=$(mktemp)
# firstuser=$( echo /etc/group | grep -e '^$1:.*:.*:$' )
# if [ -n "$firstuser" ]; then
# sed -e 's/^$1.*/&$username/' /etc/group > $temp
# else
# sed -e 's/^$1.*/&,$username/' /etc/group > $temp
# fi
# cp $temp /etc/group
# chown root:root /etc/group
# chmod 644 /etc/group
# rm $temp
# shift
# done
# unset IFS
#done
#Instanciates the configuration file
unset
IFS
users
=
$(
cat
config
)
;
users
=
$(
cat
/home/openslx/
config
)
;
set
$users
while
((
$#)
)
;
do
#Get infos from file
passwd
=
$(
echo
$1
|
cut
-d
'='
-f2
)
passwd
f
=
$(
echo
$1
|
cut
-d
'='
-f2
)
shift
shadow
=
$(
echo
$1
|
cut
-d
'='
-f2
)
shadow
f
=
$(
echo
$1
|
cut
-d
'='
-f2
)
shift
group
=
$(
echo
$1
|
cut
-d
'='
-f2
)
group
f
=
$(
echo
$1
|
cut
-d
'='
-f2
)
shift
#check for errors
username
=
$(
echo
$passwdf
|
cut
-d
':'
-f1
)
uID
=
$(
echo
$passwdf
|
cut
-d
':'
-f3
)
localID
=
$(
echo
$uID
|
grep
-e
"^2....$"
-e
"^1....$"
)
groupname
=
$(
echo
$groupf
|
cut
-d
':'
-f1
)
gID
=
$(
echo
$groupf
|
cut
-d
':'
-f3
)
localGID
=
$(
echo
$gID
|
grep
-e
"^2....$"
-e
"^1....$"
)
#group == username
if
[
"
$username
"
=
"
$groupname
"
]
;
then
#id no range certo(local user)
if
[
-n
"
$localID
"
]
&&
[
-n
"
$localGID
"
]
;
then
#add to files;
#adduser.sh "$passwd" "$shadow" "$group"
./adduser.sh
"
$passwdf
"
"
$groupf
"
"
$shadowf
"
fi
fi
done
#if [ -d /home/openslx ]; then
...
...
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