source: ipk/source.arm/tools_multiimage/_path_/usr/local/share/titan/plugins/multiimage/multi_unpack.sh @ 40635

Last change on this file since 40635 was 40635, checked in by gost, 4 years ago

[plugins] arm multiimage add xz images

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#!/bin/sh
2
3rm /tmp/multiende > /dev/null 2>&1
4
5IMAGE=$1
6NAME=$2
7ZIEL=$3
8EXTRACT=$4
9
10echo $IMAGE
11echo $NAME
12echo $ZIEL
13echo $EXTRACT
14
15SWAP="$ZIEL/swap"
16TEMP="$ZIEL/tmp"
17
18echo "[multi_unpack] create swap"
19rm "$SWAP" > /dev/null 2>&1
20dd if=/dev/zero of="$SWAP" bs=1024k count=128
21chmod 600 "$SWAP"
22mkswap "$SWAP"
23swapon "$SWAP"
24
25EXT="zip"
26if [ `ls $IMAGE | grep .xz | wc -l` -gt 0 ]; then
27                EXT="xz"
28fi
29
30if [ $EXT == "xz" ]; then
31        echo "[multi_unpack] move Image ... takes a moment"
32        rm -r /tmp/dm900 > /dev/null 2>&1
33        mkdir /tmp/dm900 > /dev/null 2>&1
34        mv $IMAGE /tmp/dm900 > /dev/null 2>&1
35else
36        echo "[multi_unpack] unzip Image ... takes a moment"
37
38        rm -r "$TEMP" > /dev/null 2>&1
39        mkdir "$TEMP" > /dev/null 2>&1
40
41        mv $IMAGE $TEMP
42
43        rm -r /tmp/atemio > /dev/null 2>&1
44        rm -r /tmp/xpeedlx > /dev/null 2>&1
45        rm -r /tmp/xpeedlx3 > /dev/null 2>&1
46        rm -r /tmp/dm900 > /dev/null 2>&1
47
48        unzip $TEMP/*.zip -d /tmp
49        rm $TEMP/*.zip  > /dev/null 2>&1
50fi
51
52echo "[multi_unpack] extract Image ... takes a few minutes"
53
54if [ -d /tmp/xpeedlx ]; then
55        cd /tmp/xpeedlx
56elif [ -d /tmp/xpeedlx3 ]; then
57        cd /tmp/xpeedlx3
58elif [ -d /tmp/dm900 ]; then
59        cd /tmp/dm900
60else
61        cd /tmp/atemio/*/
62fi
63
64rm -r "$TEMP" > /dev/null 2>&1
65mkdir "$TEMP" > /dev/null 2>&1
66
67#ubireader_extract_files ./rootfs.bin -k -o $TEMP
68if [ -d /tmp/dm900 ]; then
69        mkdir $ZIEL/titan_multi/$NAME
70        if [ $EXT == "xz" ]; then
71                tar xJf ./*.xz -C $ZIEL/titan_multi/$NAME
72                rm ./*.xz
73        else
74                tar xjf ./rootfs.tar.bz2 -C $ZIEL/titan_multi/$NAME
75                rm ./rootfs.tar.bz2
76        fi
77else
78        $EXTRACT ./rootfs.bin -k -o $TEMP
79fi
80
81if [ ! -d /tmp/dm900 ]; then
82        echo "[multi_unpack] create titan_multi entry"
83
84        dir=`ls $TEMP`
85
86        cd $TEMP/$dir
87        mv rootfs ../../titan_multi/$NAME
88fi
89
90if [ ! -d /ba ]; then
91        mkdir /ba
92fi
93if [ ! -d /var/test ]; then
94        mkdir /var/test
95fi
96
97cd /
98rm -r $TEMP  > /dev/null 2>&1
99rm -r /tmp/atemio > /dev/null 2>&1
100rm -r /tmp/xpeedlx > /dev/null 2>&1
101rm -r /tmp/xpeedlx3 > /dev/null 2>&1
102
103sync
104swapoff $SWAP
105
106touch /tmp/multiende
107
108echo
109echo "[multi_unpack] Image $NAME created"
110echo
Note: See TracBrowser for help on using the repository browser.