Skip to content
Snippets Groups Projects
Commit cdcc2bc5 authored by intrigeri's avatar intrigeri
Browse files

Do arithmetic using bash rather than bc (Closes: #603173)

parent d9f2fca0
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,7 @@ version 0.9.9 -- UNRELEASED ...@@ -34,6 +34,7 @@ version 0.9.9 -- UNRELEASED
rsync: rsync:
. Fix long rotation. . Fix long rotation.
. Make units clearer (Closes Redmine bug #2737) . Make units clearer (Closes Redmine bug #2737)
. Do arithmetic using bash rather than bc (Closes: #603173)
helper changes helper changes
dup: dup:
. Fix separate signing key usecase. Thanks to Ian Beckwith for . Fix separate signing key usecase. Thanks to Ian Beckwith for
......
...@@ -253,7 +253,7 @@ function eval_config { ...@@ -253,7 +253,7 @@ function eval_config {
if [ -z "$days" ]; then if [ -z "$days" ]; then
keep="4" keep="4"
else else
keep="`echo $days - 1 | bc -l`" keep=$[$days - 1]
fi fi
fi fi
...@@ -302,9 +302,9 @@ function rotate_short { ...@@ -302,9 +302,9 @@ function rotate_short {
$nice $mv /$folder.$keep /$folder.tmp $nice $mv /$folder.$keep /$folder.tmp
fi fi
for ((n=`echo "$keep - 1" | bc`; n >= 0; n--)); do for ((n=$[$keep - 1]; n >= 0; n--)); do
if [ -d $folder.$n ]; then if [ -d $folder.$n ]; then
dest=`echo "$n + 1" | bc` dest=$[$n + 1]
$nice $mv /$folder.$n /$folder.$dest $nice $mv /$folder.$n /$folder.$dest
$touch /$folder.$dest $touch /$folder.$dest
mkdir -p $metadata/`basename $folder`.$dest mkdir -p $metadata/`basename $folder`.$dest
......
...@@ -88,9 +88,9 @@ function rotate { ...@@ -88,9 +88,9 @@ function rotate {
$nice $mv /$1.$2 /$1.tmp $nice $mv /$1.$2 /$1.tmp
fi fi
for ((n=`echo "$2 - 1" | bc`; n >= 0; n--)); do for ((n=$[$2 - 1]; n >= 0; n--)); do
if [ -d $1.$n ]; then if [ -d $1.$n ]; then
dest=`echo "$n + 1" | bc` dest=$[$n + 1]
$nice $mv /$1.$n /$1.$dest $nice $mv /$1.$n /$1.$dest
$touch /$1.$dest $touch /$1.$dest
fi fi
...@@ -128,7 +128,7 @@ fi ...@@ -128,7 +128,7 @@ fi
if [ -z "$days" ]; then if [ -z "$days" ]; then
keep="4" keep="4"
else else
keep="`echo $days - 1 | bc -l`" keep=$[$days - 1]
fi fi
# lockfile setup # lockfile setup
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment