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
e4ea32e2
Commit
e4ea32e2
authored
9 years ago
by
Thiago Abdo
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of gitlab.c3sl.ufpr.br:cdn/users-openslx
parents
a0633dd8
97a65848
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
usb_drive/insert_data.sh
+31
-28
31 additions, 28 deletions
usb_drive/insert_data.sh
with
31 additions
and
28 deletions
usb_drive/insert_data.sh
+
31
−
28
View file @
e4ea32e2
...
...
@@ -3,37 +3,40 @@ DIR_USB=/media/usb_drive/
DIR_OPENSLX
=
/Openslx/
user_name
=
`
users
|
cut
-f
1
-d
' '
`
# prepares openslx partition to be used
# mounts partition if not mounted
# blocks program execution if it is not a openslx partition
# param $1 is the devpath to be mounted
# param $2 is the uuid of the partition
# return is done via the mountpath global variable, which is also used here
function
prepare_usb
{
# get the usb_drive's path
devpath
=
`
readlink
-f
$usb_drives
`
# check if the usb_drive is mounted
mount_msg
=
`
mount |
grep
$devpath
`
# if it is mounted, show the path
if
[[
-n
$mount_msg
]]
;
then
echo
$mount_msg
mount_path
=
`
mount |
grep
$devpath
|
cut
-f
3
-d
' '
`
counter
=
4
part_path
=
`
mount |
grep
$devpath
|
cut
-f
4
-d
' '
`
while
[
"
$part_path
"
!=
"type"
]
;
do
mount_path
=
$mount_path
"
\
"
$part_path
counter
=
$((
$counter
+
1
))
part_path
=
`
mount |
grep
$devpath
|
cut
-f
$counter
-d
' '
`
done
echo
$mount_path
echo
$mount_path$DIR_OPENSLX
# If it is not mounted, mount it
# get the usb_drive's path
local
devpath
=
"/dev/"
$1
mountpath
=
""
if
[
!
0
-eq
$(
mount |
grep
-q
$devpath
)
]
;
then
echo
$0
": Device
$devpath
is already mounted"
mountpath
=
$(
mount |
grep
-w
$devpath
|
cut
-d
' '
-f3
)
else
echo
"
$devpath
não está montado"
;
if
[
!
-d
"
$DIR_USB
"
]
;
then
mkdir
/media/usb_drive
echo
"não existe"
echo
$0
": Device
$devpath
is not mounted"
mkdir
-p
/media/openslx/
$2
if
$(
mount
$devpath
/media/openslx/
$2
)
;
then
echo
$0
": Device
$devpath
mounted successfully"
mountpath
=
"/media/openslx/"
$2
else
echo
$0
": Device
$devpath
could not be mounted"
exit
1
fi
fi
if
[
-e
"
$mountpath
/Openslx/config"
]
;
then
echo
$0
":
$devpath
is an openslx ready drive"
else
echo
$0
":
$devpath
is not ready to be used as an openslx drive"
if
[
$mountpath
=
"/media/openslx/
$2
"
]
;
then
echo
$0
": umounting
$devpath
"
umount
$devpath
fi
exit
2
fi
echo
"Montando dispositivo..."
mount
-o
uid
=
"
$user_name
"
$devpath
/media/usb_drive
mount_path
=
/media/usb_drive
fi
}
sleep
3
...
...
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