-
Notifications
You must be signed in to change notification settings - Fork 2
/
package.sh
68 lines (57 loc) · 1.76 KB
/
package.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
#!/bin/bash
# Script to package system.img to flashable zip
LOCAL_WORKDIR=/home/runner/work/
source halium.env
function checkoutHaliuminstall(){
cd $LOCAL_WORKDIR
git clone https://github.com/JBBgameich/halium-install.git
# comment adb
# sed -i 's/adb/#adb/' halium-install/functions/core.sh
# comment clean
# sed -i 's/trap clean_exit/echo donothing/' halium-install/halium-install
chmod +x halium-install/halium-install
}
function downloadRootfsTar(){
cd $LOCAL_WORKDIR
wget -q -t 10 $ROOTFS_NEW -O rootfs.tar.gz
#wget -q -t 10 $ROOTFS_ARMHF -O rootfs.tar.gz
}
function convertImgtoRootfsImg(){
cd $LOCAL_WORKDIR
halium_install=$1
rootfs_tar=$2
systemimg=$3
$halium_install -p ut -u $PHABLET_PASS -r $ROOT_PASS -tm $rootfs_tar $systemimg
ls .halium-install-imgs.*
if [ "$?" -ne "0" ]; then
echo "failed"
exit 1
fi
}
function makeFlashableZip(){
cd $LOCAL_WORKDIR
zipfolder="$(cat ~/.current_version)"
mkdir -p $zipfolder
mv .halium-install-imgs.*/*.img $zipfolder/
cp -R $LOCAL_WORKDIR/ubports-ci/ubports-ci/META-INF $zipfolder/
chmod +x $zipfolder/META-INF/com/google/android/updat*
cp $ANDROID_ROOT/out/target/product/$DEVICE/halium-boot.img $zipfolder/
cd $zipfolder
gzip rootfs.img
gzip system.img
zip -r $LOCAL_WORKDIR/$zipfolder.zip halium-boot.img rootfs.img.gz system.img.gz META-INF
}
function cleanSpace(){
cd $LOCAL_WORKDIR
rm -rf kernel device vendor .repo prebuilts
}
function main(){
cd $LOCAL_WORKDIR
checkoutHaliuminstall
downloadRootfsTar
convertImgtoRootfsImg halium-install/halium-install rootfs.tar.gz \
$ANDROID_ROOT/out/target/product/$DEVICE/system.img
makeFlashableZip
echo "All is done ;)"
}
main