103 lines
No EOL
2.7 KiB
Bash
Executable file
103 lines
No EOL
2.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Exit on any error
|
|
set -e
|
|
|
|
sudo mkdir -p /opt/Projects
|
|
sudo chown -R $USER:$USER /opt/Projects
|
|
cd /opt/Projects
|
|
|
|
# Function to clone and symlink a repository
|
|
clone_and_link() {
|
|
local repo_name=$1
|
|
local repo_path="/opt/Projects/$repo_name"
|
|
|
|
if [ ! -d "$repo_path" ]; then
|
|
echo "Cloning $repo_name..."
|
|
git clone "https://git.raines.xyz/particle-os/$repo_name.git"
|
|
fi
|
|
|
|
# Create symlink if it doesn't exist
|
|
local symlink_path="$HOME/debian-atomic/$repo_name"
|
|
if [ ! -L "$symlink_path" ]; then
|
|
echo "Creating symlink for $repo_name..."
|
|
ln -s "$repo_path" "$symlink_path"
|
|
fi
|
|
}
|
|
|
|
# Function to clone GitHub repositories and symlink them
|
|
clone_github_and_link() {
|
|
local repo_name=$1
|
|
local github_url=$2
|
|
local repo_path="/opt/Projects/$repo_name"
|
|
|
|
if [ ! -d "$repo_path" ]; then
|
|
echo "Cloning $repo_name from GitHub..."
|
|
git clone "$github_url" "$repo_name"
|
|
fi
|
|
|
|
# Create symlink if it doesn't exist
|
|
local symlink_path="$HOME/debian-atomic/$repo_name"
|
|
if [ ! -L "$symlink_path" ]; then
|
|
echo "Creating symlink for $repo_name..."
|
|
ln -s "$repo_path" "$symlink_path"
|
|
fi
|
|
}
|
|
|
|
# Clone and link all repositories
|
|
clone_and_link "apt-ostree"
|
|
clone_and_link "deb-bootupd"
|
|
#clone_and_link "bootc-deb"
|
|
clone_and_link "bootc"
|
|
|
|
cd ~/debian-atomic
|
|
|
|
# Create z.OriginalSourceCode directory for reference symlinks
|
|
mkdir -p z.OriginalSourceCode
|
|
|
|
# Setup original ublue-os source code for reference
|
|
sudo mkdir -p /opt/reference
|
|
sudo chown -R $USER:$USER /opt/reference
|
|
cd /opt/reference
|
|
if [ ! -d "bootc-image-builder" ]; then
|
|
git clone https://github.com/osbuild/bootc-image-builder.git
|
|
chmod -R 555 bootc-image-builder
|
|
ln -s /opt/reference/bootc-image-builder ~/particle-os/z.OriginalSourceCode/bootc-image-builder
|
|
fi
|
|
if [ ! -d "bootupd" ]; then
|
|
git clone https://github.com/coreos/bootupd.git
|
|
chmod -R 555 bootupd
|
|
ln -s /opt/reference/bootupd ~/particle-os/z.OriginalSourceCode/bootupd
|
|
fi
|
|
|
|
|
|
# Create or update .gitignore with all repositories
|
|
if [ ! -f .gitignore ]; then
|
|
echo "Creating .gitignore..."
|
|
cat > .gitignore << EOF
|
|
euclase/
|
|
simple-cli/
|
|
apex/
|
|
corona/
|
|
deb-bootc-image-builder/
|
|
apt-ostree/
|
|
deb-bootupd/
|
|
bootc-deb/
|
|
bootc
|
|
z.OriginalSourceCode/
|
|
EOF
|
|
else
|
|
echo "Updating .gitignore..."
|
|
# Add any missing entries
|
|
for repo in euclase simple-cli apex corona deb-bootc-image-builder apt-ostree deb-bootupd bootc-deb bootc; do
|
|
if ! grep -q "^$repo/$" .gitignore; then
|
|
echo "$repo/" >> .gitignore
|
|
fi
|
|
done
|
|
# Add z.OriginalSourceCode if not present
|
|
if ! grep -q "^z.OriginalSourceCode/$" .gitignore; then
|
|
echo "z.OriginalSourceCode/" >> .gitignore
|
|
fi
|
|
fi
|
|
|
|
echo "Setup completed successfully!" |