summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-02-12 02:14:09 +0000
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-02-12 02:14:09 +0000
commitb30bce128f621bf63d865643bbb1ff0752d099de (patch)
treec6a0aa580855e9658ebb228637fa43cf1b58854d
parent11a35680c564d36f09b582eeaba976674784e64f (diff)
downloadmidipix_build-b30bce128f621bf63d865643bbb1ff0752d099de.tar.bz2
midipix_build-b30bce128f621bf63d865643bbb1ff0752d099de.tar.xz
etc/rotate_archives.sh: removed.
-rwxr-xr-xetc/rotate_archives.sh57
1 files changed, 0 insertions, 57 deletions
diff --git a/etc/rotate_archives.sh b/etc/rotate_archives.sh
deleted file mode 100755
index f0bbe100..00000000
--- a/etc/rotate_archives.sh
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/sh
-
-glob() { set +o noglob; echo ${@}; set -o noglob; };
-map() { local _ifs="${IFS}" _sep="${1}"; shift; IFS="${_sep}"; echo "${*}"; IFS="${_ifs}"; };
-rc() { echo "${@}"; "${@}"; };
-
-rotate_build() {
- local _build_dname="${1}" _hostname="${2}" _limit="${3}";
- local _dist_dates="";
- for _dist_fname in $(glob \
- ${_build_dname}/*.tar.* \
- ${_build_dname}/*.zip \
- ${_build_dname}/*.zip.*); do
- if [ -e "${_dist_fname}" ]; then
- _dist_date="${_dist_fname#*@${_hostname}-}";
- _dist_date="${_dist_date%.tar.*}";
- _dist_date="${_dist_date%.zip}";
- _dist_date="${_dist_date%.zip.*}";
- _dist_date="${_dist_date%-[0-9][0-9]-[0-9][0-9]-[0-9][0-9]}";
- _dist_dates="${_dist_dates:+${_dist_dates} }${_dist_date}";
- fi;
- done;
- if [ -n "${_dist_dates}" ]; then
- rotate_build_dates "${_build_dname}" "${_dist_dates}" "${_limit}";
- fi;
-};
-
-rotate_build_dates() {
- local _build_dname="${1}" _dist_dates="${2}" _limit="${3}";
- local _dist_dates_count="" _dist_dates_count_limit="" _dist_fname="" _nl="
-"; _dist_dates="$(map "${_nl}" ${_dist_dates} | sort | uniq)";
- _dist_dates_count="$(echo "${_dist_dates}" | wc -l)";
- if [ "${_dist_dates_count}" -gt "${_limit}" ]; then
- _dist_dates_count_limit=$((${_dist_dates_count}-${_limit}));
- _dist_dates="$(echo "${_dist_dates}" |\
- sed -n "1,${_dist_dates_count_limit}p")";
- for _dist_date in ${_dist_dates}; do
- for _dist_fname in $(glob \
- ${_build_dname}/*-${_dist_date}-*.tar.xz*); do
- rc rm -f "${_dist_fname}";
- done;
- done;
- fi;
-};
-
-rotate_builds() {
- local _build_dnames="${1}" _limit="${2}";
- local _hostname="$(hostname)";
- for _build_dname in ${_build_dnames}; do
- rotate_build "${_build_dname}" "${_hostname}" "${_limit}";
- done;
-};
-
-set -o errexit -o noglob;
-rotate_builds "${1}" "${2:-3}";
-
-# vim:noexpandtab sw=8 ts=8