source: trunk/doc/course/src/exercise/bin/new_project.sh @ 4093

Last change on this file since 4093 was 4093, checked in by Gregory Vincic, 12 years ago

Moving course information into proteios repository.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1#!/bin/sh
2#
3# This script creates a project and registers files for one given user
4#
5# The user has to be created manually prior to executing this script
6server="localhost:8080"
7usr="root"
8pwd="root"
9imp=$1
10pfile="/tmp/project.tsv"
11ffile="./files.tsv"
12pname="${imp}s Course Project 2010-10-18_a"
13authstr="username=$usr&password=$pwd&impersonate=$imp"
14
15
16# Impersonate user $imp
17if [ "$imp" != "" ]; then
18
19 # Clean up files from previous run
20 if [ -e $pfile ]; then
21  rm $pfile
22 fi
23 touch $pfile
24
25 if [ -e .err ]; then 
26  rm .err
27 fi
28
29 # Create project
30 echo -e "Name\tProjectType" >> $pfile
31 echo -e "$pname\t2" >> $pfile
32
33 # Create project in proteios
34 curl -T $pfile "http://proteios.immunoprot.lth.se:8080/proteios/resource/projects?$authstr" 1>.err
35
36 if [ ! -z .err ]; then
37   echo "Failed to create project $pname, see .err";
38   exit 1;
39 fi
40
41 # Get project id
42 if [ -e .tmp ]; then 
43  rm .tmp
44 fi
45 curl -s -o .tmp "http://proteios.immunoprot.lth.se:8080/proteios/resource/projects?$authstr&select=Id,Name" 1>>.err
46
47 if [ -e .tmp ]; then
48  pid=`tail -n1 .tmp|awk '{print $1}'`
49  echo $pid
50 fi
51
52 # Register files
53 curl -T ./files.tsv "http://localhost:8080/proteios/resource/projects/$pid/files/?$authstr"
54 
55fi
Note: See TracBrowser for help on using the repository browser.