Created
November 12, 2021 12:56
-
-
Save Vitexus/6eeeac1d0c3dfd1b9b23bfc2eddfbd41 to your computer and use it in GitHub Desktop.
Add Package to repository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TERM="xterm" | |
export TERM | |
BACKPORTS=" composer freight " | |
strstr() { | |
[ "${1#*$2*}" = "$1" ] && return 1 | |
return 0 | |
} | |
if [ -z "$(ls -A /var/tmp/deb/*.deb)" ]; then | |
echo "No packages to add in /var/tmp/deb" | |
curl -s -X POST ${BUILD_URL}stop --user vitex:118d7fdc5100a75dda72613fd24c567b1f | |
exit 0 | |
fi | |
for PACKAGE in $(ls -t /var/tmp/deb/*.deb | tac) | |
do | |
DISTRO=`echo $PACKAGE | awk -F~ '{print $2}'` | |
DEB=`basename $PACKAGE | awk -F_ '{print $1}'` | |
if [[ $BACKPORTS =~ " $DEB " ]] | |
then | |
DISTRO=$DISTRO-backports | |
fi | |
aptly repo add $DISTRO $PACKAGE | |
rm -f $PACKAGE | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment