Commit 20caf2bf authored by Diego Pasqualin's avatar Diego Pasqualin
Browse files

update_mirror.sh: Ask about adding packages that doesn't exist


Signed-off-by: default avatarDiego Pasqualin <dpasqualin@c3sl.ufpr.br>
parent 02de43a0
......@@ -56,6 +56,14 @@ function askUpdate() {
test "$yn" = "y" || test "$yn" = "s"
}
function askInclude() {
local repo=$1
local pkg=$2
local version=$4
read -p "$pkg-$version doesn't exist on le5-$repo, include it (y/N)? " yn
test "$yn" = "y" || test "$yn" = "s"
}
function getDownloadLink() {
local pkg=$1
local link=$(grep -m1 "Filename:.*${pkg}.*" $FROMREPOFILE | awk '{print $2}')
......@@ -111,25 +119,26 @@ toPkgAndVersion="$(getPackagesAndVersions $TOREPOFILE)"
for pkgVersionFrom in $fromPkgAndVersion; do
pkgFrom=$(echo $pkgVersionFrom | cut -d: -f1)
versionFrom=$(echo $pkgVersionFrom | cut -d: -f2)
found=false
for pkgVersionTo in $toPkgAndVersion; do
pkgTo=$(echo $pkgVersionTo | cut -d: -f1)
if test $pkgFrom = $pkgTo; then
versionTo=$(echo $pkgVersionTo | cut -d: -f2)
found=true
if dpkg --compare-versions $versionFrom gt $versionTo; then
if askUpdate $TOREPO $pkgTo $versionFrom $versionTo; then
doUpdate $pkgTo
if test $? -ne 0; then
exit 1
fi
break
fi
elif dpkg --compare-versions $versionFrom gt $versionTo; then
echo -n "WARNING: $pkgFrom($versionFrom) in $FROMREPO is"
echo " greater than $pkgTo($versionTo) in $TOREPO."
break
fi
break
fi
done
if ! $found && askInclude $TOREPO $pkgTo $versionTo; then
doUpdate $pkgTo
fi
done
rm -rf $TMPDIR
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment