-
Notifications
You must be signed in to change notification settings - Fork 0
/
fresh.sh
executable file
·40 lines (25 loc) · 1.48 KB
/
fresh.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
PACKAGE="flexibee-client"
LATEST_PAGE_URL="https://www.flexibee.eu/podpora/stazeni-flexibee/stazeni-ekonomickeho-systemu-flexibee-linux/"
CURRENT_FLEXIBEE_VERSION=$(curl -s $LATEST_PAGE_URL | grep -oP 'flexibee-client_\K\d+\.\d+\.\d+' | sort -V | tail -n 1)
CURRENT_FLEXIBEE_VERSION_YEAR=$(echo $CURRENT_FLEXIBEE_VERSION | cut -d. -f1)
CURRENT_FLEXIBEE_VERSION_MAJOR=$(echo $CURRENT_FLEXIBEE_VERSION | cut -d. -f2)
LATESTPKG="flexibee-client_${CURRENT_FLEXIBEE_VERSION}_all.deb"
DOWNLOAD_URL="https://download.flexibee.eu/download/$CURRENT_FLEXIBEE_VERSION_YEAR.$CURRENT_FLEXIBEE_VERSION_MAJOR/$CURRENT_FLEXIBEE_VERSION/$LATESTPKG"
#REVISION=`cat debian/revision | perl -ne 'chomp; print join(".", splice(@{[split/\./,$_]}, 0, -1), map {++$_} pop @{[split/\./,$_]}), "\n";'`
echo XXXXXXXXXXXXXXXXXXXXXXXXXX Preparing $PACKAGE version $CURRENT_FLEXIBEE_VERSION
mkdir -p origin
# Find all deb files in different versions than $CURRENT_FLEXIBEE_VERSION and delete them
find origin -name "flexibee-client_*.deb" ! -name "flexibee-client_${CURRENT_FLEXIBEE_VERSION}_all.deb" -exec rm -f {} +
if [ ! -f origin/${LATESTPKG} ]; then
curl $DOWNLOAD_URL -o origin/${LATESTPKG}
fi
cd origin
ar -x ${LATESTPKG}
tar xzf control.tar.gz
tar xzf data.tar.gz
cd ..
#CHANGES=`git log -n 1 | tail -n+5`
CHANGES="Build ${CURRENT_FLEXIBEE_VERSION}"
dch -b -v $CURRENT_FLEXIBEE_VERSION --package $PACKAGE $CHANGES
echo XXXXXXXXXXXXXXXXXXXXXXXXXX Ready for build - $PACKAGE version $CURRENT_FLEXIBEE_VERSION