Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
apparmor-tumbler
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tests
apparmor-tumbler
Commits
c2684ccc
Commit
c2684ccc
authored
6 years ago
by
Frédéric Dalleau
Browse files
Options
Downloads
Plain Diff
Merge branch 'wip/andrunko/T5563' into 'master'
Fix script to remove some bashisms See merge request
!1
parents
70cc8140
338fe0bc
Branches
19.03
Branches containing commit
No related tags found
1 merge request
!1
Fix script to remove some bashisms
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test-tumbler
+19
-18
19 additions, 18 deletions
test-tumbler
with
19 additions
and
18 deletions
test-tumbler
+
19
−
18
View file @
c2684ccc
#!/bin/
ba
sh
#!/bin/sh
# vim: set sts=4 sw=4 et tw=0 :
set
-e
...
...
@@ -43,23 +43,23 @@ _kill_monitor_return() {
return
$1
}
bash_arrays
_to_gvariant_as
()
{
stringlist
_to_gvariant_as
()
{
local
i
converted
=
"['
$1
'"
shift
for
i
in
"
$@
"
;
do
converted
+
=
", '
$i
'"
for
i
in
$@
;
do
converted
=
"
$converted
, '
$i
'"
done
converted
+
=
"]"
converted
=
"
$converted
]"
echo
"
${
converted
}
"
}
_check_uris_have_thumbnail
()
{
local
size
=
$1
local
uris
=
$2
for
i
in
"
${
uris
[@]
}
"
;
do
shift
for
i
in
$@
;
do
local
thumb
=
"
${
HOME
}
/.cache/thumbnails/
${
size
}
/
$(
echo
-n
"
${
i
}
"
|
md5sum
|
cut
-f1
-d
\
)
.png"
say
$thumb
if
[
[
!
-f
"
${
thumb
}
"
]
]
;
then
if
[
!
-f
"
${
thumb
}
"
]
;
then
whine
"Couldn't find thumbnail
$thumb
, file
$i
didn't get thumbnailed!?"
ret
=
1
fi
...
...
@@ -74,20 +74,22 @@ _generate_thumbnails() {
local
size
=
"
$1
"
local
special_dir
=
"
$2
"
shift
2
files
=
(
"
$@
"
)
files
=
$@
logfile
=
"
${
WORKDIR
}
/monitor-tumblerd.log"
addr
=
"org.freedesktop.thumbnails.Thumbnailer1"
obj_path
=
"/org/freedesktop/thumbnails/Thumbnailer1"
method
=
"org.freedesktop.thumbnails.Thumbnailer1.Queue"
uris
=
()
filetypes
=
()
uris
=
""
filetypes
=
""
for
i
in
"
${
files
[@]
}
"
;
do
# FIXME: This doesn't do whitespace/special character escaping, etc
for
i
in
${
files
}
;
do
# Tumbler's AppArmor profile doesn't necessarily let it read the
# apertis-tests directory if we're running uninstalled. Copy the
# file to a more realistic location, which exercises the AppArmor
# profile better anyway.
if
[
$((
$RANDOM
%
2
))
=
0
]
&&
[
-e
"/home/shared/
$special_dir
"
]
;
then
_rand
=
$(
od
-A
n
-N
2
-t
u2 /dev/urandom
)
if
[
$((
$_rand
%
2
))
=
0
]
&&
[
-e
"/home/shared/
$special_dir
"
]
;
then
copy
=
"/home/shared/
$special_dir
/apertis-tests__
$(
basename
"
$i
"
)
"
else
copy
=
"
$HOME
/
$special_dir
/apertis-tests__
$(
basename
"
$i
"
)
"
...
...
@@ -96,9 +98,8 @@ _generate_thumbnails() {
cp
-v
"
$i
"
"
$copy
"
# Need path relative to /
# FIXME: This doesn't do whitespace/special character escaping, etc
uris+
=(
"file://
$copy
"
)
filetypes+
=(
$(
file
--mime-type
"
$copy
"
|
cut
-d
":"
-f
2 |
tr
-d
' '
)
)
uris
=
"
${
uris
}
file://
$copy
"
filetypes
=
"
${
filetypes
}
$(
file
--mime-type
"
$copy
"
|
cut
-d
":"
-f
2 |
tr
-d
' '
)
"
done
# Clear out old thumbnails.
...
...
@@ -109,8 +110,8 @@ _generate_thumbnails() {
# Files to thumbnail
${
GDBUS
}
call
--session
--dest
"
${
addr
}
"
--object-path
"
${
obj_path
}
"
\
--method
"
${
method
}
"
\
"
$(
bash_arrays
_to_gvariant_as
"
${
uris
[@]
}
"
)
"
\
"
$(
bash_arrays
_to_gvariant_as
"
${
filetypes
[@]
}
"
)
"
\
"
$(
stringlist
_to_gvariant_as
${
uris
}
)
"
\
"
$(
stringlist
_to_gvariant_as
${
filetypes
}
)
"
\
"
${
size
}
"
foreground 0
# Wait for thumbnailing to finish
...
...
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