Compare commits

...

4 Commits

Author SHA1 Message Date
4286993250 Update 'README.md' 2023-06-21 16:36:09 +02:00
5e1180f550 fix: path 2023-05-26 12:47:10 +02:00
5649296486 fix: wrong path 2023-05-19 19:53:27 +02:00
114f053f09 feat: adding pkg by arch, some fixes 2023-05-10 13:52:03 +02:00
4 changed files with 39 additions and 45 deletions

View File

@ -2,17 +2,6 @@
A Debian repository management tool. A Debian repository management tool.
## Development
__Warning! This software is still under development and is not intended for stable use.__
### Todo
- [x] finish add feature
- [x] create del feature
- [ ] multiple repositories feature
- [ ] multiple archs feature
- [x] signing repositories using GPG
- [ ] make simple way to edit repository info in release file
## About ## 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. `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.
@ -20,11 +9,13 @@ __Warning! This software is still under development and is not intended for stab
`sh` `dpkg` `gpg` `python3` `sh` `dpkg` `gpg` `python3`
## Installation ## Installation
### from deb package
- Todo
### from source ### from source
- Todo - clone this repository to some folder inside your file system
- make symlink to `/bin/`
- now you should be able to use `debrepo`
### from deb package
- *Todo*
## How to use ## How to use
``` ```

37
debrepo
View File

@ -1,6 +1,8 @@
#!/bin/sh #!/bin/sh
VERSION="1.0.0" VERSION="0.1.0"
DIR="$(cd "$(dirname "$0")" && pwd)" # location of debrepo source path #DIR="$(cd "$(dirname "$0")" && pwd)" # location of debrepo source path
SCRIPT_PATH=$(readlink -f "$0")
DIR=$(dirname "$SCRIPT_PATH")
# set vars # set vars
index=1 index=1
@ -31,19 +33,32 @@ if [ "$1" = "init" ] || [ "$1" = "-i" ] || [ "$1" = "--init" ]; then
fi fi
if [ "$1" = "add" ] || [ "$1" = "-a" ] || [ "$1" = "--add" ]; then if [ "$1" = "add" ] || [ "$1" = "-a" ] || [ "$1" = "--add" ]; then
# copy deb file to repo folder structure if [ "$2" = "--letter-based-structure" ] || [ "$2" = "-l" ]; then
if [ "$2" = "--letter-based-structure" ] || [ "$2" = "-l" ];then # generate package file name and copy deb file
first_letter=$(echo "$3" | sed 's/.*\///' | cut -c 1 | tr '[:upper:]' '[:lower:]') PKG=$3
pkg_name=$(echo "$3" | sed 's/.*\///' | awk -F "_" '{print $1}') PKG_ARCH=$(dpkg -I $PKG | grep "Architecture" | sed 's/ Architecture: //')
mkdir -p "$REPODIR/apt-repo/pool/main/$first_letter/$pkg_name/" PKG_VERSION=$(dpkg -I $PKG | grep "Version" | sed 's/ Version: //')
cp "$3" "$REPODIR/apt-repo/pool/main/$first_letter/$pkg_name/" PKG_NAME=$(echo "$PKG" | sed 's/.*\///' | awk -F "_" '{print $1}')
PKG_FULLNAME="${PKG_NAME}_${PKG_VERSION}_${PKG_ARCH}.deb"
FIRST_LETTER=$(echo "$PKG" | sed 's/.*\///' | cut -c 1 | tr '[:upper:]' '[:lower:]')
PKG_PATH="$REPODIR/apt-repo/pool/main/$FIRST_LETTER/$PKG_NAME/$PKG_FULLNAME"
mkdir -p "$REPODIR/apt-repo/pool/main/$FIRST_LETTER/$PKG_NAME/"
cp $PKG $PKG_PATH
else else
cp "$2" "$REPODIR/apt-repo/pool/main/" # generate package file name and copy deb file
PKG=$2
PKG_ARCH=$(dpkg -i $PKG | grep "Architecture" | sed 's/ Architecture: //')
PKG_VERSION=$(dpkg -I $PKG | grep "Version" | sed 's/ Version: //')
PKG_NAME=$(echo "$PKG" | sed 's/.*\///' | awk -F "_" '{print $1}')
PKG_FULLNAME="${$PKG_NAME}_${PKG_VERSION}_${PKG_ARCH}.deb"
cp $PKG "$REPODIR/apt-repo/pool/main/$PKG_FULNAME"
fi fi
# generate package and release file # generate package and release file
$DIR/scripts/genPkgRel.sh $REPODIR $2 && echo "debrepo: package $2 was successfully added" $DIR/scripts/genPkgRel.sh $REPODIR && echo "debrepo: package $PKG_FULLNAME was successfully added"
$DIR/scripts/gpgSign.sh $REPODIR $GPG && echo "debrepo: repo was succesfully signed" $DIR/scripts/gpgSign.sh $REPODIR && echo "debrepo: repo was succesfully signed"
exit exit
fi fi

View File

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

View File

@ -2,21 +2,6 @@
REPODIR="$1" REPODIR="$1"
. $REPODIR/apt-repo/config . $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 if [ ! $DEFAULT_GPG ]; then
echo "error: no gpg key provided in config file" echo "error: no gpg key provided in config file"
exit 1 exit 1