diff options
Diffstat (limited to '')
-rwxr-xr-x | bin/pmove.sh | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/bin/pmove.sh b/bin/pmove.sh new file mode 100755 index 0000000..a3e18c5 --- /dev/null +++ b/bin/pmove.sh @@ -0,0 +1,144 @@ +#!/bin/sh + +set -e + +case "$(basename ${0})" in + p*) + MODE="progress-linux" + ;; + + b*) + MODE="bfh" + ;; +esac + +CURDIR="${PWD}" + +HOST="$(hostname -f)" +UPLOAD="/srv/${HOST}/upload" + +for ARCHITECTURE in amd64 arm64 armel armhf i386 all +do + if ! ls ${UPLOAD}/*_${ARCHITECTURE}.changes > /dev/null 2>&1 + then + continue + fi + + CHANGES="$(ls ${UPLOAD}/*_${ARCHITECTURE}.changes)" + + PACKAGE="$(basename ${CHANGES} .changes | awk -F_ '{ print $1 }')" + + if [ "$(basename ${PWD})" != "${PACKAGE}" ] + then + mkdir -p "${PACKAGE}" + cd "${PACKAGE}" + fi + + VERSION="$(grep -m1 '^Version: ' ${CHANGES} | awk '{ print $2 }')" + + SOURCE_VERSION="$(echo ${VERSION} | awk -F: '{ print $2 }')" + SOURCE_VERSION="${SOURCE_VERSION:-${VERSION}}" + + UPSTREAM_VERSION="$(echo ${SOURCE_VERSION} | awk -F- '{ $NF=""; print $0 }' | sed -e 's| |-|g' -e 's|-$||')" + + mkdir "${VERSION}_${ARCHITECTURE}" + + cd "${VERSION}_${ARCHITECTURE}" + + if ls ${UPLOAD}/*_${ARCHITECTURE}.deb > /dev/null 2>&1 + then + mv ${UPLOAD}/*_${ARCHITECTURE}.deb . + fi + if ls ${UPLOAD}/*_${ARCHITECTURE}.udeb > /dev/null 2>&1 + then + mv ${UPLOAD}/*_${ARCHITECTURE}.udeb . + fi + if ls ${UPLOAD}/*_${ARCHITECTURE}.buildinfo > /dev/null 2>&1 + then + mv ${UPLOAD}/*_${ARCHITECTURE}.buildinfo . + + # FIXING buildinfo file + sed -i -e '/^ DEB_BUILD_OPTIONS="/d' \ + -e 's|^ LANG="en_US.UTF-8"| LANG="C.UTF-8"|' \ + *_${ARCHITECTURE}.buildinfo + fi + mv ${UPLOAD}/*_${ARCHITECTURE}.changes . + reprepro_fix-changes.sh *_${ARCHITECTURE}.changes + + case "${MODE}" in + progress-linux) + psign.sh + ;; + + bfh) + bsign.sh + ;; + esac + + cd .. + rm -f current_${ARCHITECTURE} + ln -s "${VERSION}_${ARCHITECTURE}" current_${ARCHITECTURE} + + cd "${CURDIR}" +done + +for DSC in ${UPLOAD}/*.dsc +do + if [ ! -e "${DSC}" ] + then + break + fi + + PACKAGE="$(basename ${DSC} .dsc | awk -F_ '{ print $1 }')" + + if [ "$(basename ${PWD})" != "${PACKAGE}" ] + then + mkdir -p "${PACKAGE}" + cd "${PACKAGE}" + fi + + VERSION="$(grep -m1 '^Version: ' ${DSC} | awk '{ print $2 }')" + + SOURCE_VERSION="$(echo ${VERSION} | awk -F: '{ print $2 }')" + SOURCE_VERSION="${SOURCE_VERSION:-${VERSION}}" + + UPSTREAM_VERSION="$(echo ${SOURCE_VERSION} | awk -F- '{ $NF=""; print $0 }' | sed -e 's| |-|g' -e 's|-$||')" + + mkdir "${VERSION}_source" + + cd "${VERSION}_source" + + if ls ../orig/${PACKAGE}_${UPSTREAM_VERSION}.orig.tar.xz > /dev/null 2>&1 + then + ln -s ../orig/${PACKAGE}_${UPSTREAM_VERSION}.orig.tar.xz ./ + fi + + mv ${UPLOAD}/*.dsc . + mv ${UPLOAD}/*.orig.tar.xz . + mv ${UPLOAD}/*.debian.tar.xz . + + case "${MODE}" in + progress-linux) + psign.sh + ;; + + bfh) + bsign.sh + ;; + esac + + if ls ${PACKAGE}_${UPSTREAM_VERSION}.orig.tar.xz > /dev/null 2>&1 && \ + [ ! -h "${PACKAGE}_${UPSTREAM_VERSION}.orig.tar.xz" ] + then + mkdir -p ../orig + + mv "$(ls ${PACKAGE}_${UPSTREAM_VERSION}.orig.tar.*)" ../orig + ln -s $(ls ../orig/${PACKAGE}_${UPSTREAM_VERSION}.orig.tar.*) ./ + fi + + cd .. + rm -f current_source + ln -s "${VERSION}_source" current_source + + cd "${CURDIR}" +done |