refactor
This commit is contained in:
parent
aa59f01da2
commit
6c7b39a40b
2 changed files with 15 additions and 23 deletions
7
Makefile
7
Makefile
|
@ -3,10 +3,11 @@ STUNAME = 张三
|
||||||
|
|
||||||
# DO NOT modify the following code!!!
|
# DO NOT modify the following code!!!
|
||||||
|
|
||||||
GITFLAGS = -q --author='tracer-ysyx2204 <tracer@ysyx.org>' --no-verify --allow-empty
|
TRACER = tracer-ysyx2204
|
||||||
|
GITFLAGS = -q --author='$(TRACER) <tracer@ysyx.org>' --no-verify --allow-empty
|
||||||
|
|
||||||
WORK_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
|
YSYX_HOME = $(NEMU_HOME)/..
|
||||||
TRACER_BRANCH = ysyx-tracer
|
TRACER_BRANCH = $(TRACER)
|
||||||
|
|
||||||
# prototype: git_commit(msg)
|
# prototype: git_commit(msg)
|
||||||
define git_commit
|
define git_commit
|
||||||
|
|
31
init.sh
31
init.sh
|
@ -1,5 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# usage: addenv env_name path
|
||||||
|
function addenv() {
|
||||||
|
sed -i -e "/^export $1=.*/d" ~/.bashrc
|
||||||
|
echo "export $1=`readlink -e $2`" >> ~/.bashrc
|
||||||
|
echo "By default this script will add environment variables into ~/.bashrc."
|
||||||
|
echo "After that, please run 'source ~/.bashrc' to let these variables take effect."
|
||||||
|
echo "If you use shell other than bash, please add these environment variables manually."
|
||||||
|
}
|
||||||
|
|
||||||
# usage: init repo branch directory trace [env]
|
# usage: init repo branch directory trace [env]
|
||||||
# trace = true|false
|
# trace = true|false
|
||||||
function init() {
|
function init() {
|
||||||
|
@ -25,12 +34,7 @@ function init() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $5 ] ; then
|
if [ $5 ] ; then
|
||||||
sed -i -e "/^export $5=.*/d" ~/.bashrc
|
addenv $5 $3
|
||||||
echo "export $5=`readlink -e $3`" >> ~/.bashrc
|
|
||||||
|
|
||||||
echo "By default this script will add environment variables into ~/.bashrc."
|
|
||||||
echo "After that, please run 'source ~/.bashrc' to let these variables take effect."
|
|
||||||
echo "If you use shell other than bash, please add these environment variables manually."
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,20 +67,7 @@ case $1 in
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
npc)
|
npc)
|
||||||
sed -i -e "/^export NPC_HOME=.*/d" ~/.bashrc
|
addenv NPC_HOME npc
|
||||||
echo "export NPC_HOME=`readlink -e npc`" >> ~/.bashrc
|
|
||||||
|
|
||||||
echo "By default this script will add environment variables into ~/.bashrc."
|
|
||||||
echo "After that, please run 'source ~/.bashrc' to let these variables take effect."
|
|
||||||
echo "If you use shell other than bash, please add these environment variables manually."
|
|
||||||
;;
|
|
||||||
ysyx)
|
|
||||||
sed -i -e "/^export YSYX_HOME=.*/d" ~/.bashrc
|
|
||||||
echo "export YSYX_HOME=`readlink -e .`" >> ~/.bashrc
|
|
||||||
|
|
||||||
echo "By default this script will add environment variables into ~/.bashrc."
|
|
||||||
echo "After that, please run 'source ~/.bashrc' to let these variables take effect."
|
|
||||||
echo "If you use shell other than bash, please add these environment variables manually."
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Invalid input..."
|
echo "Invalid input..."
|
||||||
|
|
Loading…
Reference in a new issue