source: lliurex-up/trunk/fuentes/LliurexUpForPool.sh @ 2968

Last change on this file since 2968 was 2968, checked in by kbut, 4 years ago

add scripts for pool

File size: 876 bytes
Line 
1#!/bin/bash
2POOLPATH=$1
3CHANGELOGSFOLDER="changelogs" 
4DEBSPATH="${POOLPATH}/pool" # /srv/mirror/prueba-changelog/pool
5TEMPFOLDERDEB=$(mktemp)
6UNCOMPRESSEDDEB="${TEMPFOLDERDEB}/deb/" #/tmp/temp654/deb
7for x in $(find $DEBSPATH -type f -printf "%P\n"); do #
8        rc=0
9        echo "$x" | grep -E -q "\.(u)?deb$" || rc=1; echo $rc
10        if [ "$rc" != "0"]; then
11                continue
12        fi
13        FOLDERDEB=$(echo $x | sed -E -e "s/_all.(u)?deb$|_i386.(u)?deb$|_amd64.(u)?deb$//g")
14        if [ ! -e "${POOLPATH}/${CHANGELOGSFOLDER}/${FOLDERDEB}" ] ; then
15                mkdir "${UNCOMPRESSEDDEB}"
16                dpkg -x "${DEBSPATH}/${x}" "${UNCOMPRESSEDDEB}"
17                CHANGELOGFILE=$(find ${UNCOMPRESSEDDEB} -name changelog.gz)
18                if [ -e ${CHANGELOGSFOLDER} ]; then
19                        AUX="${POOLPATH}/${CHANGELOGSFOLDER}/${FOLDERDEB}"
20                        mkdir -p "${AUX}"
21                        gunzip "${CHANGELOGFILE}"
22                        cp "${CHANGELOGFILE%*.gz}" "${AUX}"
23                fi
24                rm -r ${UNCOMPRESSEDDEB}
25        fi
26done
Note: See TracBrowser for help on using the repository browser.