Initial commit.
This commit is contained in:
83
scripts/build-apt-repository.sh
Executable file
83
scripts/build-apt-repository.sh
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Configuration
|
||||
REPO_NAME="wild-cloud-central"
|
||||
DIST="stable"
|
||||
COMPONENT="main"
|
||||
REPO_DIR="dist/repositories/apt"
|
||||
PACKAGE_DIR="dist/packages"
|
||||
|
||||
echo "🏗️ Building APT repository with aptly..."
|
||||
|
||||
# Initialize aptly database if needed (aptly auto-creates on first use)
|
||||
echo "📦 Ensuring aptly is ready..."
|
||||
|
||||
# Check if repository is already published and drop it first
|
||||
if aptly publish list 2>/dev/null | grep -q "filesystem:dist/repositories/apt:./stable"; then
|
||||
echo "🗑️ Dropping existing published repository..."
|
||||
aptly publish drop -force-drop stable filesystem:dist/repositories/apt: || echo "⚠️ Could not drop existing published repository"
|
||||
fi
|
||||
|
||||
# Check if repository already exists and drop it to start fresh
|
||||
if aptly repo list 2>/dev/null | grep -q "\[$REPO_NAME\]"; then
|
||||
echo "🗑️ Removing existing repository '$REPO_NAME'..."
|
||||
aptly repo drop -force "$REPO_NAME" || echo "⚠️ Could not drop existing repository"
|
||||
fi
|
||||
|
||||
# Create local repository
|
||||
echo "📦 Creating local repository '$REPO_NAME'..."
|
||||
aptly repo create -distribution="$DIST" -component="$COMPONENT" "$REPO_NAME"
|
||||
|
||||
# Add packages to repository
|
||||
if [ -d "$PACKAGE_DIR" ] && [ "$(ls -A $PACKAGE_DIR/*.deb 2>/dev/null)" ]; then
|
||||
echo "📦 Adding packages to repository..."
|
||||
aptly repo add "$REPO_NAME" "$PACKAGE_DIR"/*.deb
|
||||
else
|
||||
echo "⚠️ No .deb files found in $PACKAGE_DIR directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create output directory
|
||||
mkdir -p "$REPO_DIR"
|
||||
|
||||
# Get GPG signing key
|
||||
SIGNING_KEY=$(gpg --list-secret-keys --with-colons | grep '^sec' | head -1 | cut -d: -f5)
|
||||
if [ -z "$SIGNING_KEY" ]; then
|
||||
echo "❌ No GPG signing key found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🔐 Using GPG key: $SIGNING_KEY"
|
||||
|
||||
# Publish repository with GPG signing
|
||||
echo "🚀 Publishing repository..."
|
||||
aptly publish repo -distribution="$DIST" -component="$COMPONENT" -architectures="amd64,arm64" -gpg-key="$SIGNING_KEY" "$REPO_NAME" "filesystem:$REPO_DIR:"
|
||||
|
||||
# Export GPG public key for users
|
||||
echo "🔑 Exporting GPG public key..."
|
||||
gpg --export "$SIGNING_KEY" > "$REPO_DIR/wild-cloud-central.gpg"
|
||||
|
||||
echo "✅ APT repository built successfully!"
|
||||
echo ""
|
||||
echo "📦 Repository location: $REPO_DIR/"
|
||||
echo "🔑 GPG key location: $REPO_DIR/wild-cloud-central.gpg"
|
||||
echo ""
|
||||
echo "📋 Users can install with:"
|
||||
echo ""
|
||||
echo " # Download and install GPG key"
|
||||
echo " curl -fsSL https://mywildcloud.org/apt/wild-cloud-central.gpg | sudo tee /usr/share/keyrings/wild-cloud-central-archive-keyring.gpg > /dev/null"
|
||||
echo ""
|
||||
echo " # Add repository"
|
||||
echo " sudo tee /etc/apt/sources.list.d/wild-cloud-central.sources << 'EOF'"
|
||||
echo " Types: deb"
|
||||
echo " URIs: https://mywildcloud.org/apt"
|
||||
echo " Suites: $DIST"
|
||||
echo " Components: $COMPONENT"
|
||||
echo " Signed-By: /usr/share/keyrings/wild-cloud-central-archive-keyring.gpg"
|
||||
echo " EOF"
|
||||
echo ""
|
||||
echo " # Update and install"
|
||||
echo " sudo apt update"
|
||||
echo " sudo apt install wild-cloud-central"
|
||||
44
scripts/deploy-apt-repository.sh
Executable file
44
scripts/deploy-apt-repository.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Configuration - update these for your server
|
||||
SERVER="user@mywildcloud.org"
|
||||
REMOTE_PATH="/var/www/html/apt"
|
||||
LOCAL_REPO="dist/repositories/apt"
|
||||
|
||||
echo "🚀 Deploying APT repository to mywildcloud.org..."
|
||||
|
||||
# Check if repository exists
|
||||
if [ ! -d "$LOCAL_REPO" ]; then
|
||||
echo "❌ Repository not found. Run './scripts/build-apt-repository.sh' first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Deploy repository
|
||||
echo "📤 Uploading repository files..."
|
||||
echo "Not yet implemented. We'll do this when we have a permanent home."
|
||||
|
||||
echo ""
|
||||
echo "✅ Deployment complete!"
|
||||
echo ""
|
||||
echo "🌐 Repository URL: https://mywildcloud.org/apt"
|
||||
echo "🔑 GPG Key URL: https://mywildcloud.org/apt/wild-cloud-central.gpg"
|
||||
echo ""
|
||||
echo "👥 Users can now install with:"
|
||||
echo ""
|
||||
echo " # Download and install GPG key (Debian convention)"
|
||||
echo " curl -fsSL https://mywildcloud.org/apt/wild-cloud-central.gpg | sudo tee /usr/share/keyrings/wild-cloud-central-archive-keyring.gpg > /dev/null"
|
||||
echo ""
|
||||
echo " # Add repository (modern .sources format)"
|
||||
echo " sudo tee /etc/apt/sources.list.d/wild-cloud-central.sources << 'EOF'"
|
||||
echo " Types: deb"
|
||||
echo " URIs: https://mywildcloud.org/apt"
|
||||
echo " Suites: stable"
|
||||
echo " Components: main"
|
||||
echo " Signed-By: /usr/share/keyrings/wild-cloud-central-archive-keyring.gpg"
|
||||
echo " EOF"
|
||||
echo ""
|
||||
echo " # Update and install"
|
||||
echo " sudo apt update"
|
||||
echo " sudo apt install wild-cloud-central"
|
||||
54
scripts/setup-gpg.sh
Executable file
54
scripts/setup-gpg.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🔑 Setting up GPG key for Wild Cloud Central APT repository..."
|
||||
|
||||
# Check if GPG key already exists
|
||||
if gpg --list-secret-keys | grep -q "Wild Cloud Central"; then
|
||||
echo "✅ GPG key already exists"
|
||||
KEY_ID=$(gpg --list-secret-keys --with-colons | grep "Wild Cloud Central" -B1 | grep "^sec" | cut -d: -f5)
|
||||
echo "Key ID: $KEY_ID"
|
||||
else
|
||||
echo "🔧 Creating new GPG key..."
|
||||
|
||||
# Create GPG key configuration
|
||||
cat > gpg-key-config << EOF
|
||||
%echo Generating GPG key for Wild Cloud Central
|
||||
Key-Type: RSA
|
||||
Key-Length: 4096
|
||||
Subkey-Type: RSA
|
||||
Subkey-Length: 4096
|
||||
Name-Real: Wild Cloud Central
|
||||
Name-Comment: APT Repository Signing Key
|
||||
Name-Email: apt@mywildcloud.org
|
||||
Expire-Date: 2y
|
||||
%no-protection
|
||||
%commit
|
||||
%echo GPG key created
|
||||
EOF
|
||||
|
||||
# Generate the key
|
||||
gpg --batch --generate-key gpg-key-config
|
||||
rm gpg-key-config
|
||||
|
||||
KEY_ID=$(gpg --list-secret-keys --with-colons | grep "Wild Cloud Central" -B1 | grep "^sec" | cut -d: -f5)
|
||||
echo "✅ New GPG key created with ID: $KEY_ID"
|
||||
fi
|
||||
|
||||
# Export public key in binary format (consistent with build-apt-repository.sh)
|
||||
echo "📤 Exporting public key in binary format for APT..."
|
||||
mkdir -p dist
|
||||
gpg --export $KEY_ID > dist/wild-cloud-central.gpg
|
||||
|
||||
echo ""
|
||||
echo "✅ GPG setup complete!"
|
||||
echo ""
|
||||
echo "📋 Next steps:"
|
||||
echo " 1. Build repository with: make repo"
|
||||
echo " 2. Deploy with: make deploy-repo"
|
||||
echo " 3. Users will add this key with:"
|
||||
echo " curl -fsSL https://mywildcloud.org/apt/wild-cloud-central.gpg | sudo tee /usr/share/keyrings/wild-cloud-central.gpg > /dev/null"
|
||||
echo ""
|
||||
echo "🔐 Key ID: $KEY_ID"
|
||||
echo "📄 Public key saved to: dist/wild-cloud-central.gpg (binary format for APT)"
|
||||
Reference in New Issue
Block a user