A little github to launchpad releaser helper script
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.8 KiB

#!/bin/bash
# launchpad-release, a little github to launchpad releaser helper script
# Author: Bandie <bandie@chaospott.de>
# Year: 2018
# License: GNU-GPL3
# github project
SOURCE="pampanic/pam_panic"
# PPA
PPA="ppa:bandie/pampanic"
if [ -z "$1" ]; then
echo "$0: Usage: $0 [ Version number to be released ]"
exit 1
fi
CODENAME="cosmic"
REVISION=1
PROJECTNAME=$(echo "$SOURCE" | cut -d'/' -f2)
PROJECTNAME_DEB=$(echo "$PROJECTNAME" | sed 's/_//g')
DIRNAME="${PROJECTNAME_DEB}_$1-${REVISION}${CODENAME}0"
FILENAME="${PROJECTNAME_DEB}_$1.orig.tar.gz"
SOURCE="https://github.com/$SOURCE/releases/download/$1/$PROJECTNAME-$1.tar.gz"
PREVVERSION=$(find . -maxdepth 1 -type d | sort -r | head -n1)
if [[ "$PREVVERSION" =~ .*$1-${REVISION}${CODENAME}.* ]]; then
rm -rf *$1-${REVISION}${CODENAME}*
PREVVERSION=$(find . -maxdepth 1 -type d | sort -r | head -n1)
fi
echo "Downloading sources from $SOURCE..."
wget "$SOURCE" -O "$FILENAME" 2> /dev/null
echo "Downloading signature from $SOURCE.asc..."
wget "$SOURCE.asc" -O "$FILENAME.asc" 2> /dev/null
gpg --verify "$FILENAME.asc" "$FILENAME" || { echo "GPG verification failed."; exit 1; }
echo -e "\nContinuing...\n"
sleep 1
echo "Extracting..."
tar xf "$FILENAME"
echo "Rename it to a debianish name..."
mv $PROJECTNAME-$1 $DIRNAME
echo "Copy debian directory from previous version ($PREVVERSION)..."
cp -r "$PREVVERSION/debian" "$DIRNAME" || { echo "Couldn't find debian dir. Exiting."; exit 1; }
echo "Please do the changelog now."
sleep 2
[[ -n $EDITOR ]] && { $EDITOR "$DIRNAME/debian/changelog"; } || { [[ -n "$(which vim)" ]] && { vim "$DIRNAME/debian/changelog"; } || { nano "$DIRNAME/debian/changelog"; }; }
echo "Running debuild -S -sa..."
cd "$DIRNAME"
debuild -S -sa
cd ..
echo "dput to Launchpad..."
dput "$PPA" "${PROJECTNAME_DEB}_$1-${REVISION}${CODENAME}0_source.changes"
echo "Done!"