#!/bin/bash
set -e

# Import the GPG key
gpg --import /usr/src/openback/packaging/openback-privkey.asc

# Build the source package and sign it with GPG
# -S: source package only
# -sa: include original source
# -k: sign with specific key
echo "Building source package..."
dpkg-buildpackage -d -S -sa -k"wiratamareyhan85@gmail.com"

echo "Checking the generated files..."
cd ..
ls -la openback_0.1.0*

# Setup dput config for Mentors

# Upload to mentors
echo "Uploading to mentors.debian.net..."
dput mentors openback_0.1.0_source.changes
echo "Upload complete!"
