-
Notifications
You must be signed in to change notification settings - Fork 0
/
ofgwrite_caller
executable file
·75 lines (63 loc) · 3 KB
/
ofgwrite_caller
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh
if [ $# -lt 2 ]; then
echo "[${0##*/}] Usage: $0 <update-dir> <update-package> [options]"
exit 1
fi
echo "Starting ${0##*/} $@"
echo "Creating tempdir"
workdir=$(mktemp -d "$1"/update-XXXXXX)
cd $workdir
echo "Unpacking $2 to $workdir"
if [ "${2##*.}" == "tgz" ]; then
tar zxvf "$2"
elif [ "${2##*.}" == "zip" ]; then
unzip -oj "$2" -x *disk.img*
else
exit 1
fi
if [ "${2:0:5}" == "/tmp/" ]; then
echo "Delete: $2"
rm -f "$2"
fi
echo "Shifting options"
shift 2
if [ -e /boot/STARTUP ]; then
echo "Check for VU+ 4K"
model=`cat /proc/stb/info/model`
[ -e /proc/stb/info/vumodel ] && vumodel=`cat /proc/stb/info/vumodel`
[ "$model" == "dm8000" ] && [ "$vumodel" == "solo4k" ] && model=$vumodel
[ "$model" == "dm8000" ] && [ "$vumodel" == "duo4k" ] && model=$vumodel
[ "$model" == "dm8000" ] && [ "$vumodel" == "duo4kse" ] && model=$vumodel
[ "$model" == "dm8000" ] && [ "$vumodel" == "ultimo4k" ] && model=$vumodel
[ "$model" == "dm8000" ] && [ "$vumodel" == "uno4k" ] && model=$vumodel
[ "$model" == "dm8000" ] && [ "$vumodel" == "uno4kse" ] && model=$vumodel
[ "$model" == "dm8000" ] && [ "$vumodel" == "zero4k" ] && model=$vumodel
case $model in
solo4k|duo4k|duo4kse|ultimo4k|uno4k|uno4kse|zero4k)
echo "VU+ 4K model found."
PART=`echo $@ | grep "\-m" | cut -d "m" -f2 | cut -d " " -f1`
echo "PART=$PART"
if [ "$PART" != "" ]; then
echo "VU+ 4K - multi part - renaming kernel and root to kernel${PART}_auto.bin and rootfs${PART}.tar.bz2."
[ -e $workdir/kernel1_auto.bin -o -e $workdir/kernel2_auto.bin -o -e $workdir/kernel3_auto.bin -o -e $workdir/kernel4_auto.bin ] && [ -e $workdir/kernel_auto.bin ] && rm $workdir/kernel_auto.bin* && find $workdir -name "kernel?_auto.bin" -exec mv -f {} $workdir/kernel${PART}_auto.bin \; || mv -f $workdir/kernel_auto.bin $workdir/kernel${PART}_auto.bin
[ -e $workdir/kernel1_auto.bin -o -e $workdir/kernel2_auto.bin -o -e $workdir/kernel3_auto.bin -o -e $workdir/kernel4_auto.bin ] && find $workdir -name "kernel?_auto.bin" -exec mv -f {} $workdir/kernel${PART}_auto.bin \; || mv -f $workdir/kernel_auto.bin $workdir/kernel${PART}_auto.bin
[ -e $workdir/rootfs1.tar.bz2 -o -e $workdir/rootfs2.tar.bz2 -o -e $workdir/rootfs3.tar.bz2 -o -e $workdir/rootfs4.tar.bz2 ] && [ -e $workdir/rootfs.tar.bz2 ] && rm $workdir/rootfs.tar.bz2* && find $workdir -name "rootfs?.tar.bz2" -exec mv -f {} $workdir/rootfs${PART}.tar.bz2 \; || mv -f $workdir/rootfs.tar.bz2 $workdir/rootfs${PART}.tar.bz2
[ -e $workdir/rootfs1.tar.bz2 -o -e $workdir/rootfs2.tar.bz2 -o -e $workdir/rootfs3.tar.bz2 -o -e $workdir/rootfs4.tar.bz2 ] && find $workdir -name "rootfs?.tar.bz2" -exec mv -f {} $workdir/rootfs${PART}.tar.bz2 \; || mv -f $workdir/rootfs.tar.bz2 $workdir/rootfs${PART}.tar.bz2
else
echo "VU+ 4K - no multi part."
fi
;;
*)
echo "No VU+ 4K model."
;;
esac
fi
echo "Calling ofgwrite $@ $workdir"
ofgwrite $@ $workdir
cd /tmp
#echo "Unmounting /newroot"
#umount /newroot
#echo "Removing /newroot"
#rm -rf /newroot
#echo "Removing tempdir"
#rm -rf $workdir