Commit 4ac00cef authored by Ryan Jackson's avatar Ryan Jackson
Browse files

create subboss image cache dir on first boot

parent 7f650e8b
......@@ -12,6 +12,8 @@ use Sys::Syslog;
use English;
use Socket;
use Errno qw(EADDRINUSE);
use File::Basename;
use File::Path;
#
# This also kills a running frisbee.
......@@ -71,6 +73,7 @@ sub GetLoadAddress($$);
my $FRISBEED = "$TB/sbin/frisbeed";
my $LOGFILE = "$TB/log/frisbeelauncher";
my $FRISBEEIMAGE= "$TB/sbin/frisbeeimage";
my $IMAGE_CACHE = "$TB/image_cache";
my $child_pid = 0;
my $dlfilename = 0;
......@@ -123,6 +126,7 @@ usage()
#
# XXX hack: use map + regex to get around taint check
my ($imageid, $filename, $size, $mtime) = map { /(.*)/; $1 } @ARGV;
$filename = "$IMAGE_CACHE/$filename";
#
# Get node ID via tmcc
......@@ -204,6 +208,10 @@ if (!$killmode) {
SetPid($PID);
$EUID = $UID;
$dlfilename = $filename;
my $image_dir = dirname($filename);
if (! -d $image_dir && !mkpath($image_dir)) {
Fatal("Unable to create path \"$image_dir\"\n");
}
system($FRISBEEIMAGE, $imageid, $filename);
ClearPid();
ClearSyncFlag();
......
......@@ -36,6 +36,7 @@ sub doboot()
{
my $EXTRAFS = "/z";
my $TFTPBOOT_DIR = "$EXTRAFS/tftpboot";
my $IMAGES_DIR = "$EXTRAFS/image_cache";
my $stuffdir = "$EXTRAFS/tmp";
my $MFSTARBALL = "tftpboot-subboss.tar.gz";
......@@ -47,8 +48,9 @@ sub doboot()
system("/usr/local/etc/rc.d/tftpd-hpa.sh stop");
RecreateDir($EXTRAFS,1);
mysystem("$BINDIR/mkextrafs.pl -f $EXTRAFS");
mysystem("mkdir -p $TFTPBOOT_DIR $stuffdir");
mysystem("mkdir -p $TFTPBOOT_DIR $IMAGES_DIR $stuffdir");
mysystem("ln -sf $TFTPBOOT_DIR /tftpboot");
mysystem("ln -sf $IMAGES_DIR $TB/image_cache");
print "Copying over tftpboot tar file from web server and unpacking\n";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment