install 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env sh
  2. set -e
  3. check()
  4. {
  5. yes=`which $1 | wc -l`
  6. echo $yes
  7. }
  8. # docker
  9. status=`check docker`
  10. if [ "$status" = 0 ]; then
  11. curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
  12. fi
  13. mkdir -p /etc/docker
  14. tee /etc/docker/daemon.json <<-'EOF'
  15. {
  16. "registry-mirrors": ["https://vwypw7yj.mirror.aliyuncs.com"]
  17. ,"insecure-registries" : ["docker.dever.cc"]
  18. }
  19. EOF
  20. service docker restart
  21. chmod -R +x src/*.py
  22. chmod -R +x src/shell
  23. chmod -R 777 container/share/
  24. basepath=$(cd `dirname $0`; pwd)
  25. ln -sf $basepath/src/dm.py /usr/bin/dm && chmod +x /usr/bin/dm
  26. ln -sf $basepath/src/ds.py /usr/bin/ds && chmod +x /usr/bin/ds
  27. ln -sf $basepath/src/dp.py /usr/bin/dp && chmod +x /usr/bin/dp
  28. ln -sf $basepath/src/dpc.py /usr/bin/dpc && chmod +x /usr/bin/dpc
  29. ln -sf $basepath/src/dever.py /usr/bin/dever && chmod +x /usr/bin/dever
  30. ln -sf $basepath/src/dgit.py /usr/bin/dgit && chmod +x /usr/bin/dgit
  31. # python-pip
  32. pipstatus=`check pip`
  33. if [ "$pipstatus" = 0 ]; then
  34. wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py && rm -rf get-pip.py
  35. fi
  36. # python-daemon 用不到了
  37. #pip install python-daemon
  38. #pip install redis
  39. #yumstatus=`check yum`
  40. #if [ "$yumstatus" = 0 ]; then
  41. #apt install python-gevent
  42. #else
  43. #yum install python-gevent
  44. #fi
  45. #dm run server-redis
  46. #python $basepath/src/daemon.py &
  47. docker version
  48. echo 'install success!'