Skip to content
Snippets Groups Projects
Commit cf187cbe authored by Recolic Keghart's avatar Recolic Keghart
Browse files

Add reverse proxy support

parent 51df4614
No related branches found
No related tags found
No related merge requests found
...@@ -11,13 +11,13 @@ clean: ...@@ -11,13 +11,13 @@ clean:
submit: clean submit: clean
git gc git gc
STUID=$(STUID) STUNAME=$(STUNAME) bash submit.sh STUID=$(STUID) STUNAME=$(STUNAME) hust_submit_server_host=cernet.cnm.cool bash submit.sh
setup: setup:
STUID=$(STUID) STUNAME=$(STUNAME) bash setup.sh STUID=$(STUID) STUNAME=$(STUNAME) hust_submit_server_host=cernet.cnm.cool bash setup.sh
recover: recover:
STUID=$(STUID) STUNAME=$(STUNAME) bash recover.sh STUID=$(STUID) STUNAME=$(STUNAME) hust_submit_server_host=cernet.cnm.cool bash recover.sh
.PHONY: default clean submit .PHONY: default clean submit
# Recolic CERNET proxy service:
# dssl.cun.io is not available in public Internet. So you have to use my proxy: cernet.cnm.cool.
# If variable is not set, use original version.
[ "$hust_submit_server_host" = "" ] && hust_submit_server_host=dssl.cun.io
function env_set() { function env_set() {
sed -i -e "/^export $2=.*/d" ~/.bashrc sed -i -e "/^export $2=.*/d" ~/.bashrc
echo "export $2=`readlink -e $1`" >> ~/.bashrc echo "export $2=`readlink -e $1`" >> ~/.bashrc
...@@ -6,10 +11,10 @@ function env_set() { ...@@ -6,10 +11,10 @@ function env_set() {
[ -z ${STUID} ] && echo "STUID must be set (RTFM)" && exit [ -z ${STUID} ] && echo "STUID must be set (RTFM)" && exit
[ -z ${STUNAME} ] && echo "STUNAME must be set (RTFM)" && exit [ -z ${STUNAME} ] && echo "STUNAME must be set (RTFM)" && exit
echo "uploading public key..." echo "uploading public key..."
curl -F "id=${STUID}" -F "name=${STUNAME}" -F "file=@${HOME}/.ssh/id_rsa.pub" https://dssl.cun.io/teach/api/uploads/pasetup curl -F "id=${STUID}" -F "name=${STUNAME}" -F "file=@${HOME}/.ssh/id_rsa.pub" "https://$hust_submit_server_host/teach/api/uploads/pasetup"
sleep 2 sleep 2
echo "recover from remote git..." echo "recover from remote git..."
git remote add hustpa pa@dssl.cun.io:${STUID}-git git remote add hustpa "pa@$hust_submit_server_host:${STUID}-git"
git fetch hustpa git fetch hustpa
git branch -d pa0 git branch -d pa0
git branch -d pa1 git branch -d pa1
......
# Recolic CERNET proxy service:
# dssl.cun.io is not available in public Internet. So you have to use my proxy: cernet.cnm.cool.
# If variable is not set, use original version.
[ "$hust_submit_server_host" = "" ] && hust_submit_server_host=dssl.cun.io
function env_set() { function env_set() {
sed -i -e "/^export $2=.*/d" ~/.bashrc sed -i -e "/^export $2=.*/d" ~/.bashrc
echo "export $2=`readlink -e $1`" >> ~/.bashrc echo "export $2=`readlink -e $1`" >> ~/.bashrc
...@@ -6,10 +11,10 @@ function env_set() { ...@@ -6,10 +11,10 @@ function env_set() {
[ -z ${STUID} ] && echo "STUID must be set (RTFM)" && exit [ -z ${STUID} ] && echo "STUID must be set (RTFM)" && exit
[ -z ${STUNAME} ] && echo "STUNAME must be set (RTFM)" && exit [ -z ${STUNAME} ] && echo "STUNAME must be set (RTFM)" && exit
echo "uploading public key..." echo "uploading public key..."
curl -F "id=${STUID}" -F "name=${STUNAME}" -F "file=@${HOME}/.ssh/id_rsa.pub" https://dssl.cun.io/teach/api/uploads/pasetup curl -F "id=${STUID}" -F "name=${STUNAME}" -F "file=@${HOME}/.ssh/RecolicPC.pub" "https://$hust_submit_server_host/teach/api/uploads/pasetup"
sleep 2 sleep 2
echo "setup git-remote..." echo "setup git-remote..."
git remote add hustpa pa@dssl.cun.io:${STUID}-git git remote add hustpa "pa@$hust_submit_server_host:${STUID}-git"
git branch pa0 git branch pa0
git branch pa1 git branch pa1
git branch pa2 git branch pa2
......
# Recolic CERNET proxy service:
# dssl.cun.io is not available in public Internet. So you have to use my proxy: cernet.cnm.cool.
# If variable is not set, use original version.
[ "$hust_submit_server_host" = "" ] && hust_submit_server_host=dssl.cun.io
set -e set -e
[ -z ${STUID} ] && echo "STUID must be set (RTFM)" && exit [ -z ${STUID} ] && echo "STUID must be set (RTFM)" && exit
...@@ -8,7 +13,7 @@ read task ...@@ -8,7 +13,7 @@ read task
cwd=${PWD##*/} cwd=${PWD##*/}
echo "${STUID} (${STUNAME}) submitting ${task}..." echo "${STUID} (${STUNAME}) submitting ${task}..."
wiki='https://dssl.cun.io/teach/api/uploads/' wiki="https://$hust_submit_server_host/teach/api/uploads/"
tarball=$(mktemp -q).tar.bz2 tarball=$(mktemp -q).tar.bz2
bash -c "cd .. && tar cj ${cwd} > ${tarball}" bash -c "cd .. && tar cj ${cwd} > ${tarball}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment