add a script to copy everything to testing

This commit is contained in:
Mario Fetka 2014-11-15 21:28:17 +01:00
parent 2c0f743a6f
commit f77ab1bec2
2 changed files with 70 additions and 1 deletions

69
bin/opsi-all-testing.sh Executable file
View File

@ -0,0 +1,69 @@
#! /bin/bash
BASE_DIR="`dirname $0`/.."
LIB_DIR="${BASE_DIR}/lib"
OPSI_WEB_ROOT=""
CRON_TEMP=""
# Source local build configuration (must be done AFTER sourcing the builder-product.cfg.cfg)
test -f $HOME/.opsi-administration.cfg && . $HOME/.opsi-administration.cfg
name_list=`mktemp /tmp/opsi-admin.name-list.XXXXXXXXXXX`
name_list_sort=`mktemp /tmp/opsi-admin.name-list-sort.XXXXXXXXXXX`
file_list=`mktemp /tmp/opsi-admin.file-list.XXXXXXXXXXX`
file_sort_list=`mktemp /tmp/opsi-admin.file-sort-list.XXXXXXXXXXX`
file_sort_list_version=`mktemp /tmp/opsi-admin.file-sort-list-verison.XXXXXXXXXXX`
file_sort_list_release=`mktemp /tmp/opsi-admin.file-sort-list-relase.XXXXXXXXXXX`
file_sort_list_final=`mktemp /tmp/opsi-admin.file-sort-list-final.XXXXXXXXXXX`
pushd ${OPSI_WEB_ROOT}
for pkg_root in public restricted ; do
# Find all revision files and sort them
for cfg_file in `find ${OPSI_WEB_ROOT}/${pkg_root}/integration -name "*.cfg" -print ` ; do
. ${cfg_file}
echo "$REV_PN" >> ${name_list}
done
sort ${name_list} | uniq > ${name_list_sort}
# first uniq sort all cfg based on version
for pkg_name in `cat ${name_list_sort}` ; do
cat /dev/null > ${file_list}
for cfg_file in `find ${OPSI_WEB_ROOT}/${pkg_root}/integration -name "${pkg_name}-*.cfg" -print ` ; do
. ${cfg_file}
echo $REV_VERSION >> ${file_list}
done
sort -V ${file_list} | uniq > ${file_sort_list_version}
# second uniq sort all versions based in release
cat /dev/null > ${file_sort_list_release}
for pkg_version in `cat ${file_sort_list_version}` ; do
for cfg_file_ver in ${OPSI_WEB_ROOT}/${pkg_root}/integration/${pkg_name}-${pkg_version}-*.cfg ; do
. ${cfg_file_ver}
echo ${pkg_version}-$REV_CREATOR_TAG$REV_RELEASE >> ${file_sort_list_release}
done
done
sort -V ${file_sort_list_release} | uniq > ${file_sort_list_final}
# third create versionrelease
cat /dev/null > ${file_sort_list}
for release_file_list in `cat ${file_sort_list_final}` ; do
. ${OPSI_WEB_ROOT}/${pkg_root}/integration/${pkg_name}-${release_file_list}.cfg
echo "${OPSI_WEB_ROOT}/${pkg_root}/integration/${pkg_name}-${release_file_list}.cfg" >> ${file_sort_list}
done
# Delete the oldest files
#for cfg_sort_file in `head -n-1 ${file_sort_list}` ; do
for cfg_sort_file in `tail -n 1 ${file_sort_list}` ; do
. ${cfg_file}
if [ -z "${REV_NAME}" ];then
NAME="${REV_PN}"
else
NAME="${REV_NAME}"
fi
./opsi-administration.sh --root ${OPSI_ROOT} --name $REV_PN --type ${pkg_root} --from integration --to testing --version $REV_VERSION-$REV_CREATOR_TAG$REV_RELEASE --purge
done
done
done
popd