source: adobe-flashplugin/trunk/fuentes/update_flash.sh @ 552

Last change on this file since 552 was 552, checked in by mabarracus, 4 years ago

Fix to allow more than one match when select latest dsc

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/bash
2
3echo ""
4
5if [ "$1" = "" ];then
6
7
8        #echo "USAGE: update_flash adobe-flash-url.dsc"
9        #echo -e "\n\tDSC file can be found in http://archive.canonical.com/pool/partner/a/adobe-flashplugin/\n"
10        #exit 0
11
12        echo "* Scanning for newest version ..."
13
14        DSC_FILE=$(python -c "
15
16import urllib
17import os
18import tempfile
19
20URL='http://archive.canonical.com/pool/partner/a/adobe-flashplugin/'
21BASE_NAME='adobe-flashplugin_'
22DISTRO='15.10'
23
24fd,tmp_file=tempfile.mkstemp()
25os.close(fd)
26
27urllib.urlretrieve(URL,tmp_file)
28
29f=open(tmp_file)
30
31item_dsc=[]
32for line in f:
33        if BASE_NAME in line and DISTRO in line and \".dsc\" in line:
34                DSC_FILE=line.strip('\n').split('<a href=\"')[1].split('\">')[0]
35                item_dsc.append(URL+DSC_FILE)
36f.close()
37
38if len(item_dsc) > 1:
39    print item_dsc[-1]
40")
41       
42       
43        echo "* Using $DSC_FILE ..."
44        echo ""
45       
46       
47else
48        DSC_FILE="$1"
49       
50fi
51
52
53
54TMP_DIR=$(mktemp -d)
55
56echo "* Downloading to $TMP_DIR ... "
57
58cd $TMP_DIR
59dget -xu $DSC_FILE 1>/dev/null 2>/dev/null
60
61ADOBE_DIR=$(ls *.orig.tar.gz | cut -d / -f4 | sed -e "s%\.orig\.tar\.gz$%%g" | sed -e "s%_%-%g")
62ADOBE_VERSION=$(ls *.diff.gz | cut -d _ -f2 | sed -e "s%\.diff.gz%+lliurex1%g")
63
64echo "* Updating files..."
65
66cd - 1>/dev/null 2>/dev/null
67
68cp -r $TMP_DIR/$ADOBE_DIR/amd64/* amd64/
69cp -r $TMP_DIR/$ADOBE_DIR/i386/* i386/
70cp $TMP_DIR/$ADOBE_DIR/debian/changelog debian/changelog
71
72API_VERSION=$(cat i386/readme.txt | grep Version | cut -d " " -f2)
73
74echo "* Done updating Adobe-flashplugin Version $API_VERSION $ADOBE_VERSION"
75
76dch -b --release-heuristic trusty -v 1:$ADOBE_VERSION "Updating version to $ADOBE_VERSION"
77
78python -c "
79f=open('debian/adobe-flashplugin.postinst')
80lines=f.readlines()
81f.close()
82new_file=''
83oldv=''
84count=0
85for line in lines:
86
87        if 'sed -i' in line:
88                old_line=line
89                rule=line.split(' ')[2]
90                oldv=rule.split('%')[2]
91                newv='$API_VERSION'.replace('.','\.')
92                line=line.replace(oldv,newv)
93                               
94                if 'sed -i' not in lines[count+1]:
95                        rule=old_line.split(' ')[2]
96                        oldr=rule.split('%')[2]
97                        oldl=rule.split('%')[1]
98                        if oldr!=newv:
99                                new_line=old_line.replace(oldr,newv)
100                                new_line=new_line.replace(oldl,oldr)
101                                line+=new_line
102                                       
103        count+=1
104        new_file+=line
105
106f=open('debian/adobe-flashplugin.postinst','w')
107f.write(new_file)
108f.close()
109"
110
111echo ""
112svn st
113echo ""
114
Note: See TracBrowser for help on using the repository browser.