Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-build-utils
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
korinf
etersoft-build-utils
Commits
456d4453
Commit
456d4453
authored
Apr 09, 2012
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tarball: add rar support
parent
8ebc24c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
tarball
share/eterbuild/functions/tarball
+23
-2
No files found.
share/eterbuild/functions/tarball
View file @
456d4453
...
@@ -35,9 +35,25 @@ conv_zip_to_tar()
...
@@ -35,9 +35,25 @@ conv_zip_to_tar()
rm
-rf
$1
.tmpdir
rm
-rf
$1
.tmpdir
}
}
# TODO: use external converter?
# $1 - rar name $2 - tar name
conv_rar_to_tar
()
{
local
RZ
=
$(
realpath
"
$1
"
)
local
RT
=
$(
realpath
"
$2
"
)
# FIXME: use normal mktempdir
mkdir
$1
.tmpdir
||
fatal
cd
$1
.tmpdir
||
fatal
# unzip or remove broken file
unrar x
"
$RZ
"
&&
tar
cf
"
$RT
"
./
*
||
{
rm
-fv
"
$RT
"
;
return
1
;
}
cd
..
rm
-rf
$1
.tmpdir
}
get_archive_type
()
get_archive_type
()
{
{
file
"
$1
"
|
grep
-q
"Zip archive data"
&&
echo
"zip"
&&
return
file
"
$1
"
|
grep
-q
"Zip archive data"
&&
echo
"zip"
&&
return
file
"
$1
"
|
grep
-q
"RAR archive data"
&&
echo
"rar"
&&
return
return
1
return
1
}
}
...
@@ -98,11 +114,16 @@ copy_tarball_to_tar()
...
@@ -98,11 +114,16 @@ copy_tarball_to_tar()
return
return
fi
fi
# TODO: use conv_
zip_to_$type
(type may be undetected)
# TODO: use conv_
$type_to_tar
(type may be undetected)
if
[
$(
get_archive_type
$SNAME
)
=
"zip"
]
;
then
if
[
"
$(
get_archive_type
$SNAME
)
"
=
"zip"
]
;
then
conv_zip_to_tar
$SNAME
$TNAME
&&
return
conv_zip_to_tar
$SNAME
$TNAME
&&
return
fi
fi
# TODO: use conv_$type_to_tar (type may be undetected)
if
[
"
$(
get_archive_type
$SNAME
)
"
=
"rar"
]
;
then
conv_rar_to_tar
$SNAME
$TNAME
&&
return
fi
fatal
"Can't repack
$SNAME
to tar"
fatal
"Can't repack
$SNAME
to tar"
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment