summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-06-02 19:31:47 +0200
committerAaron Griffin <aaronmgriffin@gmail.com>2009-06-12 16:56:05 +0200
commitf1b7557d23c601a86a03cd5eee4feb4072a3b8b2 (patch)
treeae21395ce9b8a9aa9cf339629acc3ed123c97d65
parent548a96ef75cd18f3645909031eda062de4546888 (diff)
downloaddbscripts-f1b7557d23c601a86a03cd5eee4feb4072a3b8b2.tar.gz
dbscripts-f1b7557d23c601a86a03cd5eee4feb4072a3b8b2.tar.xz
compute compression option from file extension
bsdtar does not detect the compression type from the file extension. So we need to set the right option on our own. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
-rwxr-xr-xconvert-to-any8
-rwxr-xr-xcron-jobs/createFileLists9
2 files changed, 15 insertions, 2 deletions
diff --git a/convert-to-any b/convert-to-any
index 862c60b..2ad1521 100755
--- a/convert-to-any
+++ b/convert-to-any
@@ -62,7 +62,13 @@ fi
sed -i "s/arch = \(i686\|x86_64\)/arch = any/g" package/.PKGINFO
pushd package >/dev/null
-fakeroot bsdtar cf "$OUTDIR/$newpkgname" .PKGINFO *
+case "$newpkgname" in
+ *tar.gz) TAR_OPT="z" ;;
+ *tar.bz2) TAR_OPT="j" ;;
+ *tar.xz) TAR_OPT="J" ;;
+ *) die "$newpkgname does not have a valid archive extension." ;;
+esac
+fakeroot bsdtar c${TAR_OPT}f "$OUTDIR/$newpkgname" .PKGINFO *
popd >/dev/null
popd >/dev/null
diff --git a/cron-jobs/createFileLists b/cron-jobs/createFileLists
index 6d03260..10520af 100755
--- a/cron-jobs/createFileLists
+++ b/cron-jobs/createFileLists
@@ -35,6 +35,13 @@ getpkgname() {
echo $tmp
}
+case "${DB_COMPRESSION}" in
+ gz) TAR_OPT="z" ;;
+ bz2) TAR_OPT="j" ;;
+ xz) TAR_OPT="J" ;;
+ *) echo "${DB_COMPRESSION} is not a valid archive compression" && exit 1 ;;
+esac
+
cd $reposdir
for repo in $repos; do
REPO_DB_FILE=${repo}.files.tar.${DB_COMPRESSION}
@@ -75,7 +82,7 @@ for repo in $repos; do
cd ${TMPDIR}/${repodir}
[ -f "${pkgdir}${REPO_DB_FILE}.old" ] && rm "${pkgdir}${REPO_DB_FILE}.old"
[ -f "${pkgdir}${REPO_DB_FILE}" ] && mv "${pkgdir}${REPO_DB_FILE}" "${pkgdir}${REPO_DB_FILE}.old"
- bsdtar --exclude=*.tar.${DB_COMPRESSION} -cf ${pkgdir}${REPO_DB_FILE} *
+ bsdtar --exclude=*.tar.${DB_COMPRESSION} -c${TAR_OPT}f ${pkgdir}${REPO_DB_FILE} *
fi
cd $reposdir