deb-bootc-image-builder/.Red_Hat_Version/download-source.sh

95 lines
3 KiB
Bash
Executable file

#!/bin/bash
# Interactive source code downloader for bootc-related projects
# This script allows you to choose which source code to download
set -e
echo "=== Bootc Source Code Downloader ==="
echo ""
echo "Available repositories:"
echo "1) bootc-image-builder (https://github.com/osbuild/bootc-image-builder.git)"
echo "2) bootupd/bootupctl (https://github.com/coreos/bootupd.git)"
echo "3) bootc (https://github.com/bootc-dev/bootc.git)"
echo "4) All repositories"
echo "5) Exit"
echo ""
read -p "Enter your choice (1-5): " choice
case $choice in
1)
echo "Downloading bootc-image-builder..."
if [ -d "bootc-image-builder" ]; then
echo "Directory already exists. Removing..."
rm -rf bootc-image-builder
fi
git clone https://github.com/osbuild/bootc-image-builder.git
chmod a-rwx bootc-image-builder/ # Make the source code read only
echo "✅ bootc-image-builder downloaded successfully"
;;
2)
echo "Downloading bootupd..."
if [ -d "bootupd" ]; then
echo "Directory already exists. Removing..."
rm -rf bootupd
fi
git clone https://github.com/coreos/bootupd.git
chmod a-rwx bootupd/ # Make the source code read only
echo "✅ bootupd downloaded successfully"
;;
3)
echo "Downloading bootc..."
if [ -d "bootc" ]; then
echo "Directory already exists. Removing..."
rm -rf bootc
fi
git clone https://github.com/bootc-dev/bootc.git
chmod a-rwx bootc/ # Make the source code read only
echo "✅ bootc downloaded successfully"
;;
4)
echo "Downloading all repositories..."
# bootc-image-builder
if [ -d "bootc-image-builder" ]; then
echo "bootc-image-builder directory already exists. Removing..."
rm -rf bootc-image-builder
fi
git clone https://github.com/osbuild/bootc-image-builder.git
chmod a-rwx bootc-image-builder/
echo "✅ bootc-image-builder downloaded"
# bootupd
if [ -d "bootupd" ]; then
echo "bootupd directory already exists. Removing..."
rm -rf bootupd
fi
git clone https://github.com/coreos/bootupd.git
chmod a-rwx bootupd/
echo "✅ bootupd downloaded"
# bootc
if [ -d "bootc" ]; then
echo "bootc directory already exists. Removing..."
rm -rf bootc
fi
git clone https://github.com/bootc-dev/bootc.git
chmod a-rwx bootc/
echo "✅ bootc downloaded"
echo "✅ All repositories downloaded successfully"
;;
5)
echo "Exiting..."
exit 0
;;
*)
echo "❌ Invalid choice. Please run the script again and select 1-5."
exit 1
;;
esac
echo ""
echo "Download complete! You can now examine the source code for ideas."
echo "Note: All directories are set to read-only for safety."