-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.sh
executable file
·77 lines (63 loc) · 1.99 KB
/
setup.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
#!/bin/bash
hals=("hardware/qcom-caf/sdm845/audio" "hardware/qcom-caf/sdm845/display" "hardware/qcom-caf/sdm845/media")
nuke_hal() {
echo -e "--------------------------------------"
echo "Try to remove SDM845 CAF HALs from default manifests..."
cd ../manifests
for hal in ${hals[@]}; do
IFS='/' read -r -a name <<< "$(echo $hal)"
IFS=' ' read -r -a line <<< "$(grep -nir $hal)"
IFS=':' read -r -a loc_info <<< $line
sed -i "${loc_info[1]}s/.*/ <!-- SDM845 yeet ${name[-1]} -->/" ${loc_info[0]}
done
cd ../local_manifests
}
echo -e "### Mini Manifest Editor by Juleast###"
echo -e "--------------------------------------"
echo "Select the device:"
echo "1. judyln"
echo "2. judypn"
echo "3. judyp"
echo "4. ALL"
read -p "Choose your device (1-4): " device_choice
case "${device_choice}" in
1)
device="judyln"
;;
2)
device="judypn"
;;
3)
device="judyp"
;;
4)
device=("judyln" "judypn" "judyp")
;;
*)
echo "Invalid choice!"
echo "Exiting..."
exit 1
;;
esac
newline=" <project path=\"device/lge/$device\" name=\"android_device_lge_$device\" remote=\"jlst\" />"
echo -e "\nEditing XML files..."
readarray -t file_lines < <(cat lge_sdm845.xml)
echo -e "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | tee lge_sdm845.xml &> /dev/null
for ((i = 1; i < ${#file_lines[@]}-2; i++)); do
echo "${file_lines[$i]}" | tee -a lge_sdm845.xml &> /dev/null
done
if [ "$device_choice" == 4 ]; then
for codename in "${device[@]}"; do
echo -e " <project path=\"device/lge/$codename\" name=\"android_device_lge_$codename\" remote=\"jlst\" />" | tee -a lge_sdm845.xml &> /dev/null
done
else
echo -e "$newline" | tee -a lge_sdm845.xml &> /dev/null
fi
echo "</manifest>" | tee -a lge_sdm845.xml &> /dev/null
echo "Finished!"
#nuke_hal
echo "Copying rom.sh script to root of ROM dir..."
cp rom.sh ../../
echo "** Make sure to run rom.sh script after running repo sync!"
echo "Done!"
echo "Note: If you are not sure of the changes, double check the files."