forked from ahmedmoselhi/OrangeFox-build-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_ofconfig.sh
executable file
·125 lines (108 loc) · 4.5 KB
/
generate_ofconfig.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
117
118
119
120
121
122
123
124
125
# OrangeFox ofconf generator by SebaUbuntu
SCRIPT_VERSION="R10.1"
#!/bin/bash
# OrangeFox logo function
NORMAL=$(tput sgr0)
REVERSE=$(tput smso)
logo() {
printf "${NORMAL} ${REVERSE}\n"
printf "${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE}\n"
printf "${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE}\n"
printf "${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE}\n"
printf "${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE}\n"
printf "${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE}\n"
printf "${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE}\n"
printf "${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE}\n"
printf "${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE}\n"
printf "${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE}\n"
printf "${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE}\n"
printf "${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE}\n"
printf "${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE}\n"
printf "${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE} ${NORMAL} ${REVERSE}\n"
printf "${NORMAL} \n"
printf " OrangeFox Recovery Project \n\n"
printf " OFCONFIG generator by SebaUbuntu \n\n"
printf " $SCRIPT_VERSION \n\n"
}
clear
logo
# Ask for device codename
printf "Device codename (for example whyred)\nAnswer: "
read TARGET_DEVICE
clear
logo
# Ask for device codename
printf "Device commercial name (for example Xiaomi Redmi Note 5)\nAnswer: "
read TARGET_DEVICE_NAME
clear
logo
# Ask for device codename
printf "Device architecture - Possibilities: ARM - ARM64 - x86\nAnswer: "
read TARGET_ARCH
clear
logo
# Ask for device resolution
printf "Device resolution\nInsert it in HEIGHTxWIDTH (eg. 2160x1080)\nAnswer: "
read DEVICE_RESOLUTION
clear
# OrangeFox screen height obtaining
IFS="x"
for i in $DEVICE_RESOLUTION
do
RESOLUTION_VALUE=$((RESOLUTION_VALUE+1))
if [ ! $RESOLUTION_VALUE = "1" ]
then
RESOLUTION_W=$i
else
RESOLUTION_H=$i
fi
done
IFS=" "
let "OF_SCREEN_H = $RESOLUTION_H / $RESOLUTION_W * 1080"
printf "\nObtained $OF_SCREEN_H from calculation"
clear
logo
# Ask for device partitioning
printf "Is this an A/B device? (system_a and system_b partitions)\nAnswer: "
read OF_AB_DEVICE
clear
logo
printf "Do you want to include nano editor when using terminal?\nAnswer: "
read FOX_USE_NANO_EDITOR
clear
# Export correct values if user have used other value then 1
IFS="
"
if [ -f orangefox_build_vars.txt ]
then
for i in $(cat orangefox_build_vars.txt)
do
if [ "$(printf '%s' "$i" | cut -c1)" != "#" ]
then
case ${!i} in
yes|y|true|1)
export $i=1
;;
*)
export $i=0
;;
esac
fi
done
fi
IFS=" "
# Copy to a new file config variables
echo "# OrangeFox config file for $TARGET_DEVICE ($TARGET_DEVICE_NAME)
# Config based on OrangeFox $SCRIPT_VERSION variables, support for newer versions can't be guaranteed
# Created by generate_ofconfig.sh at $(date)
DEVICE_RESOLUTION="$DEVICE_RESOLUTION"" > configs/"$TARGET_DEVICE"_ofconfig
IFS="
"
for i in $(cat orangefox_build_vars.txt)
do
if [ "$(printf '%s' "$i" | cut -c1)" != "#" ]
then
echo "$i=${!i}" >> configs/"$TARGET_DEVICE"_ofconfig
fi
done
IFS=" "