forked from DanB0908/RTAndroidNOOBS
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrtsplit
executable file
·151 lines (117 loc) · 3.07 KB
/
rtsplit
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/sh
# RTSPLIT - a script to convert a raw RTANDROID zip file for PINN
# Usage - sudo rtsplit
base=`pwd`
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 2>&1
exit 1
fi
# set the following variables:
# raw = folder of original raw image source (folder above /raw and /resources FAT32)
# dest = destination folder of converted image FAT32
# script = the folder this script is run from (on an EXT4 drive)
##################### STEP 1 #####################
decompress()
{
#Step 1
rm -rf $output
mkdir -p $output
cd $raw
echo "decompress the tarball"
unzip $srcfile.zip
}
##################### STEP 2 #####################
mountimage()
{
#Step 2
cd $raw
}
##################### STEP 3 #####################
archiveimage()
{
#Step 3
cd $raw
mkdir -p $output
echo "Tarring the boot partition"
cd boot #on det
tar cvf $output/boot.tar *
cd ..
cp system.img $output
}
##################### STEP 4 #####################
cleanup1()
{
#Step 4
echo "clean up"
cd $raw
}
##################### STEP 5 #####################
Updateoutput()
{
#Step 5
echo "Update the new dist folder"
cp $resources/${osname}_os.json $output/os.json
cp $resources/partition_setup.sh $output
cp $resources/partitions.json $output
cp $resources/${srcfolder}.png $output/${osname}.png
(cd $resources; tar xvf marketing.tar slides_vga)
cp $resources/marketing.tar $output
cp -r $resources/slides_vga $output
cp $resources/release_notes.txt $output
cp $resources/${osname}_flavours.json ${output}/flavours.json
cd $raw
echo "Update the JSON files"
}
##################### STEP 6 #####################
compress()
{
#Step 6
echo "Compressing boot tar file"
(cd $output; xz -k boot.tar)
echo "Compressing system img file"
(cd $output; gzip system.img)
}
##################### STEP 7 #####################
cleanup2()
{
#Step 7
echo "Clean up #2"
rm $raw/boot.tar >/dev/null
rm $raw/system.img >/dev/null
rm $raw/*.sh >/dev/null
rm -rf $raw/boot >/dev/null
}
#################### PROCESS #####################
process()
{
#$1 srcfolder
srcfolder=$1
#$2 New OS name folder
osname=$2
#$3 Compressed filename
srcfile=$3
echo "Processing " ${osname}
cd $base/$srcfolder
rootdir=`pwd`
raw=$rootdir/raw
resources=$rootdir/resources
output=$rootdir/output/${osname}
#-------------------- STEP 1 --------------------#
decompress
#-------------------- STEP 2 --------------------#
mountimage
#-------------------- STEP 3 --------------------#
archiveimage
#-------------------- STEP 4 --------------------#
cleanup1
#-------------------- STEP 5 --------------------#
Updateoutput
#-------------------- STEP 6 --------------------#
compress
#-------------------- STEP 7 --------------------#
cleanup2
}
###################### MAIN ######################
#rtandroid
process rtandroid rtandroid rtandroid-aosp-7.1-20170315-rpi3
echo "DONE"