Repository navigation
Expand file tree
/
Copy pathsetup.sh
More file actions
158 lines (137 loc) · 7.51 KB
/
Copy pathsetup.sh
File metadata and controls
158 lines (137 loc) · 7.51 KB
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
152
153
154
155
156
157
158
#!/bin/bash
# Welcome message
echo ""
echo " ███╗ ██╗ ██████╗ ████████╗██╗ ██╗██╗███╗ ██╗ ██████╗ ██████╗ ██╗ ██╗ ██████╗ ███╗ ██╗███████╗ ██████╗ "
echo " ████╗ ██║██╔═══██╗╚══██╔══╝██║ ██║██║████╗ ██║██╔════╝ ██╔══██╗██║ ██║██╔═══██╗████╗ ██║██╔════╝ ╚════██╗ "
echo " ██╔██╗ ██║██║ ██║ ██║ ███████║██║██╔██╗ ██║██║ ███╗ ██████╔╝███████║██║ ██║██╔██╗ ██║█████╗ █████╔╝ "
echo " ██║╚██╗██║██║ ██║ ██║ ██╔══██║██║██║╚██╗██║██║ ██║ ██╔═══╝ ██╔══██║██║ ██║██║╚██╗██║██╔══╝ ██╔═══╝ "
echo " ██║ ╚████║╚██████╔╝ ██║ ██║ ██║██║██║ ╚████║╚██████╔╝ ██║ ██║ ██║╚██████╔╝██║ ╚████║███████╗ ███████╗ "
echo " ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝ ╚══════╝ "
echo ""
echo "=========================================================================="
echo " Welcome to the Custom ROM Cloning Script for Nothing Phone 2 (Pong)! "
echo "=========================================================================="
echo ""
echo "✨ Happy custom ROM building! ✨"
echo ""
echo "🔧 Build script by: GHOST | ゴースト"
echo ""
# Explain Depth Cloning
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "📌 Git Depth Cloning Explanation:"
echo ""
echo " - **Shallow Clone (--depth=1)**: Only fetches the latest commit, making cloning faster and saving space."
echo " - **Full Clone**: Fetches the entire repository history, useful for development but slower."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Ask user whether to use depth cloning
echo ""
read -p "Do you want to use depth cloning (--depth=1) for faster cloning? (y/n): " DEPTH_CHOICE
if [[ "$DEPTH_CHOICE" =~ ^[Yy]$ ]]; then
CLONE_DEPTH="--depth=1"
echo ""
echo "✅ Using shallow clone (--depth=1) for faster setup."
echo ""
else
CLONE_DEPTH=""
echo ""
echo "✅ Using full repository clone."
echo ""
fi
# Define repositories
declare -A REPOS=(
["device/nothing/Pong"]="https://github.com/neikos4962/device_nothing_Pong.git|17"
["vendor/nothing/Pong"]="https://github.com/Pong-Development/vendor_nothing_Pong.git|17"
["kernel/nothing/sm8475"]="https://github.com/Pong-Development/kernel_nothing_sm8475.git|17"
["kernel/nothing/sm8475-modules"]="https://github.com/Pong-Development/kernel_nothing_sm8475-modules.git|17"
["kernel/nothing/sm8475-devicetrees"]="https://github.com/Pong-Development/kernel_nothing_sm8475-devicetrees.git|17"
["hardware/qcom-caf/sm8450/display"]="https://github.com/Pong-Development/hardware_qcom-caf_sm8450_display.git|17"
["packages/apps/ParanoidGlyphPhone2"]="https://github.com/Pong-Development/packages_apps_ParanoidGlyph.git|17"
["packages/apps/GlyphAdapter"]="https://github.com/Pong-Development/packages_apps_GlyphAdapter.git|16"
["hardware/dolby"]="https://github.com/Pong-Development/hardware_dolby.git|16"
["vendor/lineage/signing/keys"]="https://github.com/neikos4962/vendor_lineage_signing_keys.git|main"
)
# Function to clone a repository with error handling
clone_repo() {
local target_dir="$1"
local repo_data="$2"
IFS='|' read -r repo_url branch <<< "$repo_data"
echo "Cloning $target_dir..."
echo "Repository: $repo_url"
echo "Branch: $branch"
rm -rf "$target_dir"
if git clone $CLONE_DEPTH -b "$branch" "$repo_url" "$target_dir"; then
echo ""
echo "✅ Successfully cloned ✨ $target_dir"
echo "🌿 Branch: $branch"
echo ""
else
echo ""
echo "❌ Failed to clone $target_dir"
echo "🌿 Branch: $branch"
echo ""
exit 1
fi
}
# Override host metadata for reproducible builds
read -p "Do you want to override BUILD_USERNAME and BUILD_HOSTNAME? (y/n): " OVERRIDE_CHOICE
if [[ "$OVERRIDE_CHOICE" =~ ^[Yy]$ ]]; then
read -p "Enter your desired BUILD_USERNAME: " BUILD_USERNAME
read -p "Enter your desired BUILD_HOSTNAME: " BUILD_HOSTNAME
export BUILD_USERNAME="$BUILD_USERNAME"
export BUILD_HOSTNAME="$BUILD_HOSTNAME"
echo ""
echo "BUILD_USERNAME is set to: $BUILD_USERNAME"
echo "BUILD_HOSTNAME is set to: $BUILD_HOSTNAME"
echo ""
else
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Using default BUILD_USERNAME and BUILD_HOSTNAME"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
fi
# Clone repositories
for target_dir in "${!REPOS[@]}"; do
clone_repo "$target_dir" "${REPOS[$target_dir]}"
done
# KernelSU patch
echo "Applying KernelSU patch..."
cd kernel/nothing/sm8475 || exit 1
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
cd - >/dev/null
echo ""
echo ""
echo " ✅ KernelSU patch applied."
echo ""
# patch wfd
echo "Applying patch wfd..."
cd hardware/lineage/compat || exit 1
git fetch https://github.com/Lunaris-Stagging/hardware_lineage_compat patch
git cherry-pick -s 3486ff4cea891f5a5103ce407e6f86ff44dcb1e5
cd ../../.. || exit 1
echo ""
echo ""
echo " ✅ wfd patch applied."
echo ""
# patch wfd
echo "Applying extra UDFPS icons..."
cd vendor/lineage || exit 1
git fetch https://github.com/neikos4962/android_vendor_derpfest-udfps_icons.git
git cherry-pick -s 2302f3918e4250ad5b0bcd8adfff201d450b966e
cd ../.. || exit 1
echo ""
echo ""
echo " ✅ Extra UDFPS icons applied."
echo ""
# setup done
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " ✅ Setup completed successfully! "
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "🚀 All repositories have been cloned successfully!"
echo ""
echo "🎉 Enjoy building your custom ROM!"
echo ""
echo "✨ Done! Happy flashing! ✨"
echo ""