forked from flamegapps/flamegapps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.sh
116 lines (103 loc) · 3.13 KB
/
scripts.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#
###########################################
#
# Copyright (C) 2021 FlameGApps Project
#
# This file is part of the FlameGApps Project created by ayandebnath
#
# The FlameGApps scripts are free software, you can redistribute and/or modify them.
#
# These scripts are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY.
#
###########################################
#
make_flame_prop() {
echo ">>> Creating flame.prop"
echo -e '\n# FlameGApps prop file
ro.flame.android='$ANDROID'
ro.flame.sdk='$SDK'
ro.flame.arch='$ARCH'
ro.flame.edition='$EDITION'
ro.flame.build_date='$DATE'
ro.flame.required_size='$REQUIRED_SIZE'
' > $ZIP_DIR/flame.prop
}
make_update_binary() {
echo ">>> Creating update-binary"
echo '#!/sbin/sh
#
############################################
#
# This file is a part of the FlameGApps Project by ayandebnath @xda-developers
#
# Taken from OpenGApps.org update-binary
# For reference, check https://github.com/opengapps/opengapps/blob/master/scripts/inc.installer.sh
#
############################################
# File Name : update-binary
# Last Updated : '$DATE'
############################################
#
export ZIPFILE="$3"
export OUTFD="/proc/self/fd/$2"
export TMP="/tmp"
bb="$TMP/busybox-arm"
l="$TMP/bin"
setenforce 0
ui_print() {
echo "ui_print $1
ui_print" >> $OUTFD
}
ui_print " "
ui_print " _____ _ "
ui_print " | ___| | __ _ _ __ ___ ___ "
ui_print " | |_ | |/ _ | _ _ \ / _ \ "
ui_print " | _| | | (_| | | | | | | __/ "
ui_print " |_|___|_|\__,_|_| |_| |_|\___| "
ui_print " / ___| / \ _ __ _ __ ___ "
ui_print " | | _ / _ \ | _ \| _ \/ __| "
ui_print " | |_| |/ ___ \| |_) | |_) \__ \ "
ui_print " \____/_/ \_\ .__/| .__/|___/ "
ui_print " |_| |_| "
ui_print " "
ui_print "*************************************************"
ui_print " Android Version : '$ANDROID'"
ui_print " Edition type : '$EDITION'"
ui_print " Build Date : '$DATE'"
ui_print "*************************************************"
ui_print " "
ui_print "- Preparing Installer"
for f in busybox-arm installer.sh flame.prop backup_script.sh; do
unzip -o "$ZIPFILE" "$f" -d "$TMP"
done
chmod +x "$TMP/busybox-arm"
if [ -e "$bb" ]; then
install -d "$l"
for i in $($bb --list); do
if ! ln -sf "$bb" "$l/$i" && ! $bb ln -sf "$bb" "$l/$i" && ! $bb ln -f "$bb" "$l/$i" ; then
# create script wrapper if symlinking and hardlinking failed because of restrictive selinux policy
if ! echo "#!$bb" > "$l/$i" || ! chmod +x "$l/$i" ; then
ui_print "ERROR 10: Failed to set-up pre-bundled busybox"
exit 1
fi
fi
done
else
exit 1
fi
PATH="$l:$PATH" $bb sh "$TMP/installer.sh" "$@"
exit "$?"
else
ui_print "ERROR 69: Wrong architecture to set-up pre-bundled busybox"
exit 1
fi
' > $ZIP_DIR/META-INF/com/google/android/update-binary
}
make_updater_script() {
echo ">>> Creating updater-script"
echo "# Dummy file; update-binary is a shell script." > $ZIP_DIR/META-INF/com/google/android/updater-script
}
make_installer() {
echo ">>> Creating installer.sh"
cat scripts/installer.sh > $ZIP_DIR/installer.sh
}