1
0
forked from x/ContextOS
ContextOS/src/main.sh
2025-01-06 21:38:56 +08:00

27 lines
895 B
Bash

#!/bin/sh
main() {
case "$1" in
app) shift # 生产环境
[ -e $ctx_name ] || mkdir $ctx_name; cd $ctx_name
[ -e /opt/daemon/ ] && mkdir -p usr/local/ && ln -s /opt/daemon/ usr/local/daemon
export PATH="$PWD/bin:$PWD/local/bin:$PWD/usr/local/go/bin:$PATH"
prepare_ice && $PWD/bin/ice.bin forever start "$@"
;;
dev) shift # 开发环境
require miss.sh; ish_miss_prepare_package; prepare_system; [ -f ~/.gitconfig ] || ish_dev_git_prepare
if ! [ -e $ctx_name ]; then
git config --global "url.$ctx_dev_ip/x/.insteadof" "${ctx_repos%/*}/"
echo && ish_log_debug -g "clone $ctx_repos" && git clone $ctx_repos $ctx_name
fi; cd $ctx_name
source etc/miss.sh && $PWD/bin/ice.bin forever start "$@"
;;
cmd) # 命令环境
ish_sys_dev_init >/dev/null; shift; [ -n "$*" ] && ish_sys_dev_run "$@"
;;
*)
echo "hello world"
;;
esac
}
main "$@"