~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to debian/preservebeam

  • Committer: Bazaar Package Importer
  • Author(s): Erlang Packagers, Sergei Golovan
  • Date: 2006-12-03 17:07:44 UTC
  • mfrom: (2.1.11 feisty)
  • Revision ID: james.westby@ubuntu.com-20061203170744-rghjwupacqlzs6kv
Tags: 1:11.b.2-4
[ Sergei Golovan ]
Fixed erlang-base and erlang-base-hipe prerm scripts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh
2
 
#
3
 
# Save beam files in a directory if this script is called without argument.
4
 
# If -r (restore) is given, then all the beam files are removed and old
5
 
# beam files are restored.
6
 
#
7
 
 
8
 
PRESERVED=../preserved.tar.gz
9
 
 
10
 
preserve () {
11
 
    if [ ! -f $PRESERVED ]; then
12
 
        echo "Preserving beam files in $PRESERVED"
13
 
        find . -type f -name \*.beam -print | xargs tar zcf $PRESERVED
14
 
    else
15
 
        echo "Beam files already preserved in $PRESERVED"
16
 
    fi
17
 
}
18
 
 
19
 
restore () {
20
 
    if [ ! -f $PRESERVED ]; then
21
 
        echo "Warning: unable to restore beam files from $PRESERVED"
22
 
    else
23
 
        echo "Removing potentially bogus beam files"
24
 
        find . -type f -name \*.beam -exec rm {} \;
25
 
        echo "Restoring original beam files"
26
 
        tar zxf $PRESERVED
27
 
        rm $PRESERVED
28
 
    fi
29
 
}
30
 
 
31
 
if [ "x$1" = x-r ]; then
32
 
    restore
33
 
else
34
 
    preserve
35
 
fi