Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix the rotation to actually keep more than the current + 1. Defaults to 7 right now.
Brad Davis committed 10 years ago
commit 49518afa6c3ccf2b3a0c446e86cd286197d7b1e5
parent 9b2b1dc
1 file changed +13 -2
modified scripts/periodic/411.pkg-backup.in
@@ -20,8 +20,19 @@ backup_pkg() {
	local bak_file="$2"
	local rc

-
	[ -e "${bak_file}" ] && \
-
		mv -f "${bak_file}" "${bak_file}.2"
+
	local count="${daily_backup_pkg_count:-7}"
+
	local lower=$(expr ${count} - 1)
+
	for i in $(jot ${count} ${lower} 0); do
+
		local higher=$(expr ${i} + 1)
+
		local file
+
		if [ ${i} == 0 ]; then
+
			file=${bak_file}
+
		else
+
			file=${bak_file}.${i}
+
		fi
+
		[ -e "${file}" ] && \
+
			mv -f "${file}" "${bak_file}.${higher}"
+
	done

	if do_dump | xz -c > ${bak_file}; then
		rc=0