File: repack_release.sh

package info (click to toggle)
sdcc 3.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 34,196 kB
  • sloc: ansic: 260,392; cpp: 38,109; sh: 13,121; asm: 5,978; makefile: 5,891; yacc: 2,980; lisp: 1,524; perl: 929; python: 646; awk: 495; lex: 455
file content (61 lines) | stat: -rwxr-xr-x 1,389 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#
# repack_release.sh
#
# This script repacks sdcc Linux and Mac OS X snapshot build binary and doc packages
# into a sdcc release package.
#
# Repacking Linux package example:
# ./repack_release.sh sdcc-snapshot-i386-unknown-linux2.5-20090314-5413.tar.bz2 sdcc-doc-20090314-5413.tar.bz2 2.9.0
#
# Repacking MacOS X package example:
# ./repack_release.sh sdcc-snapshot-universal-apple-macosx-20090314-5413.tar.bz2 sdcc-doc-20090314-5413.tar.bz2 2.9.0
#


function fatal_error()
{
  echo "repack_release: $1" 1>&2
  exit 1;
}


function usage()
{
  echo "Usage: repack_release.sh <bin_package> <doc_package> <version>" 1>&2
  exit 1;
}


{
  if [ $# != 3 ]
  then
    usage
  fi

  bin_pkg=$1
  doc_pkg=$2
  ver=$3

  arch=$(expr $(basename $bin_pkg) : 'sdcc-snapshot-\([^-]*-[^-]*-[^-]*\)-.*\.tar\.bz2')
  if [ -z "$arch" ]
  then
    fatal_error "$bin_pkg is not a sdcc binary package!"
  fi

  if [ -d sdcc ]
  then
    fatal_error "Directory sdcc already exists!"
  fi

  tar -xjvf $bin_pkg || fatal_error "Can't unpack $bin_pkg!"
  
  rm -rf ./sdcc/share/doc
  rm -rf ./sdcc/share/sdcc/doc
  tar -xjvf $doc_pkg -C ./sdcc/share/sdcc || fatal_error "Can't unpack $doc_pkg!"
  cp ./sdcc/share/sdcc/doc/INSTALL.txt ./sdcc
  cp ./sdcc/share/sdcc/doc/README.txt ./sdcc
  tar -cjvf sdcc-$ver-$arch.tar.bz2 sdcc || fatal_error "Can't pack sdcc-$ver-$arch.tar.bz2!"
  mv sdcc $arch

  exit 0
}