PyLoad setup

cd ~/compile
rm -r ~/compile/pyload
unzip pyload-src-v0.4.9.zip
cd ~/compile/pyload
find . -type f \( -exec sed -i s/"\/usr\/bin\/perl"/"\/ffp\/bin\/perl"/g {} \; , -exec sed -i s/"\/usr\/bin\/python"/"\/ffp\/bin\/python"/g {} \; , -exec sed -i s/"\/usr\/bin\/bash"/"\/ffp\/bin\/bash"/g {} \; , -exec sed -i s/"\/usr\/bin\/sh"/"\/ffp\/bin\/sh"/g {} \; , -exec sed -i s/"\/usr\/bin\/env"/"\/ffp\/bin\/env"/g {} \; , -exec sed -i s/"\/bin\/bash"/"\/ffp\/bin\/bash"/g {} \; , -exec sed -i s/"\/bin\/sh"/"\/ffp\/bin\/sh"/g {} \; , -exec sed -i s/"\/bin\/env"/"\/ffp\/bin\/env"/g {} \; , -exec sed -i s/"\/ffp\/ffp\/"/"\/ffp\/"/g {} \; \)

#Modify /ffp/home/root/.pyload/pyload.conf:
#str prefix : "Path Prefix" = /pyload
#for proxypass do: 
#bool https : "Use HTTPS" = False

#grep -m1 -r -i -I "src='\/" .
#grep -m1 -r -i -I "src=\"\/" .
find . -type f ! -name "*.py" -exec sed -i s/"src='\/"/"src='\/pyload\/"/g {} \;
find . -type f ! -name "*.py" -exec sed -i s/"src=\"\/"/"src=\"\/pyload\/"/g {} \;

#grep -m1 -r -i -I "href='\/" .
#grep -m1 -r -i -I "href=\"\/" .
find . -type f ! -name "*.py" -exec sed -i s/"href='\/"/"href='\/pyload\/"/g {} \;
find . -type f ! -name "*.py" -exec sed -i s/"href=\"\/"/"href=\"\/pyload\/"/g {} \;

#grep -r -i -I "'\/media\/" .
#grep -r -i -I "\"\/media\/" .
#grep -r -i -I "url(\/templates\/" .
find . -type f ! -name "*.py" ! -name "*.conf" -exec sed -i s/"'\/media\/"/"'\/pyload\/media\/"/g {} \;
find . -type f ! -name "*.py" ! -name "*.conf" -exec sed -i s/"\"\/media\/"/"\"\/pyload\/media\/"/g {} \;
find . -type f ! -name "*.py" -exec sed -i s/"url(\/templates\/"/"url(\/pyload\/templates\/"/g {} \;
find . -type f ! -name "*.py" -exec sed -i s/"\"\/pathchooser"/"\"\/pyload\/pathchooser"/g {} \;

#grep -r -i -I "'\/json\/" .
#grep -r -i -I "\"\/json\/" .
find . -type f ! -name "*.py" -exec sed -i s/"\"\/json\/"/"\"\/pyload\/json\/"/g {} \;
find . -type f ! -name "*.py" -exec sed -i s/"'\/json\/"/"'\/pyload\/json\/"/g {} \;

#grep -r -I "'\/api\/" .
#grep -r -I "\"\/api\/" .
find . -type f ! -name "*.py" -exec sed -i s/"'\/api\/"/"'\/pyload\/api\/"/g {} \;
find . -type f ! -name "*.py" -exec sed -i s/"\"\/api\/"/"\"\/pyload\/api\/"/g {} \;

#grep -r -i -I "redirect(\"\/" .
find . -type f -name "*.py" -exec sed -i s/"redirect(\"\/\")"/"redirect(\"\/pyload\/home\")"/g {} \;
find . -type f -name "*.py" -exec sed -i s/"redirect(\"\/login\")"/"redirect(\"\/pyload\/login\")"/g {} \;
find . -type f -name "*.py" -exec sed -i s/"redirect(\"\/nopermission\")"/"redirect(\"\/pyload\/nopermission\")"/g {} \;
find . -type f -name "*.py" -exec sed -i s/"redirect(\"\/setup\")"/"redirect(\"\/pyload\/setup\")"/g {} \;

AliasMatch /pyload/(media|templates)/(.+)$ /ffp/opt/pyload/module/web/$1/$2

    Header set X-UA-Compatible "IE=edge"
    Order allow,deny
    Allow from all



    ProxyPass                       http://127.0.0.1:8000/pyload/
    ProxyPassReverse                http://127.0.0.1:8000/pyload/
    ProxyPassReverseCookieDomain    127.0.0.1       adrhc.go.ro

#end: prepare to proxypass

#Modify /ffp/opt/pyload/module/web/templates/default/base.html by adding favicon.ico from http://pyload.org/:
#

#manage user
python /ffp/opt/pyload/pyLoadCore.py -u

#Force rebuilding of *.py:
find /ffp/opt/pyload/module/web -name "*.pyc" -exec rm {} \;

rm -r /ffp/opt/pyload/
cp -r ../pyload /ffp/opt/
cd /ffp/opt/pyload/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.