Skip to content

Instantly share code, notes, and snippets.

@retrozenith
Created January 9, 2025 19:49
Show Gist options
  • Save retrozenith/3ce9a4084852770b9473f882e5a9b0db to your computer and use it in GitHub Desktop.
Save retrozenith/3ce9a4084852770b9473f882e5a9b0db to your computer and use it in GitHub Desktop.
#!/bin/bash
# Define repositories and target paths
declare -A repos=(
# Pixel 6/A/PRO (GS101)
["https://github.com/LineageOS/android_device_google_gs101"]="device/google/gs101"
["https://github.com/LineageOS/android_device_google_raviole"]="device/google/raviole"
["https://github.com/LineageOS/android_device_google_gs-common"]="device/google/gs-common"
["https://github.com/LineageOS/android_device_google_oriole"]="device/google/oriole"
["https://github.com/LineageOS/android_device_google_raven"]="device/google/raven"
["https://github.com/LineageOS/android_device_google_bluejay"]="device/google/bluejay"
# Vendor trees
["https://github.com/TheMuppets/proprietary_vendor_google_oriole"]="vendor/google/oriole"
["https://github.com/TheMuppets/proprietary_vendor_google_raven"]="vendor/google/raven"
["https://github.com/TheMuppets/proprietary_vendor_google_bluejay"]="vendor/google/bluejay"
# Kernel trees
["https://android.googlesource.com/device/google/raviole-kernels/5.10"]="device/google/raviole-kernels/5.10"
["https://android.googlesource.com/device/google/bluejay-kernels/5.10"]="device/google/bluejay-kernels/5.10"
# Beyond1LTE (Exynos9820)
# Device trees
["https://github.com/LineageOS/android_device_samsung_beyond1lte"]="device/samsung/beyond1lte"
["https://github.com/LineageOS/android_device_samsung_exynos9820-common"]="device/samsung/exynos9820-common"
# Vendor trees
["https://github.com/TheMuppets/proprietary_vendor_samsung_beyond1lte"]="vendor/samsung/beyond1lte"
["https://github.com/TheMuppets/proprietary_vendor_samsung_exynos9820-common"]="vendor/samsung/exynos9820-common"
# Kernel trees
["https://github.com/LineageOS/android_kernel_samsung_exynos9820"]="kernel/samsung/exynos9820"
# Additional dependencies for Exynos9820
["https://github.com/LineageOS/android_hardware_samsung"]="hardware/samsung"
["https://github.com/LineageOS/android_hardware_samsung_slsi-linaro_config"]="hardware/samsung_slsi-linaro/config" # Missing repository
["https://github.com/LineageOS/android_hardware_samsung_slsi-linaro_exynos"]="hardware/samsung_slsi-linaro/exynos"
["https://github.com/LineageOS/android_hardware_samsung_slsi-linaro_exynos5"]="hardware/samsung_slsi-linaro/exynos5"
["https://github.com/LineageOS/android_hardware_samsung_slsi-linaro_graphics"]="hardware/samsung_slsi-linaro/graphics"
["https://github.com/LineageOS/android_hardware_samsung_slsi-linaro_interfaces"]="hardware/samsung_slsi-linaro/interfaces"
["https://github.com/LineageOS/android_hardware_samsung_slsi-linaro_openmax"]="hardware/samsung_slsi-linaro/openmax"
["https://github.com/LineageOS/android_device_samsung_slsi_sepolicy"]="device/samsung_slsi/sepolicy"
)
# Function to clone a repository
clone_repo() {
local repo_url="$1"
local target_path="$2"
local use_depth="$3"
# Check if the target path already exists
if [ -d "$target_path" ]; then
echo "Skipping $target_path: directory already exists."
return
fi
# Create the target directory if it doesn't exist
mkdir -p "$(dirname "$target_path")"
# Clone the repository
if [ "$use_depth" = "true" ]; then
echo "Cloning $repo_url into $target_path with --depth 1..."
git clone --depth 1 "$repo_url" "$target_path"
else
echo "Cloning $repo_url into $target_path..."
git clone "$repo_url" "$target_path"
fi
# Check if the cloning was successful
if [ $? -eq 0 ]; then
echo "Repository cloned successfully to $target_path."
else
echo "Failed to clone $repo_url. Please check for errors."
fi
}
# Clone each repository
for repo_url in "${!repos[@]}"; do
target_path="${repos[$repo_url]}"
# Determine if this is a kernel tree (use --depth 1)
if [[ "$repo_url" == *"kernel"* ]]; then
clone_repo "$repo_url" "$target_path" "true"
else
clone_repo "$repo_url" "$target_path" "false"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment