~ubuntu-branches/ubuntu/maverick/lire/maverick

« back to all changes in this revision

Viewing changes to all/script/lr_inflate

  • Committer: Bazaar Package Importer
  • Author(s): Joost van Baal
  • Date: 2002-04-11 23:36:21 UTC
  • Revision ID: james.westby@ubuntu.com-20020411233621-rj3dbr7z5wulfd7z
Tags: upstream-20020214
ImportĀ upstreamĀ versionĀ 20020214

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh -e
 
2
 
 
3
#
 
4
# $Id: lr_inflate,v 1.24 2001/10/18 19:13:17 flacoste Exp $
 
5
 
 
6
#
 
7
# Copyright (C) 2000-2001 Stichting LogReport Foundation LogReport@LogReport.org
 
8
 
9
#     This program is free software; you can redistribute it and/or modify
 
10
#     it under the terms of the GNU General Public License as published by
 
11
#     the Free Software Foundation; either version 2 of the License, or
 
12
#     (at your option) any later version.
 
13
 
14
#     This program is distributed in the hope that it will be useful,
 
15
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
#     GNU General Public License for more details.
 
18
 
19
#     You should have received a copy of the GNU General Public License
 
20
#     along with this program (see COPYING); if not, check with
 
21
#     http://www.gnu.org/copyleft/gpl.html or write to the Free Software 
 
22
#     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 
23
#
 
24
 
 
25
#
 
26
 
 
27
PROGRAM=lr_inflate
 
28
 
 
29
id="${LR_ID:-UNSET}"
 
30
 
 
31
tag="all all $id $PROGRAM"
 
32
 
 
33
if test $# -ne 1
 
34
then
 
35
    echo >&2 "$tag err give filename as arg"
 
36
    exit 1
 
37
fi
 
38
 
 
39
echo >&2 "$tag info started with '$@'"
 
40
 
 
41
file=$1
 
42
 
 
43
if [ ! -f "$file" ]; then
 
44
    echo >&2 "$tag err aborted, no file '$file' found"
 
45
    exit 1
 
46
fi
 
47
 
 
48
if test ! -d "$TMPDIR"
 
49
then
 
50
    if test -f "$TMPDIR"
 
51
    then
 
52
        echo >&2 "$tag err $TMPDIR is a file, it should be a dir, aborting"
 
53
        exit 1
 
54
    else
 
55
        mkdir $TMPDIR
 
56
    fi
 
57
fi
 
58
 
 
59
tmpfile=$TMPDIR/${PROGRAM}.$$.`date +%Y%m%d.%H%M%S`.${id}.log
 
60
ext=${file##*.}
 
61
 
 
62
if [ "$ext" = "gz" -o "$ext" = "Z" -o "$ext" = "ZIP" ]; then
 
63
    echo >&2 "$tag info inflating $file to $tmpfile"
 
64
    zcat $file > $tmpfile
 
65
    rm $file
 
66
else
 
67
    echo >&2 "$tag info moving $file to $tmpfile"
 
68
    mv $file $tmpfile
 
69
fi
 
70
 
 
71
echo $tmpfile
 
72
 
 
73
echo >&2 "$tag info stopped"
 
74
 
 
75