feat: adding pkg by arch, some fixes
This commit is contained in:
parent
01454e6521
commit
114f053f09
31
debrepo
31
debrepo
@ -1,5 +1,5 @@
|
|||||||
#!/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
|
||||||
|
|
||||||
# set vars
|
# set vars
|
||||||
@ -31,19 +31,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
|
||||||
first_letter=$(echo "$3" | sed 's/.*\///' | cut -c 1 | tr '[:upper:]' '[:lower:]')
|
# generate package file name and copy deb file
|
||||||
pkg_name=$(echo "$3" | sed 's/.*\///' | awk -F "_" '{print $1}')
|
PKG=$3
|
||||||
mkdir -p "$REPODIR/apt-repo/pool/main/$first_letter/$pkg_name/"
|
PKG_ARCH=$(dpkg -I $PKG | grep "Architecture" | sed 's/ Architecture: //')
|
||||||
cp "$3" "$REPODIR/apt-repo/pool/main/$first_letter/$pkg_name/"
|
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"
|
||||||
|
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
|
||||||
|
|
||||||
|
@ -6,9 +6,10 @@ ARCHS="$($LS -l $REPODIR/apt-repo/dists/stable/main/ | awk '{print $9}' | awk NF
|
|||||||
|
|
||||||
# generate Packages file
|
# generate Packages file
|
||||||
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"
|
cd $REPODIR/apt-repo/
|
||||||
|
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
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user