This repository has been archived by the owner on Jul 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
literom.sh
executable file
·99 lines (82 loc) · 2.14 KB
/
literom.sh
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
# packing tools
# git clone https://github.com/ASdev/android_img_repack_tools.git
# Refs
# make_ext4fs -l 2147483648 -a system out/target/product/redhookbay/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/redhookbay/system
# simg2img system.img system.img.ext4
# img2simg system.img.ext4 system.img
# tar cv system.img.tar system.img
# md5sum -t system.img.tar >> system.img.tar
# mv system.img.tar system.img.tar.md5
TOP=`pwd`
echo $TOP
sourceimg=$TOP/binary/N7100ZCUENB1_N7100CHNENB1_N7100ZCUENB1_HOME.tar.md5
working_dir=$TOP/working
tools_dir=$TOP/tools
app_dir=$TOP/app
gapp_name=$TOP/app/gapp/gapps-jb-20130813-signed.zip
unzip_img()
{
mkdir -p $working_dir
tar xfv $sourceimg -C $working_dir
}
prepare_working_fs()
{
cd $working_dir && $tools_dir/simg2img system.img system.img.ext4 && cd $TOP
sudo mkdir -p /mnt/img/
echo "sudo mount -o loop $working_dir/system.img.ext4 /mnt/img"
sudo mount -o loop $working_dir/system.img.ext4 /mnt/img
}
remove_bloatware()
{
for i in `cat bloatapp.list` ; do sudo rm -fv /mnt/img/app/$i; done
}
add_gapps()
{
cd $app_dir/gapp/ && unzip $gapp_name && rm -f system/addon.d/70-gapps.sh && sudo cp -rf system/* /mnt/img/ && cd $TOP
}
repack()
{
sudo umount /mnt/img
cd $TOP/working
echo " ../tools/img2simg system.img.ext4 system.img"
../tools/img2simg system.img.ext4 system.img
echo "create system.img.tar.md5"
tar cfv system.img.tar system.img
md5sum -t system.img.tar >> system.img.tar
mv system.img.tar system.img.tar.md5
cd $TOP
echo "done"
}
clean_up()
{
rm -f $app_dir/gapp/install-optional.sh
rm -rf $app_dir/gapp/META-INF
rm -rf $app_dir/gapp/optional
rm -rf $app_dir/gapp/system
}
# function same as repack(), but more safe
create_simage_from_fs()
{
cd $TOP/working
sudo ../tools/make_ext4fs -l 2G -s -a system system.img /mnt/img/
cd $TOP
sudo umount /mnt/img
}
create_tar_md5_file()
{
cd $TOP/working
tar -c system.img >> new.tar
md5sum -t new.tar >> new.tar
mv new.tar new.tar.md5
}
unzip_img
prepare_working_fs
remove_bloatware
add_gapps
#repack
create_simage_from_fs
create_tar_md5_file
clean_up
# last step, to use odin to flash it
# ToDO: try with heimdall