From ef2e47e088c3d060cc9a776af8687aba4a206998 Mon Sep 17 00:00:00 2001 From: Filip Rojek Date: Sun, 23 Apr 2023 16:07:51 +0200 Subject: [PATCH] feat: del, add, serve; updated: readme.md --- README.md | 10 ++++++---- debrepo | 22 ++++++++++++++++++---- scripts/addPackage.sh | 9 +++------ 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index c507412..9a02663 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ A Debian repository management tool. __Warning! This software is still under development and is not intended for stable use.__ ### Todo -- [ ] finish add feature -- [ ] create del feature +- [x] finish add feature +- [x] create del feature - [ ] multiple repositories feature - [ ] signing repositories using GPG @@ -15,7 +15,7 @@ __Warning! This software is still under development and is not intended for stab `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 +- `sh`, `dpkg`, `gpg`, `python3` ## Installation ### from deb package @@ -27,7 +27,7 @@ Lorem, Ipsum, Dolor ## How to use ``` USAGE: - debrepo [OPTIONS] [DEB] + debrepo [OPTIONS] [DEB] OPTIONS: init, -i, --init @@ -36,6 +36,8 @@ OPTIONS: add deb package to repository del, -d, --del delete deb package from repository + serve, -s, --serve + serve repository using python built in http module help, -h, --help print help message -v, --version diff --git a/debrepo b/debrepo index a27ff39..cabbeb2 100755 --- a/debrepo +++ b/debrepo @@ -8,14 +8,26 @@ if [ "$1" = "init" ] || [ "$1" = "-i" ] || [ "$1" = "--init" ]; then fi if [ "$1" = "add" ] || [ "$1" = "-a" ] || [ "$1" = "--add" ]; then - echo "add" - $DEBPATH="" + # copy deb file to repo folder structure + cp "./$2" "./apt-repo/pool/main/" + # generate package and release file + $DIR/scripts/addPackage.sh $2 && echo "debrepo: package $2 was successfully added" exit fi if [ "$1" = "del" ] || [ "$1" = "-d" ] || [ "$1" = "--del" ]; then - echo "del" - $DEBNAME="" + rm -i "./apt-repo/pool/main/$2" && echo "debrepo: package $2 was successfully removed" + exit +fi + +if [ "$1" = "list" ] || [ "$1" = "-l" ] || [ "$1" = "--list" ]; then + echo "debrepo: list of packages" + ls -l "./apt-repo/pool/main/" + exit +fi + +if [ "$1" = "serve" ] || [ "$1" = "-s" ] ||[ "$1" = "--serve" ]; then + python3 -m http.server exit fi @@ -40,6 +52,8 @@ OPTIONS: add deb package to repository del, -d, --del delete deb package from repository + serve, -s, --serve + serve repository using python built in http module help, -h, --help print help message -v, --version diff --git a/scripts/addPackage.sh b/scripts/addPackage.sh index a1c64f5..59ec7ed 100755 --- a/scripts/addPackage.sh +++ b/scripts/addPackage.sh @@ -1,12 +1,9 @@ #!/bin/sh +DIR="$(cd "$(dirname "$0")" && pwd)" -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" +cd "./apt-repo/dists/stable/" +$DIR/generate-release.sh > "Release"