From 2c0f743a6f5166d2941fc3c5d92294e61af169af Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Fri, 23 Aug 2013 22:54:02 +0200 Subject: [PATCH] add bbcode generator for opsi forum pages schoudl be extendet to use curl for automatic update --- bin/opsi-administration.sh | 4 +- bin/opsi-bbsite.sh | 162 +++++++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+), 2 deletions(-) create mode 100755 bin/opsi-bbsite.sh diff --git a/bin/opsi-administration.sh b/bin/opsi-administration.sh index eaedaf4..53368b5 100755 --- a/bin/opsi-administration.sh +++ b/bin/opsi-administration.sh @@ -82,7 +82,7 @@ go_show() show_version=$REV_VERSION-$REV_CREATOR_TAG$REV_RELEASE done if [ -n "${show_version}" ];then - echo "./${ARGV0} --root ${OPSI_ROOT} --name ${show_name} --type ${show_type} --from ${show_from} --to ${show_to} --version ${show_version} (--purge)" >> $show_list + echo "./${ARGV0} --root ${OPSI_ROOT} --name ${show_name} --type ${show_type} --from ${show_from} --to ${show_to} --version ${show_version} --purge" >> $show_list echo "./${ARGV0} --root ${OPSI_ROOT} --name ${show_name} --type ${show_type} --delete ${show_from} --version ${show_version} " >> $show_list else echo "no package named ${show_name}-* in this dir ${show_dir}" >> $show_list @@ -113,7 +113,7 @@ go_copy() echo "Package Name: ${copy_name}" >> $copy_list echo "" >> $copy_list if [ ${FLAGS_purge} -eq ${FLAGS_TRUE} ]; then - rm -f ${copy_to_dir}/${copy_name}-* &>> $copy_list + rm -f ${copy_to_dir}/${copy_name}* &>> $copy_list fi ln -vf ${copy_from_dir}/${copy_name}{-,_}${copy_version}{.,-}* ${copy_to_dir}/ &>> $copy_list boxes -d shell $copy_list diff --git a/bin/opsi-bbsite.sh b/bin/opsi-bbsite.sh new file mode 100755 index 0000000..47c469c --- /dev/null +++ b/bin/opsi-bbsite.sh @@ -0,0 +1,162 @@ +#! /bin/bash + +PUBLIC=/var/www/opsi/htdocs/public +RESTRICTED=/var/www/opsi/htdocs/restricted + +name_list=`mktemp /tmp/opsi-bbsite.name-list.XXXXXXXXXXX` +name_list_sort=`mktemp /tmp/opsi-bbsite.name-list-sort.XXXXXXXXXXX` +file_list=`mktemp /tmp/opsi-bbsite.file-list.XXXXXXXXXXX` +file_sort_list=`mktemp /tmp/opsi-bbsite.file-sort-list.XXXXXXXXXXX` +file_sort_list_version=`mktemp /tmp/opsi-bbsite.file-sort-list-verison.XXXXXXXXXXX` +file_sort_list_release=`mktemp /tmp/opsi-bbsite.file-sort-list-relase.XXXXXXXXXXX` +file_sort_list_final=`mktemp /tmp/opsi-bbsite.file-sort-list-final.XXXXXXXXXXX` + +pushd ${PUBLIC} +for pkg_root in release testing ; do + echo "[size=200][b]Public[/b][/size]" > ${PUBLIC}/${pkg_root}/.index.bb + echo "[size=150][b]${pkg_root}[/b][/size]" >> ${PUBLIC}/${pkg_root}/.index.bb + echo "[list]" >> ${PUBLIC}/${pkg_root}/.index.bb + + # Find all revision files and sort them + for cfg_file in `find ${PUBLIC}/${pkg_root} -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 ${PUBLIC}/${pkg_root} -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 ${PUBLIC}/${pkg_root}/${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 + . ${PUBLIC}/${pkg_root}/${pkg_name}-${release_file_list}.cfg + echo "${PUBLIC}/${pkg_root}/${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 + DATE=`date -d @${REV_TIMESTAMP} "+%Y-%m-%d %T"` + echo "[*] $REV_PN $NAME $REV_VERSION ( Build: $REV_CREATOR_TAG$REV_RELEASE Erstellt: $DATE Changelog: [url=http://git.disconnected-by-peer.at/go-opsi/$REV_PN/]Link[/url] Vendor: $REV_VENDOR)" >> ${PUBLIC}/${pkg_root}/.index.bb + done + done + echo "[/list]" >> ${PUBLIC}/${pkg_root}/.index.bb + echo "" >> ${PUBLIC}/${pkg_root}/.index.bb +done +popd + +pushd ${RESTRICTED} +for pkg_root in release testing ; do + echo "[size=200][b]Restricted[/b][/size]" > ${RESTRICTED}/${pkg_root}/.index.bb + echo "[size=150][b]${pkg_root}[/b][/size]" >> ${RESTRICTED}/${pkg_root}/.index.bb + echo "[list]" >> ${RESTRICTED}/${pkg_root}/.index.bb + + # Find all revision files and sort them + for cfg_file in `find ${RESTRICTED}/${pkg_root} -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 ${RESTRICTED}/${pkg_root} -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 ${RESTRICTED}/${pkg_root}/${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 + . ${RESTRICTED}/${pkg_root}/${pkg_name}-${release_file_list}.cfg + echo "${RESTRICTED}/${pkg_root}/${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 + DATE=`date -d @${REV_TIMESTAMP} "+%Y-%m-%d %T"` + echo "[*] $REV_PN $NAME $REV_VERSION ( Build: $REV_CREATOR_TAG$REV_RELEASE Erstellt: $DATE Changelog: [url=http://git.disconnected-by-peer.at/go-opsi/$REV_PN/]Link[/url] Vendor: $REV_VENDOR)" >> ${RESTRICTED}/${pkg_root}/.index.bb + done + done + echo "[/list]" >> ${RESTRICTED}/${pkg_root}/.index.bb + echo "" >> ${RESTRICTED}/${pkg_root}/.index.bb +done +popd + +echo "Hallo Opsi User," > ${PUBLIC}/.header.bb +echo "" >> ${PUBLIC}/.header.bb +echo "Wir erstellen und warten seit einiger Zeit (06.2011) ein Opsi Paket Repository das gleich wie UIB's Repo in den opsi-product-updater integriert werden kann." >> ${PUBLIC}/.header.bb +echo "Das Repository wird in 2 Bereiche geteil [i]Public[/i] und [i]Restricted[/i] (Der Restricted zweig ist nicht oeffentlich zugaenglich)" >> ${PUBLIC}/.header.bb +echo "Ueber die Jahre hat sich eine grosse Anzahl von Paketen ins Repo \"verirrt\"." >> ${PUBLIC}/.header.bb +echo "" >> ${PUBLIC}/.header.bb +echo "Wie man dieses Repo zur Opsi Installation hinzufuegt erfahrt ihr [url=http://opsi.disconnected-by-peer.at/opsi/wiki/Install/Integrate]hier[/url]" >> ${PUBLIC}/.header.bb +echo "Probleme mit den Paketen meldet ihr bitte [url=http://opsi.disconnected-by-peer.at/opsi/newticket]hier[/url] unter Auswahl der richtigen Componenete (Registrierung erforderlich)" >> ${PUBLIC}/.header.bb +echo "" >> ${PUBLIC}/.header.bb +echo "Wer gerne mitmachen will kann sich auf der Entwickler Mailingliste anmelden [url=http://lists.disconnected-by-peer.at/cgi-bin/mailman/listinfo/goopsi-dev]GoOpsi Dev Liste[/url]" >> ${PUBLIC}/.header.bb +echo "oder sich via Jabber bei mir melden (geos_one@0nl1ne.at)" >> ${PUBLIC}/.header.bb +echo "" >> ${PUBLIC}/.header.bb +echo "Details zum Repo:" >> ${PUBLIC}/.header.bb +echo "Jeder Zweig ist in Relase Testing und Integration aufgeteilt." >> ${PUBLIC}/.header.bb +echo "[list]" >> ${PUBLIC}/.header.bb +echo "[*] Release: enthaelt Pakete die wie es sein soll sehr lange getestet wurden und dadurch immer etwas hinter der aktuellen Version hinterherhinken." >> ${PUBLIC}/.header.bb +echo "[*] Testing: enthaelt Pakete die den Test des Entwicklers bestanden haben und jetzt als Testversion fuer die Allgemeinheit da sind." >> ${PUBLIC}/.header.bb +echo "[*] Integration: Ist der \"Playground\" der Entwickler; jeder Commit im Git bewirkt ein Neubau des Pack's und dadurch koennen diese Packs's mit Fehlern bespickt sein." >> ${PUBLIC}/.header.bb +echo "[/list]" >> ${PUBLIC}/.header.bb +echo "" >> ${PUBLIC}/.header.bb +echo "So und jetzt zur aktuellen Liste der Packs im Repo:" >> ${PUBLIC}/.header.bb +echo "" >> ${PUBLIC}/.header.bb + +echo "" > ${PUBLIC}/.footer.bb +echo "So das waren die paar Packs ;-)" >> ${PUBLIC}/.footer.bb +echo "Noch Fragen ?" >> ${PUBLIC}/.footer.bb +echo "" >> ${PUBLIC}/.footer.bb +echo "Das GeosOne Opsi Packaging Team" >> ${PUBLIC}/.footer.bb + +cat ${PUBLIC}/.header.bb ${PUBLIC}/release/.index.bb ${PUBLIC}/.footer.bb > ${PUBLIC}/release.bb +cat ${PUBLIC}/testing/.index.bb ${PUBLIC}/.footer.bb > ${PUBLIC}/testing.bb + +cat ${RESTRICTED}/release/.index.bb ${PUBLIC}/.footer.bb > ${RESTRICTED}/release.bb +cat ${RESTRICTED}/testing/.index.bb ${PUBLIC}/.footer.bb > ${RESTRICTED}/testing.bb +