Updates docs for SR1 with final revision
[genesis.git] / fuel / build / patch-packages / tools / deb_unpack
1 #!/bin/bash -e
2 ##############################################################################
3 # Copyright (c) 2015 Ericsson AB and others.
4 # stefan.k.berg@ericsson.com
5 # jonas.bjurel@ericsson.com
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11
12
13 my_exit() {
14
15     if [ -d "$ISOROOT" ]; then
16         fusermount -u $ISOROOT
17     fi
18 }
19
20 ME=$(basename $0)
21
22 trap my_exit EXIT
23
24
25 if [ -z "$1" ]; then
26   echo "$ME: Error - No package specified"
27   exit 1
28 fi
29
30 if [ -z "$2" ]; then
31   echo "$ME: Error - No ISO path specified"
32   exit 1
33 fi
34
35 DEB=$1
36 ORIGISO=$2
37 DEST=package
38
39 if [ -e $DEST -o -d $DEST ]; then
40   echo "$ME: Error - $DEST already exists"
41   exit 1
42 fi
43
44 ISOROOT=`mktemp -d /tmp/XXXXXXX`
45 fuseiso -p $ORIGISO $ISOROOT
46 sleep 1
47
48 if [ ! -f $ISOROOT/ubuntu/pool/main/$DEB ];then
49   echo "Could not find package $DEB in source ISO!"
50 fi
51
52 mkdir -p $DEST
53 dpkg -x $ISOROOT/ubuntu/pool/main/$DEB $DEST
54
55 mkdir -p $DEST/DEBIAN
56 dpkg -e $ISOROOT/ubuntu/pool/main/$DEB $DEST/DEBIAN
57
58 echo $DEB > .package