##########
tags:
- find . '(' -name '*.py' -o -name '*.spec' ')' | xargs etags
+ find . -type f | egrep -v '/\.svn/|~$$' | xargs etags
.PHONY: tags
/var/www/html/boot/index.php
the bootmanager rpm installs most of its stuff in
/usr/share/bootmanager/regular/
-all signed scripts are stored into
- /var/www/html/bootmanager
+and the default signed script is created as
+ /var/www/html/boot/bootmanager_regular.sh.sgn
===
If you need to create an alternate version for a specific 'deployment'
===
It's also possible to attach a (signed) bm script to a unique node by renaming a .sgn into
-/var/www/html/bootmanager/<hostname>_bootmanager.sh.sgn
+/var/www/html/boot/bootmanager_<hostname>.sh.sgn
# the python code packaged in these are shipped on the node as well
Requires: pypcilib pyplnet monitor-runlevelagent
-# plc.d/bootmanager is moving
+### avoid having yum complain about updates, as stuff is moving around
+# plc.d/bootmanager
Conflicts: myplc <= 4.3-37
-# nodeconfig/boot/index.php is moving
+# nodeconfig/boot/*
Conflicts: nodeconfig <= 4.3-7
AutoReqProv: no
# formerly in the nodeconfig module
install -D -m 755 nodeconfig/boot/index.php $RPM_BUILD_ROOT/var/www/html/boot/index.php
+install -D -m 755 nodeconfig/boot/upload-bmlog.php $RPM_BUILD_ROOT/var/www/html/boot/upload-bmlog.php
# formerly in the MyPLC module
-install -D -m 755 plc.d/bootmanager $RPM_BUILD_ROOT/etc/pld.c/bootmanager
+install -D -m 755 plc.d/bootmanager $RPM_BUILD_ROOT/etc/plc.d/bootmanager
%clean
rm -rf $RPM_BUILD_ROOT
%post
-# signing of botmanager.sh occurs as part of plc.d/bootmanager
+# signing of botmanager.sh occurs as part of /etc/plc.d/bootmanager
+# which in turn invokes build.sh
# NOTE: do not run this agent when installed on a myplc.
# xxx - a bit hacky maybe
%defattr(-,root,root,-)
%{_datadir}/%{name}
/var/www/html/boot/index.php
-/etc/pld.c/bootmanager
+/etc/plc.d/bootmanager
%changelog
* Sat Jan 09 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - BootManager-4.3-16
sed -i -e "s|SUPPORT_FILE_DIR=.*|SUPPORT_FILE_DIR=$BOOTSTRAPDIR|" source/configuration
# Source bootmanager configuration
-. $srcdir/source/configuration
+. source/configuration
# Write boot script. nodeconfig/boot/index.php retrieves the contents of this script
# after checking the node id
-BMDIR=/var/www/html/bootmanager
+BMDIR=/var/www/html/boot
mkdir -p $BMDIR
-DEST_SCRIPT="$BMDIR/${DEPLOYMENT}_bootmanager.sh"
+DEST_SCRIPT="$BMDIR/bootmanager_${DEPLOYMENT}.sh"
# Remove the old version or any sym links prior to re-writing
rm -f ${DEST_SCRIPT}
rm -f ${DEST_SCRIPT}.sgn
# Do not tolerate errors
set -e
-UUDECODE=/usr/bin/uudecode
-
-($UUDECODE | /bin/tar -C /tmp -xj) << _EOF_
+(/usr/bin/uudecode | /bin/tar -C /tmp -xj) << _EOF_
EOF
# Embed the uuencoded tarball in the script
-tar -cj -C $srcdir source/ -C $extra_libs source/ | uuencode -m - >> $DEST_SCRIPT
+tar -cj source/ -C $extra_libs source/ | uuencode -m - >> $DEST_SCRIPT
# wrap up the script
echo '_EOF_' >> $DEST_SCRIPT
global $adm;
// location for signed scripts
-$bmdir="/var/www/html/bootmanager";
+$bmdir="/var/www/html/boot";
+$bmext=".sh.sgn";
-// Default bootmanager
-$bootmanager = "bootmanager.sh.sgn";
+$candidates = array();
// Look up the node
$interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR']));
// Custom bootmanager for the node, e.g.
// planetlab-1.cs.princeton.edu_bootmanager.sh.sgn
- $bootmanagers = array(strtolower($node['hostname']) . "_" . $bootmanager);
+ $candidates [] = "bootmanager" . "_" . strtolower($node['hostname']);
// Custom bootmanager for the deployment tag, e.g.
-
- if (!empty($node['nodegroup_ids'])) {
- $nodegroups = $adm->GetNodeDeployment($node['nodegroup_ids']);
- foreach ($nodegroups as $nodegroup) {
- $bootmanagers[] = strtolower($nodegroup['groupname']) . "_" . $bootmanager;
- }
+ $deployment = $adm->GetNodeDeployment($node['node_id']);
+ if ( ! empty ($deployment) ) {
+ $candidates[] = "bootmanager" . "_" . $deployment;
}
}
// Default bootmanager
-$bootmanagers[] = "regular_" . $bootmanager;
+$candidates[] = "bootmanager_regular";
-foreach ($bootmanagers as $bootmanager) {
- $candidate=$bmdir . "/" . $bootmanager;
+foreach ($candidates as $bootmanager) {
+ $candidate=$bmdir . "/" . $bootmanager . $bmext ;
if (file_exists($candidate)) {
readfile($candidate);
exit();
--- /dev/null
+<?php
+
+// Thierry Parmentelat -- INRIA
+// first draft for a revival of former (3.x?) alpina-logs in 5.0
+
+// this needs be created with proper permissions at package install time
+$logdir="/var/log/bm";
+
+// limit: applies to uploads coming from an unrecognized IP
+$limit_bytes=4*1024;
+
+$default_hostname="unknown";
+
+function mkdir_if_needed ($dirname) {
+ if (is_dir ($dirname))
+ return;
+ mkdir ($dirname) or die ("Cannot create dir " . $dirname);
+}
+
+// Get admin API handle
+require_once 'plc_api.php';
+global $adm;
+
+// find the node that these longs should belong to by looking for a node_id
+// with an ip the same as the http requestor ip
+$ip = $_SERVER['REMOTE_ADDR'];
+
+$hostname=$default_hostname;
+// locate hostname from DB based on this IP
+$interfaces=$adm->GetInterfaces(array("ip"=>$ip));
+if (! empty($interfaces) ) {
+ $interface=$interfaces[0];
+ $node_id=$interface['node_id'];
+ $nodes=$adm->GetNodes($node_id,array("hostname"));
+ if (!empty($nodes)) {
+ $hostname=$nodes[0]['hostname'];
+ }
+ }
+
+// store the actual data in /var/log/bm/raw/2008-11-31-20-02-onelab01.inria.fr-138.96.250.141.txt
+
+$rawdir=$logdir . "/raw";
+$date=strftime("%Y-%m-%d-%H-%M");
+$log_name=$date . "-" . $hostname . "-" . $ip . ".txt";
+$log_path=$rawdir . "/" . $log_name;
+$month=strftime("%Y-%m");
+$time=strftime("%d-%H-%M");
+
+mkdir_if_needed ($rawdir);
+
+////////////////////////////////////////
+
+$log=fopen($log_path,"w") or die ("Cannot open logfile "+$log_path);
+
+$uploaded_name= $_FILES['log']['tmp_name'];
+$uploaded_size=filesize($uploaded_name);
+
+fprintf ($log, "BootManager log created on: %s-%s\n",$month,$time);
+fprintf( $log, "From IP: %s\n",$ip);
+fprintf( $log, "hostname: %s\n",$hostname);
+fprintf ( $log, "uploaded file: %s (%d bytes)\n",$uploaded_name,$uploaded_size);
+if ( ( strcmp($hostname,$default_hostname)==0) && ( $uploaded_size >= $limit_bytes) ) {
+ fprintf ( $log, "contents from an unrecognized IP address was truncated to %d bytes\n",$limit_bytes);
+ $truncated=TRUE;
+ $uploaded_size=$limit_bytes;
+ } else {
+ $truncated=FALSE;
+ }
+
+fprintf( $log, "-----------------\n\n" );
+$uploaded = fopen($uploaded_name,'r');
+$contents = fread($uploaded, $uploaded_size);
+fclose($uploaded);
+fwrite($log,$contents);
+if ($truncated)
+ fwrite ($log, " ..<" . "truncated" . ">..\n");
+fclose($log);
+
+////////////////////////////////////////
+
+// create symlinks for easy browsing
+
+// /var/log/bm/per-month/2008-11/onelab1.inria.fr/31-20-02.bmlog
+$linkdir=$logdir;
+$linkdir=$linkdir . "/per-month";
+mkdir_if_needed ($linkdir);
+$linkdir=$linkdir . "/" . $month;
+mkdir_if_needed ($linkdir);
+$linkdir = $linkdir . "/" . $hostname;
+mkdir_if_needed ($linkdir);
+$link = $linkdir . "/" . $time ;
+symlink ("../../../raw/".$log_name,$link);
+
+# /var/log/bm/per-hostname/onelab1.inria.fr/2008-11-31-20-02.bmlog
+$linkdir=$logdir;
+$linkdir=$linkdir . "/per-hostname";
+mkdir_if_needed ($linkdir);
+$linkdir=$linkdir . "/" . $hostname;
+mkdir_if_needed ($linkdir);
+$link = $linkdir . "/" . $month . "-" . $time ;
+symlink ("../../raw/".$log_name,$link);
+
+# /var/log/bm/per-ip/138.96.250.141/2008-11-31-20-02.bmlog
+$linkdir=$logdir;
+$linkdir=$linkdir . "/per-ip";
+mkdir_if_needed ($linkdir);
+$linkdir=$linkdir . "/" . $ip;
+mkdir_if_needed ($linkdir);
+$link = $linkdir . "/" . $month . "-" . $time ;
+symlink ("../../raw/".$log_name,$link);
+
+?>
+++ /dev/null
-The BuildSupport directory is used to build tarballs of files necessary during the install, including files to bootstrap RPM, handle booting off of lvm volumes, and partitioning disks.