Last active
March 12, 2018 17:19
-
-
Save schlomo/5467182 to your computer and use it in GitHub Desktop.
Create and maintain a DEB repo with reprepro Support GPG signing and waiting for DropBox sync. Autoconfiguration from conf/distributions
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
Some scripts to help with DEB Repo Management. | |
See http://blog.schlomo.schapiro.org/2013/04/how-to-create-debianubuntu-repository.html for how to use this. |
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
Origin: Schlomo Schapiro | |
Label: gss | |
Suite: precise | |
Codename: precise | |
Version: 12.04 | |
Architectures: i386 amd64 armel | |
Components: main | |
Description: Custom GSS packages | |
Origin: Schlomo Schapiro | |
Label: gss | |
Suite: quantal | |
Codename: quantal | |
Version: 12.10 | |
Architectures: i386 amd64 armel | |
Components: main | |
Description: Custom GSS packages | |
Origin: Schlomo Schapiro | |
Label: gss | |
Suite: raring | |
Codename: raring | |
Version: 13.04 | |
Architectures: i386 amd64 armel | |
Components: main | |
Description: Custom GSS packages |
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 | |
# copy deb files given in $* into repo and sign repo | |
# this script can be in the repo or in a directory next to the repo | |
# | |
# Written by Schlomo Schapiro based upon work by Fridtjof Busse | |
# Licensed under the GNU General Public License, see http://www.gnu.org/licenses/gpl.html for full text | |
# | |
if [[ ! "$REPREPRO_BASE_DIR" ]] ; then | |
ME_DIR="$(dirname "$(readlink -f "$0")")" | |
for CHECK_DIR in "$ME_DIR" "$ME_DIR"/../repo "$ME_DIR"/repo ; do | |
if [[ -r "$CHECK_DIR"/conf/distributions ]] ; then | |
export REPREPRO_BASE_DIR="$(readlink -f "$CHECK_DIR")" | |
break | |
fi | |
done | |
if [[ ! "$REPREPRO_BASE_DIR" ]] ; then | |
echo "Could not guess your reprepro path, please set REPREPRO_BASE_DIR" | |
exit 1 | |
fi | |
elif [[ ! -r "$REPREPRO_BASE_DIR"/conf/distributions ]] ; then | |
echo "$REPREPRO_BASE_DIR does not seem to be reprepro repo" | |
exit 1 | |
else | |
: # REPREPRO_BASE_DIR is set and a dir and contains a conf/distributions, nothing to do | |
fi | |
if [[ ! "$REPREPRO_CODENAMES" ]] ; then | |
REPREPRO_CODENAMES=( $(sed -n -E -e '/^Suite:/s/^.* //p' "$REPREPRO_BASE_DIR"/conf/distributions) ) | |
fi | |
echo "======================================================" | |
echo "Using repo path '$REPREPRO_BASE_DIR' and releases '${REPREPRO_CODENAMES[@]}'" | |
echo "======================================================" | |
WORK_DIR="$(mktemp -d)" | |
trap "rm -Rf $WORK_DIR" 0 | |
# if you sign the repo to make apt happy and not for real security then you can put the GPG stuff into | |
# the key subdir and we will use it. | |
if [[ -d "$REPREPRO_BASE_DIR"/key ]] ; then | |
echo "Using '$REPREPRO_BASE_DIR/key' for GnuPG" | |
cp -r "$REPREPRO_BASE_DIR"/key "$WORK_DIR" | |
chmod g-rwx,o-rwx -R "$WORK_DIR"/key | |
export GNUPGHOME="$WORK_DIR"/key | |
fi | |
if [[ "$1" ]] ; then | |
for parm in "$@" ; do | |
f="$(readlink -f "$parm")" # normalize file | |
if [ ! -s "$f" ]; then | |
echo "ERROR: Parameter '$parm' does not point to a readable file ($f)" | |
exit 1 | |
fi | |
echo "Adding '$f':" | |
for CODENAME in ${REPREPRO_CODENAMES[@]}; do | |
reprepro includedeb $CODENAME "$f"; | |
done | |
done | |
else | |
# if no arg was given and the repo is on DropBox then forcefully export everything and wait for DropBox sync | |
reprepro export | |
if type -p dropbox &>/dev/null && readlink -f "$REPREPRO_BASE_DIR" | grep -q Dropbox ; then | |
echo -n "Waiting for DropBox sync: " | |
while dropbox filestatus "$REPREPRO_BASE_DIR" | grep -vq "up to date" ; do | |
sleep 5 | |
echo -n "." | |
done | |
echo " OK" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment