source: lliurex-up/trunk/fuentes/lliurex-up-pool-scripts/usr/bin/runpart-from-repository @ 2970

Last change on this file since 2970 was 2970, checked in by kbut, 3 years ago

add package lliurex-up-pool-tools

  • Property svn:executable set to *
File size: 1.5 KB
Line 
1#!/bin/bash
2POOLPATH=$1
3CHANGELOGSFOLDER="changelogs" 
4DEBSPATH="${POOLPATH}/pool" # /srv/mirror/prueba-changelog/pool
5TEMPFOLDERDEB=$(mktemp -d)
6UNCOMPRESSEDDEB="${TEMPFOLDERDEB}/deb/" #/tmp/temp654/deb
7
8function buildChangelog(){
9        DESTPATH="$1"
10        CHANGELOGFILE=$(find ${UNCOMPRESSEDDEB} -name changelog.Debian.gz)
11        test -e "${CHANGELOGFILE}" || CHANGELOGFILE=$(find ${UNCOMPRESSEDDEB} -name changelog.gz)
12        if [ -e "${CHANGELOGFILE}" ]; then
13                mkdir -p "${DESTPATH}"
14                gunzip "${CHANGELOGFILE}" || echo "${CHANGELOGFILE}"
15                cp "${CHANGELOGFILE%*.gz}" "${DESTPATH}/changelog"
16        else
17                PACKAGE="$(basename $DESTPATH)"
18                echo "Fail on $PACKAGE"
19        fi
20}
21
22function buildDesktopInfo(){
23        DESTPATH="$1"
24        DESKTOPFILES=$(find ${UNCOMPRESSEDDEB} -name *.desktop)
25        ICONS=""
26        for x in ${DESKTOPFILES}; do
27                AUX="$(rgrep -i 'Icon=' $x | sed -e '')"
28                ICONS="${ICONS}\n${AUX}"
29        done
30}
31
32
33for x in $(find $DEBSPATH -type f -printf "%P\n"); do #
34        rc=0
35        echo "$x" | grep -E -q "\.deb$" || rc=1
36        if [ "$rc" != "0" ]; then
37                continue
38        fi
39        #FOLDERDEB=$(echo $x | sed -E -e "s/_all.deb$|_i386.deb$|_amd64.deb$//g")
40        FOLDERDEB=$(dirname $x)
41        PACKAGESOURCENAME=$(getinfofromdeb ${DEBSPATH}/$x '$Source')
42        if [ "${PACKAGESOURCENAME}" = "" ]; then
43                echo "Falla"
44                continue
45        fi
46        DESTPATH="${POOLPATH}/${CHANGELOGSFOLDER}/pool/${FOLDERDEB}/${PACKAGESOURCENAME}"
47        if [ ! -e "${DESTPATH}" ] ; then
48                mkdir "${UNCOMPRESSEDDEB}"
49                dpkg -x "${DEBSPATH}/${x}" "${UNCOMPRESSEDDEB}"
50                buildChangelog $DESTPATH
51                rm -r ${UNCOMPRESSEDDEB}
52        fi
53done
54
Note: See TracBrowser for help on using the repository browser.