]> git.rocketbowman.com Git - srv-deb.git/commitdiff
init: populate wiht main content
authorKyle Bowman <kyle+github@rocketbowman.com>
Sun, 5 Oct 2025 19:34:29 +0000 (15:34 -0400)
committerKyle Bowman <kyle+github@rocketbowman.com>
Sun, 5 Oct 2025 19:34:29 +0000 (15:34 -0400)
.gitignore [new file with mode: 0644]
Makefile [new file with mode: 0644]
README.md [new file with mode: 0644]
reprepro/conf/distributions [new file with mode: 0644]
reprepro/db/.gitkeep [new file with mode: 0644]
scripts/check_latest.sh [new file with mode: 0755]
scripts/download.sh [new file with mode: 0755]
scripts/generate_index.sh [new file with mode: 0755]
scripts/replace_key.sh [new file with mode: 0755]
update_all.sh [new file with mode: 0755]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..d661e00
--- /dev/null
@@ -0,0 +1,3 @@
+packages
+reprepro/db
+store/
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..fba5151
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+DOWNLOAD_DIR:=store
+
+.PHONY:
+help:
+       @echo "This Makefile helps you maintain a Debian repository."
+       @echo ""
+       @echo "The following targets are available:"
+       @echo ""
+       @echo "init:    Initializes the repository structure according to the .env file."
+
+.PHONY:
+clean:
+       rm -rf packages
+       rm -rf $(DOWNLOAD_DIR)/bookworm/*
+       rm -rf $(DOWNLOAD_DIR)/trixie/*
+       rm -rf $(DOWNLOAD_DIR)/sid/*
+       rm reprepro/db/*
+
+.PHONY:
+update: $(DOWNLOAD_DIR)/bookworm $(DOWNLOAD_DIR)/trixie $(DOWNLOAD_DIR)/sid
+       ./update_all.sh
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..8e640b1
--- /dev/null
+++ b/README.md
@@ -0,0 +1,60 @@
+# Overview
+
+This repository helps you bootstrap a Debian repository. It does not archive
+old versions by default.
+
+# Set Up
+
+## Prerequisites
+
+``` bash
+sudo apt install gnupg reprepro
+```
+
+## Create a GPG Key
+
+A GPG key enables you to cryptographically sign packages to assure people that
+you are the one who packaged it.
+
+``` bash
+gpg --full-generate-key
+```
+
+1. Select "RSA (sign only)".
+2. Select a key size of 4096
+
+## Add your GPG Key to the Repository
+
+Get your Key ID by by running the following command:
+
+``` bash
+gpg --list-keys --keyid-format long
+```
+
+Copy it into the repository so people can validate against it with the following command:
+
+``` bash
+gpg --armor --export YOUR_KEY_ID > repository-key.asc
+```
+
+Apply it throughout the repository by using `./scripts/replace_key.sh YOUR_KEY_ID <YOUR_ACTUAL_KEY_ID>`.
+
+Okay, that's confusing. The first `YOUR_KEY_ID` is the literal string. The second
+is your actual key ID. The script does a targeted search and replace throughout
+the repository.
+
+# Add packages to GitHub
+
+Use [Cookiecutter-deb](https://github.com/rocketbowman/cookiecutter-deb) to 
+create a new template of a package. 
+
+The GitHub action produces a draft build. You must convert that draft into a
+proper release.
+
+# Add packages to this Repository
+
+Add the new package to the `update_all.sh` script.
+
+# Use the Makefile
+
+Use `make update` to fetch the latest releases from GitHub to your repo.
\ No newline at end of file
diff --git a/reprepro/conf/distributions b/reprepro/conf/distributions
new file mode 100644 (file)
index 0000000..96f82c7
--- /dev/null
@@ -0,0 +1,17 @@
+Codename: bookworm
+Architectures: amd64
+Components: main 
+Description: Apt repository for unofficial packages 
+SignWith: YOUR_KEY_ID
+
+Codename: trixie
+Architectures: amd64
+Components: main 
+Description: Apt repository for unofficial packages
+SignWith: YOUR_KEY_ID
+
+Codename: sid
+Architectures: amd64
+Components: main 
+Description: Apt repository for unofficial packages
+SignWith: YOUR_KEY_ID
diff --git a/reprepro/db/.gitkeep b/reprepro/db/.gitkeep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/scripts/check_latest.sh b/scripts/check_latest.sh
new file mode 100755 (executable)
index 0000000..2efddd6
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+# Usage: ./check_latest uv
+PACKAGE_NAME=$1
+
+# ASSUME: Repository is named deb-$PACKAGE_NAME
+REPO=deb-$PACKAGE_NAME
+curl --silent --head https://github.com/rocketbowman/"$REPO"/releases/latest \
+    | sed   --silent --regexp-extended \
+            --expression "s|location: (.*)|\1|p" \
+    | sed   --silent --regexp-extended \
+            --expression "s|.*/releases/tag/(.*)|\1|p"
\ No newline at end of file
diff --git a/scripts/download.sh b/scripts/download.sh
new file mode 100755 (executable)
index 0000000..e9794c1
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+# download.sh
+# Usage: ./download uv 0.8.22 1 "amd64"
+
+PACKAGE_NAME="$1"
+PACKAGE_VERSION=${2:-"default"}
+BUILD_VERSION=${3:-"1"}
+ARCHITECTURES=${4:-"amd64"}
+
+# ASSUME: Repos are named deb-$PACKAGE_NAME
+REPO="deb-$PACKAGE_NAME"
+
+# If PACKAGE_VERSION is unspecified, check GitHub to get the latest.
+if [ "$PACKAGE_VERSION" == "default" ]; then
+    read -r PACKAGE_VERSION <<< "$(./check_latest.sh "$PACKAGE_NAME" |sed 's/\r$//')"
+fi
+
+echo $PACKAGE_VERSION
+
+# Get deb for all Debian distributions
+declare -a arr=("bookworm" "trixie" "sid")
+for i in "${arr[@]}"
+do
+    DEBIAN_DIST=$i
+    filename="${PACKAGE_NAME}_${PACKAGE_VERSION}-${BUILD_VERSION}+${DEBIAN_DIST}_${ARCHITECTURES}"
+    wget -O "../store/${DEBIAN_DIST}/${filename}.deb" \
+        "https://github.com/rocketbowman/${REPO}/releases/download/${PACKAGE_VERSION}/${filename}.deb"
+done
\ No newline at end of file
diff --git a/scripts/generate_index.sh b/scripts/generate_index.sh
new file mode 100755 (executable)
index 0000000..a9c5dac
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+# generate_index.sh
+# Usage: ./generate_index.sh
+KEY_ID=YOUR_KEY_ID
+root=$(pwd)/..
+reprepro=$root/reprepro
+
+declare -a arr=("bookworm" "trixie" "sid")
+for i in "${arr[@]}"
+do
+    DEBIAN_DIST=$i
+    reprepro --dbdir "$reprepro"/db \
+            --confdir "$reprepro"/conf \
+            --outdir="$root"/packages \
+            --component main \
+            includedeb "$DEBIAN_DIST" "$root"/store/"$DEBIAN_DIST"/*.deb
+    package_dir="$root/packages/dists/$DEBIAN_DIST"
+    cat "$package_dir"/Release | gpg -s --default-key "$KEY_ID" -abs > "$package_dir"/Release.gpg
+done
\ No newline at end of file
diff --git a/scripts/replace_key.sh b/scripts/replace_key.sh
new file mode 100755 (executable)
index 0000000..96c9321
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+rootdir=$(pwd)/..
+OLD_KEY_ID=$1
+NEW_KEY_ID=$2
+sed --in-place --expression "s/$OLD_KEY_ID/$NEW_KEY_ID/g" "$rootdir/reprepro/conf/distributions"
+sed --in-place --expression "s/$OLD_KEY_ID/$NEW_KEY_ID/g" "$rootdir/scripts/generate_index.sh"
\ No newline at end of file
diff --git a/update_all.sh b/update_all.sh
new file mode 100755 (executable)
index 0000000..d46f6a5
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+cd scripts || return 1
+declare -a packages=("uv")
+for i in "${packages[@]}"
+do
+    package=$i
+    ./download.sh "$package"
+done
+
+./generate_index.sh
\ No newline at end of file