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
4302cf35
Commit
4302cf35
authored
9 years ago
by
Thiago Abdo
Browse files
Options
Downloads
Patches
Plain Diff
Add create config hd
Signed-off-by:
Thiago Abdo
<
tja14@inf.ufpr.br
>
parent
480cc660
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
+36
-9
36 additions, 9 deletions
usb_drive/setup_usb.sh
with
36 additions
and
9 deletions
usb_drive/setup_usb.sh
+
36
−
9
View file @
4302cf35
...
@@ -120,7 +120,16 @@ function get_user {
...
@@ -120,7 +120,16 @@ function get_user {
}
}
function
create_config
{
function
success_message
{
#show the confirmation message
dialog
\
--title
'Cadastro:'
\
--msgbox
'Cadastro realizado com sucesso.'
\
6 40
}
function
calculate_days_and_pass
{
#get days since Linux Epoch (January 1, 1970)
#get days since Linux Epoch (January 1, 1970)
seconds
=
`
date
+%s
`
seconds
=
`
date
+%s
`
minutes
=
$((
$seconds
/
60
))
minutes
=
$((
$seconds
/
60
))
...
@@ -129,6 +138,11 @@ function create_config {
...
@@ -129,6 +138,11 @@ function create_config {
#encrypt password
#encrypt password
encry_pass
=
`
echo
"
$pass
"
| openssl passwd
-1
-stdin
`
encry_pass
=
`
echo
"
$pass
"
| openssl passwd
-1
-stdin
`
echo
$encry_pass
echo
$encry_pass
}
function
create_config
{
#get days since Linux Epoch (January 1, 1970)
calculate_days_and_pass
#insert data in the log file
#insert data in the log file
echo
"
$user_id
$new_user
active
$date
"
>>
"
$mount_path
"
/Openslx/log
echo
"
$user_id
$new_user
active
$date
"
>>
"
$mount_path
"
/Openslx/log
...
@@ -139,12 +153,23 @@ function create_config {
...
@@ -139,12 +153,23 @@ function create_config {
echo
"SLX_USB_SHADOW=
$new_user
:
$encry_pass
:
$days
:0:99999:7:::"
>>
"
$mount_path
"
/Openslx/config
echo
"SLX_USB_SHADOW=
$new_user
:
$encry_pass
:
$days
:0:99999:7:::"
>>
"
$mount_path
"
/Openslx/config
echo
"SLX_USB_GROUP=
$new_user
:x:
$user_id
;"
>>
"
$mount_path
"
/Openslx/config
echo
"SLX_USB_GROUP=
$new_user
:x:
$user_id
;"
>>
"
$mount_path
"
/Openslx/config
success_message
}
function
create_config_hd
{
#show the confirmation message
calculate_days_and_pass
dialog
\
--title
'Cadastro:'
\
#insert data in the log file
--msgbox
'Cadastro realizado com sucesso.'
\
echo
"
$user_id
$new_user
active
$date
"
>>
"
$mount_path
"
/openslx/log
6 40
#insert data in the config file
echo
"SLX_PASSWD=
$new_user
:x:
$user_id
:
$user_id
::/home/
$new_user
:/bin/bash"
>>
"
$mount_path
"
/openslx/config
echo
"SLX_SHADOW=
$new_user
:
$encry_pass
:
$days
:0:99999:7:::"
>>
"
$mount_path
"
/openslx/config
echo
"SLX__GROUP=
$new_user
:x:
$user_id
;"
>>
"
$mount_path
"
/openslx/config
success_message
}
}
function
show_menu
{
function
show_menu
{
...
@@ -196,6 +221,7 @@ function usb_drive {
...
@@ -196,6 +221,7 @@ function usb_drive {
function
hd_drive
{
function
hd_drive
{
# crete the dir /home/openslx and config files
# crete the dir /home/openslx and config files
if
[
!
-d
"/home/openslx"
]
;
then
if
[
!
-d
"/home/openslx"
]
;
then
mkdir
-p
/home/openslx/
mkdir
-p
/home/openslx/
fi
fi
...
@@ -215,7 +241,7 @@ function hd_drive {
...
@@ -215,7 +241,7 @@ function hd_drive {
else
else
user_id
=
$((
$user_id
+
1
))
user_id
=
$((
$user_id
+
1
))
if
[
user_id
-ge
30000
]
;
then
if
[
user_id
-ge
30000
]
;
then
echo
$0
": Provavelmente acabou os id's valido, procurando sequencialmente"
>
/home/openslx/log
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}
#Da para tentar fazer algum código usando diff e {20000..29999}
#Ai nao precisa desse loop
#Ai nao precisa desse loop
for
i
in
$(
echo
{
20000..29999
}
)
;
do
for
i
in
$(
echo
{
20000..29999
}
)
;
do
...
@@ -226,7 +252,7 @@ function hd_drive {
...
@@ -226,7 +252,7 @@ function hd_drive {
fi
fi
done
done
if
[
-z
"
$user_id
"
]
;
then
if
[
-z
"
$user_id
"
]
;
then
echo
$0
": Acabou os id's validos"
>
/home/openslx/log
echo
$0
": Acabou os id's validos"
>
>
/home/openslx/log
dialog
\
dialog
\
--title
'Erro:'
\
--title
'Erro:'
\
--msgbox
'Estorou o limite de ususario locais nessa maquina, impossivel criar mais'
\
--msgbox
'Estorou o limite de ususario locais nessa maquina, impossivel criar mais'
\
...
@@ -236,7 +262,8 @@ function hd_drive {
...
@@ -236,7 +262,8 @@ function hd_drive {
fi
fi
fi
fi
create_config
mount_path
=
"/home"
create_config_hd
}
}
...
...
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