ready for ics2022
This commit is contained in:
30
init.sh
30
init.sh
@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
version=ics2021
|
# usage: init repo branch [env]
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
if [ -d $1 ]; then
|
if [ -d $1 ]; then
|
||||||
echo "$1 is already initialized, skipping..."
|
echo "$1 is already initialized, skipping..."
|
||||||
@ -9,17 +8,17 @@ function init() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! -d $1 ]; do
|
while [ ! -d $1 ]; do
|
||||||
git clone -b $version https://github.com/NJU-ProjectN/$1.git
|
git clone -b $2 https://github.com/NJU-ProjectN/$1.git
|
||||||
done
|
done
|
||||||
log="$1 `cd $1 && git log --oneline --no-abbrev-commit -n1`"$'\n'
|
log="$1 `cd $1 && git log --oneline --no-abbrev-commit -n1`"$'\n'
|
||||||
rm -rf $1/.git
|
rm -rf $1/.git
|
||||||
|
|
||||||
git add -A $1
|
git add -A $1
|
||||||
git commit -am "$1 $version initialized"$'\n\n'"$log"
|
git commit -am "$1 $2 initialized"$'\n\n'"$log"
|
||||||
|
|
||||||
if [ $2 ] ; then
|
if [ $3 ] ; then
|
||||||
sed -i -e "/^export $2=.*/d" ~/.bashrc
|
sed -i -e "/^export $3=.*/d" ~/.bashrc
|
||||||
echo "export $2=`readlink -e $1`" >> ~/.bashrc
|
echo "export $3=`readlink -e $1`" >> ~/.bashrc
|
||||||
|
|
||||||
echo "By default this script will add environment variables into ~/.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 "After that, please run 'source ~/.bashrc' to let these variables take effect."
|
||||||
@ -27,6 +26,7 @@ function init() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# usage: init_no_git repo branch
|
||||||
function init_no_git() {
|
function init_no_git() {
|
||||||
if [ -d $1 ]; then
|
if [ -d $1 ]; then
|
||||||
echo "$1 is already initialized, skipping..."
|
echo "$1 is already initialized, skipping..."
|
||||||
@ -34,7 +34,7 @@ function init_no_git() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! -d $1 ]; do
|
while [ ! -d $1 ]; do
|
||||||
git clone -b $version https://github.com/NJU-ProjectN/$1.git
|
git clone -b $2 https://github.com/NJU-ProjectN/$1.git
|
||||||
done
|
done
|
||||||
log="$1 `cd $1 && git log --oneline --no-abbrev-commit -n1`"$'\n'
|
log="$1 `cd $1 && git log --oneline --no-abbrev-commit -n1`"$'\n'
|
||||||
|
|
||||||
@ -42,25 +42,25 @@ function init_no_git() {
|
|||||||
echo "/$1" >> .gitignore
|
echo "/$1" >> .gitignore
|
||||||
|
|
||||||
git add -A .gitignore
|
git add -A .gitignore
|
||||||
git commit --no-verify --allow-empty -am "$1 $version initialized without tracing"$'\n\n'"$log"
|
git commit --no-verify --allow-empty -am "$1 $2 initialized without tracing"$'\n\n'"$log"
|
||||||
}
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
nemu)
|
nemu)
|
||||||
init nemu NEMU_HOME
|
init nemu ics2022 NEMU_HOME
|
||||||
;;
|
;;
|
||||||
abstract-machine)
|
abstract-machine)
|
||||||
init abstract-machine AM_HOME
|
init abstract-machine ics2022 AM_HOME
|
||||||
init_no_git fceux-am
|
init_no_git fceux-am ics2021
|
||||||
;;
|
;;
|
||||||
am-kernels)
|
am-kernels)
|
||||||
init_no_git am-kernels
|
init_no_git am-kernels ics2021
|
||||||
;;
|
;;
|
||||||
nanos-lite)
|
nanos-lite)
|
||||||
init nanos-lite
|
init nanos-lite ics2021
|
||||||
;;
|
;;
|
||||||
navy-apps)
|
navy-apps)
|
||||||
init navy-apps NAVY_HOME
|
init navy-apps ics2021 NAVY_HOME
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Invalid input..."
|
echo "Invalid input..."
|
||||||
|
Reference in New Issue
Block a user