summaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2014-07-29 21:41:05 +0100
committerColin Guthrie <colin@mageia.org>2014-07-29 21:41:05 +0100
commit67cd8e961a48ec2201a56bcfb31a6a7cc9d50b89 (patch)
tree60a95916cd39fac77c7dfefe1bd8acfdf1c76755 /functions
parent0faff56d8f465a4daac35b03008b3f47ff6ff573 (diff)
downloadmgatools-67cd8e961a48ec2201a56bcfb31a6a7cc9d50b89.tar
mgatools-67cd8e961a48ec2201a56bcfb31a6a7cc9d50b89.tar.gz
mgatools-67cd8e961a48ec2201a56bcfb31a6a7cc9d50b89.tar.bz2
mgatools-67cd8e961a48ec2201a56bcfb31a6a7cc9d50b89.tar.xz
mgatools-67cd8e961a48ec2201a56bcfb31a6a7cc9d50b89.zip
Properly scope local variables.
This is needed specifically in the case of update_hdlist() where a previous run would set the ofdeps variable which would then be reused on the next run. This is typically not a big problem but it did mean that standard media file-deps file was used when updating debug media which seems incorrect.
Diffstat (limited to 'functions')
-rw-r--r--functions21
1 files changed, 11 insertions, 10 deletions
diff --git a/functions b/functions
index 26fc6db..7f5f63c 100644
--- a/functions
+++ b/functions
@@ -25,7 +25,7 @@ fi
function isingroup()
{
- grp="$1"
+ local grp="$1"
for group in `groups`; do
[ "$grp" = "$group" ] && return 0
done
@@ -34,8 +34,8 @@ function isingroup()
function inlist()
{
- k="$1"
- list="$2"
+ local k="$1"
+ local list="$2"
for e in $list; do
[ "$k" = "$e" ] && return 0
done
@@ -66,8 +66,9 @@ function valid_subsection()
function update_hdlist()
{
- repository="$1"
- fdeps="$repository/../../media_info/file-deps"
+ local ofdeps
+ local repository="$1"
+ local fdeps="$repository/../../media_info/file-deps"
test -f "$fdeps" && ofdeps="--file-deps $fdeps"
$dryrun /usr/bin/genhdlist2 -v --versioned --allow-empty-media $ofdeps "$repository"
}
@@ -79,9 +80,9 @@ function update_distro_hdlist()
else
valid_release "$1" && valid_section "$2" && valid_subsection "$3" || return 1
fi
- release="$1"
- section="$2"
- subsection="$3"
+ local release="$1"
+ local section="$2"
+ local subsection="$3"
for arch in $arches; do
update_hdlist "$distribdir/$release/$arch/media/$section/$subsection"
@@ -92,7 +93,7 @@ function update_distro_hdlist()
function update_common_MD5SUM()
{
- release="$1"
+ local release="$1"
for arch in $arches; do
pushd "$distribdir/$release/$arch/media/media_info"
$dryrun /bin/sh -c "/usr/bin/md5sum hdlist_* synthesis.* >MD5SUM"
@@ -102,6 +103,6 @@ function update_common_MD5SUM()
function mirror_repository()
{
- release="$1"
+ local release="$1"
/usr/bin/rsync $mirror_rsync_options "$distribdir/$release/" "$finaldistribdir/$release/"
}