diff --git a/README.md b/README.md index 41cb625..470b1c8 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,50 @@ -# deb-repo +# Debrepo + +A Debian repository management tool. + +## Development +__Warning! This software is still under development and is not intended for stable use.__ + +### Todo +- [ ] finish add feature +- [ ] create del feature +- [ ] multiple repositories feature + +## About +`Debrepo` is a software tool designed for creating and managing Debian repositories for `*.deb` packages, providing a lightweight and user-friendly alternative to more complex tools like `reprepo` or `aptly`. While these alternatives may offer more advanced features, Debrepo focuses on providing essential functionality and ease of use for repository management, allowing users to easily add, remove, and update packages within their repositories. With Debrepo, users can efficiently manage their Debian repositories without the unnecessary complexity of more advanced tools. + +## Dependencies +Lorem, Ipsum, Dolor + +## Installation +### from deb package +- Todo + +### from source +- Todo + +## How to use +```md +USAGE: + debrepo [OPTIONS] [DEB] + +OPTIONS: + init, -i, --init + create repository folder structure + add, -a, --add + add deb package to repository + del, -d, --del + delete deb package from repository + help, -h, --help + print help message + -v, --version + print version of debrepo package + +ARGS: + ... + *.deb package to add or delete from repository. +``` + +## License +Debrepo is a software tool that is licensed under the MIT license. This means that users are free to use, copy, modify, and distribute the tool, both in source code and binary form, as long as they include the original copyright and license notice in any copies or modified versions of the software. The MIT license also comes with no warranty or liability, meaning that the author or contributors of the software cannot be held responsible for any damages or issues that may arise from the use of the software. diff --git a/debrepo b/debrepo new file mode 100755 index 0000000..a27ff39 --- /dev/null +++ b/debrepo @@ -0,0 +1,56 @@ +#!/bin/sh +VERSION="1.0.0" +DIR="$(cd "$(dirname "$0")" && pwd)" + +if [ "$1" = "init" ] || [ "$1" = "-i" ] || [ "$1" = "--init" ]; then + $DIR/scripts/repoinit.sh && echo "debrepo: repository folders have been successfully created" + exit +fi + +if [ "$1" = "add" ] || [ "$1" = "-a" ] || [ "$1" = "--add" ]; then + echo "add" + $DEBPATH="" + exit +fi + +if [ "$1" = "del" ] || [ "$1" = "-d" ] || [ "$1" = "--del" ]; then + echo "del" + $DEBNAME="" + exit +fi + +if [ "$1" = "-v" ] || [ "$1" = "--version" ]; then + echo "debrepo $VERSION" + exit +fi + +#if [ "$1" = "help" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then +if [ 1 ]; then + HELPMESSAGE=" +debrepo $VERSION +A Debian repository management tool. + +USAGE: + debrepo [OPTIONS] [DEB] + +OPTIONS: + init, -i, --init + create repository folder structure + add, -a, --add + add deb package to repository + del, -d, --del + delete deb package from repository + help, -h, --help + print help message + -v, --version + print version of debrepo package + +ARGS: + ... + *.deb package to add or delete from repository. + +" + + printf "%s\n" "$HELPMESSAGE" +fi + diff --git a/scripts/addPackage.sh b/scripts/addPackage.sh new file mode 100755 index 0000000..a1c64f5 --- /dev/null +++ b/scripts/addPackage.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +BASEF="hello-world_$VERSION""_amd64" +echo $BASEF + +# copy deb file to repo folder structure +cp "./$BASEF.deb" "./apt-repo/pool/main/" +# generate Packages file +dpkg-scanpackages --multiversion --arch amd64 "./apt-repo/pool/" > "./apt-repo/dists/stable/main/binary-amd64/Packages" +# generate Release file +./generate-release.sh > "./apt-repo/dists/stable/Release" + diff --git a/scripts/generate-release.sh b/scripts/generate-release.sh new file mode 100755 index 0000000..a1936e8 --- /dev/null +++ b/scripts/generate-release.sh @@ -0,0 +1,31 @@ +#!/bin/sh +set -e + +do_hash() { + HASH_NAME=$1 + HASH_CMD=$2 + echo "${HASH_NAME}:" + for f in $(find -type f); do + f=$(echo $f | cut -c3-) # remove ./ prefix + if [ "$f" = "Release" ]; then + continue + fi + echo " $(${HASH_CMD} ${f} | cut -d" " -f1) $(wc -c $f)" + done +} + +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 +Date: $(date -Ru) +EOF +do_hash "MD5Sum" "md5sum" +do_hash "SHA1" "sha1sum" +do_hash "SHA256" "sha256sum" + diff --git a/scripts/repoinit.sh b/scripts/repoinit.sh new file mode 100755 index 0000000..0d4b329 --- /dev/null +++ b/scripts/repoinit.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +# make folders +mkdir -p ./apt-repo/dists/stable/main/binary-amd64/ +mkdir -p ./apt-repo/pool/main/ +