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

Last change on this file since 39617 was 39617, checked in by gost, 5 years ago

[plugins] arm add MultiImage step1

  • Property svn:executable set to *
File size: 1.6 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
25echo "[multi_unpack] unzip Image ... takes a moment"
26
27rm -r "$TEMP" > /dev/null 2>&1
28mkdir "$TEMP" > /dev/null 2>&1
29
30mv $IMAGE $TEMP
31
32rm -r /tmp/atemio > /dev/null 2>&1
33rm -r /tmp/xpeedlx > /dev/null 2>&1
34rm -r /tmp/xpeedlx3 > /dev/null 2>&1
35rm -r /tmp/dm900 > /dev/null 2>&1
36
37unzip $TEMP/*.zip -d /tmp
38rm $TEMP/*.zip  > /dev/null 2>&1
39
40echo "[multi_unpack] extract Image ... takes a few minutes"
41
42if [ -d /tmp/xpeedlx ]; then
43        cd /tmp/xpeedlx
44elif [ -d /tmp/xpeedlx3 ]; then
45        cd /tmp/xpeedlx3
46elif [ -d /tmp/dm900 ]; then
47        cd /tmp/dm900
48else
49        cd /tmp/atemio/*/
50fi
51
52rm -r "$TEMP" > /dev/null 2>&1
53mkdir "$TEMP" > /dev/null 2>&1
54
55#ubireader_extract_files ./rootfs.bin -k -o $TEMP
56if [ -d /tmp/dm900 ]; then
57        mkdir $ZIEL/titan_multi/$NAME
58        tar xjf ./rootfs.tar.bz2 -C $ZIEL/titan_multi/$NAME
59        rm ./rootfs.tar.bz2
60else
61        $EXTRACT ./rootfs.bin -k -o $TEMP
62fi
63
64if [ ! -d /tmp/dm900 ]; then
65        echo "[multi_unpack] create titan_multi entry"
66
67        dir=`ls $TEMP`
68
69        cd $TEMP/$dir
70        mv rootfs ../../titan_multi/$NAME
71fi
72
73if [ ! -d /ba ]; then
74        mkdir /ba
75fi
76if [ ! -d /var/test ]; then
77        mkdir /var/test
78fi
79
80cd /
81rm -r $TEMP  > /dev/null 2>&1
82rm -r /tmp/atemio > /dev/null 2>&1
83rm -r /tmp/xpeedlx > /dev/null 2>&1
84rm -r /tmp/xpeedlx3 > /dev/null 2>&1
85
86sync
87swapoff $SWAP
88
89touch /tmp/multiende
90
91echo
92echo "[multi_unpack] Image $NAME created"
93echo
Note: See TracBrowser for help on using the repository browser.