Compare commits
	
		
			1 Commits
		
	
	
		
			main
			...
			feat/distr
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| d3f1349838 | 
							
								
								
									
										17
									
								
								debrepo
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								debrepo
									
									
									
									
									
								
							@@ -5,7 +5,6 @@ DIR="$(cd "$(dirname "$0")" && pwd)" # location of debrepo source path
 | 
				
			|||||||
# set vars
 | 
					# set vars
 | 
				
			||||||
index=1
 | 
					index=1
 | 
				
			||||||
for arg in $@; do
 | 
					for arg in $@; do
 | 
				
			||||||
	# set REPODIR variable
 | 
					 | 
				
			||||||
	if [ $arg = "--repodir" ]; then
 | 
						if [ $arg = "--repodir" ]; then
 | 
				
			||||||
		ARGID="$((index+1))"
 | 
							ARGID="$((index+1))"
 | 
				
			||||||
		eval "REPODIR=\$$ARGID"
 | 
							eval "REPODIR=\$$ARGID"
 | 
				
			||||||
@@ -16,6 +15,11 @@ for arg in $@; do
 | 
				
			|||||||
		eval "GPG=\$$ARGID"
 | 
							eval "GPG=\$$ARGID"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if [ $arg = "--distro" ]; then
 | 
				
			||||||
 | 
							ARGID="$((index+1))"
 | 
				
			||||||
 | 
							eval "DISTRO=\$$ARGID"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	index=$((index+1))
 | 
						index=$((index+1))
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -31,6 +35,13 @@ 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
 | 
				
			||||||
 | 
						# if distro specific package
 | 
				
			||||||
 | 
						if [ "$DISTRO" ]; then
 | 
				
			||||||
 | 
							echo "distro: $DISTRO"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							exit
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
						exit
 | 
				
			||||||
	# copy deb file to repo folder structure
 | 
						# 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:]')
 | 
							first_letter=$(echo "$3" | sed 's/.*\///' | cut -c 1 | tr '[:upper:]' '[:lower:]')
 | 
				
			||||||
@@ -42,8 +53,8 @@ if [ "$1" = "add" ] || [ "$1" = "-a" ] || [ "$1" = "--add" ]; then
 | 
				
			|||||||
	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 $2 $DISTRO  && echo "debrepo: package $2 was successfully added"
 | 
				
			||||||
	$DIR/scripts/gpgSign.sh $REPODIR $GPG && echo "debrepo: repo was succesfully signed"
 | 
						$DIR/scripts/gpgSign.sh $REPODIR $GPG $DISTRO && echo "debrepo: repo was succesfully signed"
 | 
				
			||||||
	exit
 | 
						exit
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,17 +1,22 @@
 | 
				
			|||||||
#!/bin/sh
 | 
					#!/bin/sh
 | 
				
			||||||
DIR="$(cd "$(dirname "$0")" && pwd)"
 | 
					 | 
				
			||||||
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
 | 
				
			||||||
 | 
					DIR="$(cd "$(dirname "$0")" && pwd)"
 | 
				
			||||||
REPODIR="$1"
 | 
					REPODIR="$1"
 | 
				
			||||||
ARCHS="$($LS -l $REPODIR/apt-repo/dists/stable/main/ | awk '{print $9}' | awk NF | awk -F - '{print $2}')"
 | 
					DISTRO="$3"
 | 
				
			||||||
 | 
					if [ !$DISTRO ]; then
 | 
				
			||||||
 | 
						DISTRO="stable"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ARCHS="$($LS -l $REPODIR/apt-repo/dists/$DISTRO/main/ | awk '{print $9}' | awk NF | awk -F - '{print $2}')"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 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"
 | 
						dpkg-scanpackages --multiversion --arch $ARCH "$REPODIR/apt-repo/pool/" > "$REPODIR/apt-repo/dists/$DISTRO/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 "$REPODIR/apt-repo/dists/$DISTRO/main/binary-$ARCH/Packages" | gzip -9 > "$REPODIR/apt-repo/dists/$DISTRO/main/binary-$ARCH/Packages.gz"
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# generate Release file
 | 
					# generate Release file
 | 
				
			||||||
cd "$REPODIR/apt-repo/dists/stable/"
 | 
					cd "$REPODIR/apt-repo/dists/$DISTRO/"
 | 
				
			||||||
$DIR/generate-release.sh > "Release"
 | 
					$DIR/generate-release.sh $DISTRO > "Release"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,15 @@
 | 
				
			|||||||
set -e
 | 
					set -e
 | 
				
			||||||
. ../../config # this file is in /apt-repo/config
 | 
					. ../../config # this file is in /apt-repo/config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ ! $DISTRO ]; then
 | 
				
			||||||
 | 
						DISTRO="stable"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ ! -f "../../config" ]; then
 | 
				
			||||||
 | 
						echo "error - config file does not exists"
 | 
				
			||||||
 | 
						exit 1;
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
do_hash() {
 | 
					do_hash() {
 | 
				
			||||||
    HASH_NAME=$1
 | 
					    HASH_NAME=$1
 | 
				
			||||||
    HASH_CMD=$2
 | 
					    HASH_CMD=$2
 | 
				
			||||||
@@ -15,17 +24,11 @@ do_hash() {
 | 
				
			|||||||
    done
 | 
					    done
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ ! -f "../../config" ]; then
 | 
					 | 
				
			||||||
	echo "error - config file does not exists"
 | 
					 | 
				
			||||||
	exit 1;
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
cat << EOF
 | 
					cat << EOF
 | 
				
			||||||
Origin: $ORIGIN
 | 
					Origin: $ORIGIN
 | 
				
			||||||
Label: $LABEL
 | 
					Label: $LABEL
 | 
				
			||||||
Suite: $SUITE
 | 
					Suite: $SUITE
 | 
				
			||||||
Codename: $CODENAME
 | 
					Codename: $DISTRO
 | 
				
			||||||
Version: $VERSION
 | 
					Version: $VERSION
 | 
				
			||||||
Architectures: $ARCHITECTURES
 | 
					Architectures: $ARCHITECTURES
 | 
				
			||||||
Components: $COMPONENTS
 | 
					Components: $COMPONENTS
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,21 +1,11 @@
 | 
				
			|||||||
#!/bin/sh
 | 
					#!/bin/sh
 | 
				
			||||||
REPODIR="$1"
 | 
					REPODIR="$1"
 | 
				
			||||||
 | 
					DISTRO="$3"
 | 
				
			||||||
. $REPODIR/apt-repo/config
 | 
					. $REPODIR/apt-repo/config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#KEY="$2"
 | 
					if [ ! $DISTRO ]; then
 | 
				
			||||||
#echo $KEY
 | 
						DISTRO="stable"
 | 
				
			||||||
#if [ $KEY = "--repodir" ]; then
 | 
					fi
 | 
				
			||||||
#	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"
 | 
				
			||||||
@@ -23,10 +13,8 @@ if [ ! $DEFAULT_GPG ]; then
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
KEY=$DEFAULT_GPG
 | 
					KEY=$DEFAULT_GPG
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
echo "debrepo: signing using $KEY"
 | 
					echo "debrepo: signing using $KEY"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cat $REPODIR/apt-repo/dists/stable/Release | gpg --default-key $KEY -abs > $REPODIR/apt-repo/dists/stable/Release.gpg
 | 
					cat $REPODIR/apt-repo/dists/$DISTRO/Release | gpg --default-key $KEY -abs > $REPODIR/apt-repo/dists/$DISTRO/Release.gpg
 | 
				
			||||||
cat $REPODIR/apt-repo/dists/stable/Release | gpg --default-key $KEY -abs --clearsign > $REPODIR/apt-repo/dists/stable/InRelease
 | 
					cat $REPODIR/apt-repo/dists/$DISTRO/Release | gpg --default-key $KEY -abs --clearsign > $REPODIR/apt-repo/dists/$DISTRO/InRelease
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,3 +9,21 @@ fi
 | 
				
			|||||||
mkdir -p $1/apt-repo/dists/stable/main/binary-amd64/
 | 
					mkdir -p $1/apt-repo/dists/stable/main/binary-amd64/
 | 
				
			||||||
mkdir -p $1/apt-repo/pool/main/
 | 
					mkdir -p $1/apt-repo/pool/main/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# make config file
 | 
				
			||||||
 | 
					echo \
 | 
				
			||||||
 | 
					"#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Repository preferences
 | 
				
			||||||
 | 
					DEFAULT_GPG=\"\"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Repository info
 | 
				
			||||||
 | 
					ORIGIN=\"example.com\"
 | 
				
			||||||
 | 
					LABEL=\"example repository\"
 | 
				
			||||||
 | 
					SUITE=\"stable\"
 | 
				
			||||||
 | 
					CODENAME=\"stable\"
 | 
				
			||||||
 | 
					VERSION=\"1.0\"
 | 
				
			||||||
 | 
					ARCHITECTURES=\"amd64\"
 | 
				
			||||||
 | 
					COMPONENTS=\"main\"
 | 
				
			||||||
 | 
					DESCRIPTION=\"example repository\"
 | 
				
			||||||
 | 
					" > $1/apt-repo/config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user