Skip to content

Commit

Permalink
content2filelist: new utility to extract files from a CONTENT file
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Dreyer committed May 22, 2012
1 parent bac4f6a commit f49a331
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ PROGRAMS_PERL=beefind.pl
HELPER_BEE_SHELL=bee-init bee-check bee-remove bee-install bee-list bee-query bee-download bee-update
HELPER_BEE_C=bee-dep

HELPER_SHELL=compat-filesfile2contentfile filelist2content
HELPER_SHELL=compat-filesfile2contentfile filelist2content content2filelist

LIBRARY_SHELL=beelib.config.sh

Expand Down
44 changes: 44 additions & 0 deletions src/content2filelist.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
#
# content2filelist - extract files from content file
#
# Copyright (C) 2009-2012
# Tobias Dreyer <dreyer@molgen.mpg.de>
# Marius Tolzmann <tolzmann@molgen.mpg.de>
# and other bee developers
#
# This file is part of bee.
#
# bee is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

: ${BEESEP=@BINDIR@/beesep}

while read line ; do
unset type
data=$(${BEESEP} ${line})

if [ "$?" -gt 0 ] ; then
echo >&2 "**ERROR** INVALID CONTENT: ${line}"
exit 1
fi

eval ${data}

if [ "$?" -gt 0 -o -z "${type}" ] ; then
echo >&2 "**ERROR** UNPARSABLE CONTENT: ${line}"
exit 1
fi

echo ${file%//*}
done < <(cat ${@})

0 comments on commit f49a331

Please sign in to comment.