summaryrefslogtreecommitdiff
path: root/bin/common-functions
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-06-14 16:11:08 +0200
committerErich Eckner <git@eckner.net>2017-06-14 16:11:08 +0200
commit6c9ef1ccaca1763d6a9e46c71ed9c67f6139c5bc (patch)
treee1d1bf6f08fc8d0c6486bed5590fda3d1f9b3946 /bin/common-functions
parentf25f9462a68a968a676d555613cdfa6e7516cad1 (diff)
downloadbuilder-6c9ef1ccaca1763d6a9e46c71ed9c67f6139c5bc.tar.xz
remove bashisms - only "bash arrays" and "bash string substituions" left
Diffstat (limited to 'bin/common-functions')
-rwxr-xr-xbin/common-functions23
1 files changed, 21 insertions, 2 deletions
diff --git a/bin/common-functions b/bin/common-functions
index d954a36..c3301f0 100755
--- a/bin/common-functions
+++ b/bin/common-functions
@@ -23,7 +23,7 @@ find_pkgbuild() {
fi
for repo in "${!repo_paths[@]}"; do
- if [ "${repo}" == "archlinux32" ]; then
+ if [ "${repo}" = "archlinux32" ]; then
# this is not a repository of packages
continue
fi
@@ -112,7 +112,7 @@ find_git_repository_to_package_repository() {
local repository
for repository in "${!repo_paths[@]}"; do
- if [ "${repository}" == "archlinux32" ]; then
+ if [ "${repository}" = "archlinux32" ]; then
continue
fi
if [ -n "$(
@@ -304,3 +304,22 @@ remove_old_package_versions() {
xargs -rn1 rm
}
+
+# wait_some_time $minimum $maximum-$minimum
+wait_some_time() {
+ local minimum=$1
+ local diff=$2
+ local random
+
+ if [ -z "${diff}" ]; then
+ diff=30
+ fi
+
+ random="$(
+ dd if='/dev/urandom' count=1 2> /dev/null | \
+ cksum | \
+ cut -d' ' -f1
+ )"
+
+ sleep $((${minimum} + ${random} % ${diff}))
+}