big feat & update commit, read description...

feat: regenerate packages & release (update option), letter based folder structure support, choose gpg key, config file, multiple architecture done
update: docs, comments in code, add, del, list, sign
i dont know honestly... docs will be updated later
This commit is contained in:
2023-05-03 17:07:33 +02:00
parent 5af9d45d43
commit ce0b37cabe
7 changed files with 160 additions and 28 deletions

View File

@ -1,17 +1,18 @@
#!/bin/sh
DIR="$(cd "$(dirname "$0")" && pwd)"
LS="$(which ls)"
ARCHS="$($LS -l apt-repo/dists/stable/main/ | awk '{print $9}' | awk NF | awk -F - '{print $2}')"
LS="$(which ls)" # this prevents bugs when aliasing ls to tools like exa
REPODIR="$1"
ARCHS="$($LS -l $REPODIR/apt-repo/dists/stable/main/ | awk '{print $9}' | awk NF | awk -F - '{print $2}')"
# generate Packages file
for ARCH in $ARCHS; do
echo $ARCH
dpkg-scanpackages --multiversion --arch $ARCH "./apt-repo/pool/" > "./apt-repo/dists/stable/main/binary-$ARCH/Packages"
dpkg-scanpackages --multiversion --arch $ARCH "$REPODIR/apt-repo/pool/" > "$REPODIR/apt-repo/dists/stable/main/binary-$ARCH/Packages"
# compress Packages file
cat "./apt-repo/dists/stable/main/binary-$ARCH/Packages" | gzip -9 > "./apt-repo/dists/stable/main/binary-$ARCH/Packages.gz"
cat "$REPODIR/apt-repo/dists/stable/main/binary-$ARCH/Packages" | gzip -9 > "$REPODIR/apt-repo/dists/stable/main/binary-$ARCH/Packages.gz"
done
# generate Release file
cd "./apt-repo/dists/stable/"
cd "$REPODIR/apt-repo/dists/stable/"
$DIR/generate-release.sh > "Release"

View File

@ -1,5 +1,6 @@
#!/bin/sh
set -e
. ../../config # this file is in /apt-repo/config
do_hash() {
HASH_NAME=$1
@ -11,20 +12,28 @@ do_hash() {
continue
fi
echo " $(${HASH_CMD} ${f} | cut -d" " -f1) $(wc -c $f)"
pwd
done
}
if [ ! -f "../../config" ]; then
echo "error - config file does not exists"
exit 1;
fi
cat << EOF
Origin: Example Repository
Label: Example
Suite: stable
Codename: stable
Version: 1.0
Architectures: amd64 arm64 arm7
Components: main
Description: An example software repository
Origin: $ORIGIN
Label: $LABEL
Suite: $SUITE
Codename: $CODENAME
Version: $VERSION
Architectures: $ARCHITECTURES
Components: $COMPONENTS
Description: $DESCRIPTION
Date: $(date -Ru)
EOF
do_hash "MD5Sum" "md5sum"
do_hash "SHA1" "sha1sum"
do_hash "SHA256" "sha256sum"

View File

@ -1,8 +1,32 @@
#!/bin/sh
KEY="$1"
REPODIR="$1"
. $REPODIR/apt-repo/config
#KEY="$2"
#echo $KEY
#if [ $KEY = "--repodir" ]; then
# KEY=""
#fi
#
#if [ $KEY ]; then
# continue
#elif [ $DEFAULT_GPG ]; then
# KEY="$DEFAULT_GPG"
#else
# echo "error: no gpg key provided"
# exit 1
#fi
if [ ! $DEFAULT_GPG ]; then
echo "error: no gpg key provided in config file"
exit 1
fi
KEY=$DEFAULT_GPG
echo "debrepo: signing using $KEY"
cat ./apt-repo/dists/stable/Release | gpg --default-key $KEY -abs > ./apt-repo/dists/stable/Release.gpg
cat ./apt-repo/dists/stable/Release | gpg --default-key $KEY -abs --clearsign > ./apt-repo/dists/stable/InRelease
cat $REPODIR/apt-repo/dists/stable/Release | gpg --default-key $KEY -abs > $REPODIR/apt-repo/dists/stable/Release.gpg
cat $REPODIR/apt-repo/dists/stable/Release | gpg --default-key $KEY -abs --clearsign > $REPODIR/apt-repo/dists/stable/InRelease

View File

@ -1,6 +1,11 @@
#!/bin/sh
# make folders
mkdir -p ./apt-repo/dists/stable/main/binary-amd64/
mkdir -p ./apt-repo/pool/main/
if [ -z $1 ]; then
echo "error: --repodir is not set"
exit 1
fi
# make folders
mkdir -p $1/apt-repo/dists/stable/main/binary-amd64/
mkdir -p $1/apt-repo/pool/main/