#!/usr/bin/env sh set -e check() { yes=`which $1 | wc -l` echo $yes } chmod -R +x src/*.py chmod -R +x src/shell chmod -R 777 container/share/ basepath=$(cd `dirname $0`; pwd) # docker status=`check docker` if [ "$status" = 0 ]; then #curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun $basepath/src/shell/docker/setup --mirror Aliyun fi mkdir -p /etc/docker tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": [ "https://docker.mirrors.ustc.edu.cn", "https://registry.docker-cn.com", "http://hub-mirror.c.163.com", "https://mirror.ccs.tencentyun.com" ] ,"insecure-registries" : ["docker.dever.cc"] } EOF #service docker restart ln -sf $basepath/src/dm.py /usr/bin/dm && chmod +x /usr/bin/dm ln -sf $basepath/src/ds.py /usr/bin/ds && chmod +x /usr/bin/ds ln -sf $basepath/src/dp.py /usr/bin/dp && chmod +x /usr/bin/dp ln -sf $basepath/src/dpc.py /usr/bin/dpc && chmod +x /usr/bin/dpc ln -sf $basepath/src/dever.py /usr/bin/dever && chmod +x /usr/bin/dever ln -sf $basepath/src/dever2.py /usr/bin/dever2 && chmod +x /usr/bin/dever2 ln -sf $basepath/src/dgit.py /usr/bin/dgit && chmod +x /usr/bin/dgit # python-pip #pipstatus=`check pip` #if [ "$pipstatus" = 0 ]; then #wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py && rm -rf get-pip.py #fi # python-daemon 用不到了 #pip install python-daemon #pip install redis #yumstatus=`check yum` #if [ "$yumstatus" = 0 ]; then #apt install python-gevent #else #yum install python-gevent #fi #dm run server-redis #python $basepath/src/daemon.py & docker version echo 'install success!'