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

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

build icon touch

  • Property svn:executable set to *
File size: 2.2 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        PACKAGESOURCENAME="$2"
11       
12
13        CHANGELOGFILE=$(find ${UNCOMPRESSEDDEB} -name changelog.Debian.gz)
14        test -e "${CHANGELOGFILE}" || CHANGELOGFILE=$(find ${UNCOMPRESSEDDEB} -name changelog.gz)
15        if [ -e "${CHANGELOGFILE}" ]; then
16                mkdir -p "${DESTPATH}"
17                gunzip "${CHANGELOGFILE}" || echo "${CHANGELOGFILE}"
18                cp "${CHANGELOGFILE%*.gz}" "${DESTPATH}/changelog"
19        else
20                PACKAGE="$(basename $DESTPATH)"
21                echo "Fail on $PACKAGE"
22        fi
23        mkdir -p "${DESTPATH}/token/"
24        touch "${DESTPATH}/token/${PACKAGESOURCENAME}.changelog"
25}
26
27function buildDesktopInfo(){
28        DESTPATH="$1"
29        PACKAGENAME="$2"
30        DESKTOPFILES=$(find ${UNCOMPRESSEDDEB} -name *.desktop)
31        if [ -e "${DESTPATH}/icons" ]; then
32                sed -i -e "/^$PACKAGENAME :/d" ${DESTPATH}/icons
33        fi
34        ICONS=""
35        for x in ${DESKTOPFILES}; do
36                AUX="$(rgrep -i 'Icon=' $x | sed -e '')"
37                if [ "$AUX" != "" ]; then
38                        echo "${PACKAGENAME} : $AUX" >> ${DESTPATH}/icons
39                fi
40        done
41        mkdir -p "${DESTPATH}/token/"
42        touch "${DESTPATH}/token/${PACKAGENAME}.icons"
43}
44
45
46for x in $(find $DEBSPATH -type f -printf "%P\n"); do #
47        rc=0
48        echo "$x" | grep -E -q "\.deb$" || rc=1 
49        if [ "$rc" != "0" ]; then
50                continue
51        fi
52        #FOLDERDEB=$(echo $x | sed -E -e "s/_all.deb$|_i386.deb$|_amd64.deb$//g")
53        FOLDERDEB=$(dirname $x)
54        PACKAGESOURCENAME=$(getinfofromdeb ${DEBSPATH}/$x '${Source}_${VersionWithoutEra}')
55        PACKAGENAME=$(getinfofromdeb ${DEBSPATH}/$x '${Package}')
56        if [ "${PACKAGESOURCENAME}" = "" ]; then
57                echo "Falla"
58                continue
59        fi
60        DESTPATH="${POOLPATH}/${CHANGELOGSFOLDER}/pool/${FOLDERDEB}/${PACKAGESOURCENAME}"
61        if [ ! -e "${DESTPATH}/token/${PACKAGESOURCENAME}.changelog" -o ! -e "${DESTPATH}/token/${PACKAGENAME}.icons" ] ; then
62                mkdir "${UNCOMPRESSEDDEB}"
63                dpkg -x "${DEBSPATH}/${x}" "${UNCOMPRESSEDDEB}"
64                [ -e "${DESTPATH}/token/${PACKAGESOURCENAME}.changelog" ] || buildChangelog $DESTPATH $PACKAGESOURCENAME
65                [ -e "${DESTPATH}/token/${PACKAGENAME}.icons" ] || buildDesktopInfo $DESTPATH $PACKAGENAME
66                rm -r ${UNCOMPRESSEDDEB}
67        fi
68done
69
Note: See TracBrowser for help on using the repository browser.