# HG changeset patch # User david-hoover # Date 1398978717 14400 # Node ID 01687750c862affd58ea629d9cbf5a8f1180a872 # Parent e5a905df7e0bee151171ce33672ac613faad9839 Uploaded diff -r e5a905df7e0b -r 01687750c862 export_local_file.xml --- a/export_local_file.xml Thu Oct 04 14:48:02 2012 -0400 +++ b/export_local_file.xml Thu May 01 17:11:57 2014 -0400 @@ -1,10 +1,12 @@ - + to a local filesytem export_local_file.sh $input '$filepath' $userEmail $output - + + value.lower()[0:5] == '/home' or value.lower()[0:5] == '/data' + @@ -15,7 +17,7 @@ **Copying files** -This tool will allow you to export a single file from Galaxy to a local filesystem. +This tool will allow you to export a single file from Galaxy to a local filesystem on Helix or Biowulf. You must have permission to write the file to the given directory, and the file must not yet exist. This tool will not overwrite a pre-existing file. @@ -26,6 +28,8 @@ - The file path must be a file, not a directory - You must give the fullpath to the file (/home/user/myfile.txt, not ./myfile.txt) - You must have permission to write the file in the given directory +- Only /home or /data directories are allowed. +- The directories must exist on Helix or Biowulf! ----- diff -r e5a905df7e0b -r 01687750c862 import_local_file.sh --- a/import_local_file.sh Thu Oct 04 14:48:02 2012 -0400 +++ b/import_local_file.sh Thu May 01 17:11:57 2014 -0400 @@ -27,15 +27,53 @@ # Filter any unwanted directories -if [[ `echo $INPUT | grep -c ^/data/` -lt 1 ]] && [[ `echo $INPUT | grep -c ^/home/` -lt 1 ]] ; then - echo "Error: \"$INPUT\" is not allowed" >&2 +topdir1=$(echo $INPUT | grep -oP '^/home/\w+|^/data/\w+') +if [[ -z $topdir1 ]] +then + echo "Error: The input file must begin with either '/home' or '/data'." >&2 + exit 1 +else + topdir2=$(echo $INPUT | grep -oP '^/home/\w+/|^/data/\w+/') + if [[ ! -d $topdir2 ]] + then + echo "Error: The directory $topdir1 doesn't exist." >&2 + exit 1 + fi +fi + + +path1=$(echo $INPUT | grep -oP '^/home/\w+/\S+|^/data/\w+/S+') +if [[ -z $path1 ]] +then + echo "Error: The path $INPUT is not formatted correctly." >&2 exit 1 fi # Do the deed cpx $INPUT $OUTPUT "$USER" if [ $? != 0 ]; then - echo "Error: $USER failed to copy \"$INPUT\"" >&2 + echo "Error: $USER failed to copy \"$INPUT\". +Click 'View details' and then 'stderr' to see more information about the error. +=============================================================================== + +This could happen for one of several reasons: + +1. The path is formatted incorrectly (example: \home\user\bogus.txt) +2. The path doesn’t exist (example: /home/bogususer/file.txt) +3. The path is not a full path (example: bogusfile.txt) +4. The user doesn’t have permission (example: /home/anotheruser/file.txt) +5. Something went horribly wrong (???) + +Make sure that your file exists within your /home or /data directory, that you have +read access to that file, and that the input is formattted like the following: + + /home/$USER/path/to/file + +or + + /data/$USER/path/to/file + +" >&2 exit 1 fi diff -r e5a905df7e0b -r 01687750c862 import_local_file.xml --- a/import_local_file.xml Thu Oct 04 14:48:02 2012 -0400 +++ b/import_local_file.xml Thu May 01 17:11:57 2014 -0400 @@ -1,9 +1,12 @@ - + from a local filesystem import_local_file.sh '$filepath' $output $userEmail - + + value.lower()[0:5] == '/home' or value.lower()[0:5] == '/data' + + @@ -14,7 +17,7 @@ **Copying files** -This tool will allow you to upload a single file that is locally available. There is no browse function, +This tool will allow you to upload a single file that is locally available on Helix or Biowulf. There is no browse function, however, so you will need to give the full path name. If you have permission to read the file, Galaxy can import the file. .. class:: warningmark @@ -24,6 +27,8 @@ - The file path must be a file, not a directory - You must give the fullpath to the file (/home/user/myfile.txt, not ./myfile.txt) - You must have permission to read the file +- Only /home or /data directories are allowed +- The files must be on Helix or Biowulf! Use 'Upload File' for all other files! ----- diff -r e5a905df7e0b -r 01687750c862 x.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/x.sh Thu May 01 17:11:57 2014 -0400 @@ -0,0 +1,10 @@ +#!/bin/bash + +topdir=$(echo $1 | grep -oP '^/home/\w+/|^/data/\w+/') + +if [[ -n $topdir ]] +then + echo "$1: good" +else + echo "$1: bad" +fi