33 lines
652 B
Bash
Executable File
33 lines
652 B
Bash
Executable File
#!/bin/bash
|
|
|
|
MyRoot=$( sqlite3 $HOME/.aerofs/conf "SELECT v FROM c WHERE k = 'root';" )/Public/
|
|
|
|
if [ ! -e "$MyRoot/.pubroot" ]
|
|
then echo file "$MyRoot/.pubroot" not found.
|
|
echo it must contain the string of your http server with pub files.
|
|
echo ex. http://server.com:7777/
|
|
exit 1
|
|
fi
|
|
|
|
|
|
|
|
MyServerRoot=$( cat "$MyRoot/.pubroot" | tr -d "[:cntrl:]" )
|
|
|
|
if [ -z "$1" ]
|
|
then echo provide filename
|
|
exit 0
|
|
fi
|
|
|
|
absPath=$( readlink -f "$1" )
|
|
if [ ! -e "$absPath" ]
|
|
then echo file $absPath not found.
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! "$absPath" == "$MyRoot"* ]]
|
|
then echo $absPath not in $MyRoot
|
|
exit 1
|
|
fi
|
|
|
|
echo $MyServerRoot${absPath##$MyRoot}
|