diff --git a/install.sh b/install.sh index 50883f8..9df8d16 100755 --- a/install.sh +++ b/install.sh @@ -1,16 +1,15 @@ #!/bin/bash -[ $(id -u) -ne 0 ] { echo "This script has to be run as root"; exit 1; } -service nginx stop -rm /etc/nginx/sites-enabled/default -rm /etc/nginx/conf.d/default +sudo service nginx stop +sudo rm -rf /etc/nginx/sites-enabled/default +sudo rm -rf /etc/nginx/conf.d/default HTTP=" server {\n - listen 80 default_server;\n - listen [::]:80 default_server;\n - server_name $DOMAIN;\n + listen 8808 default_server;\n + listen [::]:8808 default_server;\n + server_name localhost;\n ssi on;\n - root $PWD/yay;\n + root $PWD/ypmirror;\n error_page 404 /sorry/404.php;\n error_page 403 /sorry/403.php;\n autoindex off;\n @@ -23,11 +22,15 @@ HTTP=" server {\n types { text/html php; }\n } \n }" -echo -e $HTTP > /etc/nginx/conf.d/yp.conf -service nginx start +echo -e $HTTP > yp.conf +sudo mv yp.conf /etc/nginx/conf.d/yp.conf +sudo service nginx start +sudo cp script.sh /usr/bin/yayponies-update.sh + +yayponies-update.sh $PWD localhost:8808 -co script.sh /usr/bin/yayponies-update.sh crontab -l > /tmp/yayponies-cron +sed -i '/yayponies-update/d' /tmp/yayponies-cron echo "*/10 * * * * /usr/bin/yayponies-update.sh $PWD localhost:8808" >> /tmp/yayponies-cron crontab /tmp/yayponies-cron rm /tmp/yayponies-cron diff --git a/script.sh b/script.sh index ac2765c..6fce419 100755 --- a/script.sh +++ b/script.sh @@ -4,7 +4,8 @@ git reset --hard git pull origin master for f in $(find . -type f -name '*.php'); do - curl "$2/$f" -so $f + curl "$2/$f" -so "$f" + mv "$f" "${f/php/html}" done cd ..