FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 06-23-2011, 12:38 AM
Dave Reisner
 
Default repo-add: enforce file extensions

Allow one of 4 archive extensions: .tar{,.gz,.xz,.bz2} for each of the 2
valid repo extensions: .db and .files

Signed-off-by: Dave Reisner <d@falconindy.com>
---
scripts/repo-add.sh.in | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index ab97952..17639ed 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -573,10 +573,10 @@ if (( success )); then
msg "$(gettext "Creating updated database file '%s'")" "$REPO_DB_FILE"

case "$REPO_DB_FILE" in
- *.tar.gz) TAR_OPT="z" ;;
- *.tar.bz2) TAR_OPT="j" ;;
- *.tar.xz) TAR_OPT="J" ;;
- *.tar) TAR_OPT="" ;;
+ *.@(db|files).tar.gz) TAR_OPT="z" ;;
+ *.@(db|files).tar.bz2) TAR_OPT="j" ;;
+ *.@(db|files).tar.xz) TAR_OPT="J" ;;
+ *.@(db|files).tar) TAR_OPT="" ;;
*) warning "$(gettext "'%s' does not have a valid archive extension.")"
"$REPO_DB_FILE" ;;
esac
--
1.7.5.4
 
Old 06-24-2011, 04:13 AM
Dan McGee
 
Default repo-add: enforce file extensions

On Wed, Jun 22, 2011 at 7:38 PM, Dave Reisner <d@falconindy.com> wrote:
> Allow one of 4 archive extensions: .tar{,.gz,.xz,.bz2} for each of the 2
> valid repo extensions: .db and .files

Good here, but- we should validate up front. What about moving this
bit into a function that takes one argument (the db filename), and
then calling that both when we first read the DB name, and then later
when we need a tar flag? The function would return a tar compression
flag, or "" for no compression, along with some designated invalid
value that the initial call would check for and thus reject the
database name. That way we don't need extension lists and expansion
crazyness in more than one place.

>
> Signed-off-by: Dave Reisner <d@falconindy.com>
> ---
> *scripts/repo-add.sh.in | * *8 ++++----
> *1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
> index ab97952..17639ed 100644
> --- a/scripts/repo-add.sh.in
> +++ b/scripts/repo-add.sh.in
> @@ -573,10 +573,10 @@ if (( success )); then
> * * * *msg "$(gettext "Creating updated database file '%s'")" "$REPO_DB_FILE"
>
> * * * *case "$REPO_DB_FILE" in
> - * * * * * * * *.tar.gz) *TAR_OPT="z" ;;
> - * * * * * * * *.tar.bz2) TAR_OPT="j" ;;
> - * * * * * * * *.tar.xz) *TAR_OPT="J" ;;
> - * * * * * * * *.tar) * * TAR_OPT="" ;;
> + * * * * * * * *.@(db|files).tar.gz) *TAR_OPT="z" ;;
> + * * * * * * * *.@(db|files).tar.bz2) TAR_OPT="j" ;;
> + * * * * * * * *.@(db|files).tar.xz) *TAR_OPT="J" ;;
> + * * * * * * * *.@(db|files).tar) * * TAR_OPT="" ;;
> * * * * * * * **) warning "$(gettext "'%s' does not have a valid archive extension.")"
> * * * * * * * *"$REPO_DB_FILE" ;;
> * * * *esac
> --
> 1.7.5.4
>
>
>
 

Thread Tools




All times are GMT. The time now is 06:05 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org