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
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
c5b96bf1
Commit
c5b96bf1
authored
9 years ago
by
Thiago Abdo
Browse files
Options
Downloads
Patches
Plain Diff
Finaliza hd_drive
Signed-off-by:
Thiago Abdo
<
tja14@inf.ufpr.br
>
parent
2d429f7c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
usb_drive/setup_usb.sh
+40
-33
40 additions, 33 deletions
usb_drive/setup_usb.sh
with
40 additions
and
33 deletions
usb_drive/setup_usb.sh
+
40
−
33
View file @
c5b96bf1
...
...
@@ -195,42 +195,49 @@ function usb_drive {
}
function
hd_drive
{
mount_path
=
"/home"
create_dir
# crete the dir /home/openslx and config files
if
[
!
-d
"/home/openslx"
]
;
then
mkdir
-p
/home/openslx/
fi
if
[
!
-e
"/home/openslx/config"
]
;
then
touch
/home/openslx/config
fi
if
[
!
-e
"/home/openslx/log"
]
;
then
touch
/home/openslx/log
fi
#get the username
new_user
=
$(
dialog
--stdout
--inputbox
'Digite o nome de usuário:'
0 0
)
check_user_name
=
`
cat
"
$mount_path
"
/Openslx/log |
grep
-w
"
$new_user
"
`
while
[[
-n
$check_user_name
]]
;
do
new_user
=
$(
dialog
--stdout
--inputbox
'Nome de usuário já existente. Digite outro nome de usuário:'
0 0
)
check_user_name
=
`
cat
"
$mount_path
"
/Openslx/log |
grep
-w
"
$new_user
"
`
done
read_user_pass
#get the password
pass
=
$(
dialog
--stdout
--passwordbox
'Por favor, digite a senha:'
0 0
)
check_pass
=
$(
dialog
--stdout
--passwordbox
'Por favor, confirme a senha:'
0 0
)
while
[
"
$pass
"
!=
"
$check_pass
"
]
;
do
user_id
=
cat
/etc/passwd |
cut
-d
:
-f3
|
grep
-e
2....
$
|
sort
-h
|
tail
-n
1
if
[
-z
"
$user_id
"
]
;
then
user_id
=
20000
else
user_id
=
$((
$user_id
+
1
))
if
[
user_id
-ge
30000
]
;
then
echo
$0
": Provavelmente acabou os id's valido, procurando sequencialmente"
>
/home/openslx/log
#Da para tentar fazer algum código usando diff e {20000..29999}
#Ai nao precisa desse loop
for
i
in
$(
echo
{
20000..29999
}
)
;
do
user_id
=
cat
/etc/passwd |
cut
-d
:
-f3
|
grep
-e
$i
$
if
[
-z
"
$user_id
"
]
;
then
user_id
=
$i
break
;
fi
done
if
[
-z
"
$user_id
"
]
;
then
echo
$0
": Acabou os id's validos"
>
/home/openslx/log
dialog
\
--title
'Erro:'
\
--msgbox
'
As senhas não conferem. Tente novamente.
'
\
--msgbox
'
Estorou o limite de ususario locais nessa maquina, impossivel criar mais
'
\
6 40
pass
=
$(
dialog
--stdout
--passwordbox
'Por favor, digite a senha:'
0 0
)
check_pass
=
$(
dialog
--stdout
--passwordbox
'Por favor, confirme a senha:'
0 0
)
done
user_id
=
$((
10000
+
$((
(
RANDOM%10000
)+
1
))))
check_user_id
=
`
cat
"
$mount_path
"
/Openslx/config |
grep
"SLX_USB_PASSWD"
|
cut
-f
3
-d
':'
|
grep
-w
"
$user_id
"
`
#check if user_id already exists
#while [[ -n $check_user_id ]];
#do
exit
255
fi
fi
fi
#get the last id
#user_id=$((10000+$(((RANDOM%10000)+1))))
#check_user_id=`cat "$mount_path"/Openslx/config | grep "SLX_USB_PASSWD" | cut -f 3 -d ':' | grep -w "$user_id"`
#done
create_config
fim_setup
}
...
...
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