Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. _DIR=$(cd "$(dirname "$0")";pwd)
  4. cd $_DIR
  5.  
  6. ## ============== retrieve rpms and prepare repo meta data
  7.  
  8. yum install -y createrepo
  9. _ID=$(docker run --rm centos:7.2.1511 /bin/bash -c "sleep 10800")
  10. export _ID
  11.  
  12. # 因为网络问题,有执行失败的风险,以下命令手动一条一条执行吧。
  13. # 如果报错失败,重新执行当前这条即可,一直到返回成功的信息为止。
  14. docker exec $_ID /bin/bash -c "yum install -y epel-release && echo 'DONE...'"
  15. docker exec $_ID /bin/bash -c "yum install --downloadonly pcre pcre-devel \
  16. libxml2 libxml2-devel libxslt libxslt-devel gd gd-devel wget curl curl-devel \
  17. gcc gcc-c++ glibc glibc-devel glibc-static bzip2 bzip2-devel unzip zip zlib \
  18. zlib-devel make automake autoconf libtool postgresql postgresql-devel \
  19. libpqxx libpqxx-devel patch lsof net-tools binutils psmisc iproute coreutils \
  20. && echo 'DONE...'"
  21. docker cp $_ID:/var/cache/yum $_DIR/yum_tmp
  22. [ -d $_DIR/yumpkgs ] && rm -rf $_DIR/yumpkgs
  23. mkdir -p $_DIR/yumpkgs
  24. find $_DIR/yum_tmp -type f -name "*.rpm" -exec mv {} $_DIR/yumpkgs/ \;
  25. createrepo -pdo $_DIR/yumpkgs $_DIR/yumpkgs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement