[UPDATE] - add epel
This commit is contained in:
parent
418093e181
commit
f088671e32
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
./data
|
||||||
12
Dockerfile
12
Dockerfile
@ -1,6 +1,6 @@
|
|||||||
FROM centos:7.9.2009
|
|
||||||
|
FROM centos:${CentOsVersion}
|
||||||
ENV container docker
|
ENV container docker
|
||||||
RUN echo coucou
|
|
||||||
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
|
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
|
||||||
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
|
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
|
||||||
rm -f /lib/systemd/system/multi-user.target.wants/*;\
|
rm -f /lib/systemd/system/multi-user.target.wants/*;\
|
||||||
@ -11,9 +11,15 @@ rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
|
|||||||
rm -f /lib/systemd/system/basic.target.wants/*;\
|
rm -f /lib/systemd/system/basic.target.wants/*;\
|
||||||
rm -f /lib/systemd/system/anaconda.target.wants/*;
|
rm -f /lib/systemd/system/anaconda.target.wants/*;
|
||||||
VOLUME [ "/sys/fs/cgroup" ]
|
VOLUME [ "/sys/fs/cgroup" ]
|
||||||
|
|
||||||
|
|
||||||
RUN yum install yum-utils createrepo vim -y
|
RUN yum install yum-utils createrepo vim -y
|
||||||
RUN yum install epel-release -y
|
RUN yum install epel-release -y
|
||||||
COPY ./bin/sync.sh /bin/sync.sh
|
COPY ./bin/sync.sh /bin/sync.sh
|
||||||
RUN chmod 755 /bin/sync.sh
|
RUN chmod 755 /bin/sync.sh
|
||||||
|
COPY ./bin/empty.sh /bin/empty.sh
|
||||||
|
RUN chmod 755 /bin/empty.sh
|
||||||
|
|
||||||
#CMD ["/usr/sbin/init"]
|
#CMD ["/usr/sbin/init"]
|
||||||
CMD ["/bin/sync.sh"]
|
#CMD ["/bin/sync.sh"]
|
||||||
|
CMD ["/bin/${Run}"]
|
||||||
|
|||||||
7
bin/empty.sh
Executable file
7
bin/empty.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
67
bin/sync.sh
67
bin/sync.sh
@ -1,10 +1,63 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
[[ ! -d /data/log ]] && mkdir /data/log
|
|
||||||
[[ ! -d /data/repo ]] && mkdir /data/repo
|
|
||||||
for Repo in $(yum repolist | grep x86_64 | awk -F'/' '{print $1}')
|
Res() {
|
||||||
do
|
if [[ $1 -eq 0 ]]
|
||||||
echo "$Repo"
|
then
|
||||||
reposync --gpgcheck -l --repoid=${Repo} --download_path=/data/repo/ | tee /data/log/${Repo}.log
|
echo "$(tput setaf 2)OK$(tput sgr0)"
|
||||||
done
|
else
|
||||||
|
echo "$(tput setaf 1)FAILED$(tput sgr0)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[[ $1 == "del" ]] && rm -Rf /data/repo /data/log
|
||||||
|
|
||||||
|
[[ ! -d /data/log ]] && mkdir -p /data/log
|
||||||
|
[[ ! -d /data/repo ]] && mkdir -p /data/repo
|
||||||
|
|
||||||
|
|
||||||
|
echo -n "Get OS BASE : "
|
||||||
|
mkdir /data/repo/tmp/
|
||||||
|
cd /data/repo/tmp/
|
||||||
|
wget -r -p -k http://mirror.centos.org/centos/7.9.2009/os/x86_64/ 2>&1 | tee /data/log/get_base.log &> /dev/null
|
||||||
|
Res $?
|
||||||
|
|
||||||
|
for var in $(find .| grep index.html) ;do rm -f $var;done
|
||||||
|
mkdir -p /data/repo/CentOS/7.9/os/
|
||||||
|
mv /data/repo/tmp/mirror.centos.org/centos/7.9.2009/os/x86_64/ /data/repo/CentOS/7.9/os/
|
||||||
|
|
||||||
|
rm -rf /data/repo/tmp/*
|
||||||
|
|
||||||
|
echo -n "Get OS updates : "
|
||||||
|
cd /data/repo/tmp/
|
||||||
|
wget -r -p -k http://mirror.centos.org/centos/7.9.2009/updates/x86_64/ 2>&1 | tee /data/log/get_updates.log &> /dev/null
|
||||||
|
Res $?
|
||||||
|
|
||||||
|
for var in $(find . | grep index.html) ;do rm -f $var;done
|
||||||
|
mkdir -p /data/repo/CentOS/7.9/updates
|
||||||
|
mv /data/repo/tmp/mirror.centos.org/centos/7.9.2009/updates/x86_64/ /data/repo/CentOS/7.9/updates/
|
||||||
|
rm -Rf /data/repo/tmp/
|
||||||
|
|
||||||
|
|
||||||
|
echo -n "Get epel : "
|
||||||
|
Repo=epel
|
||||||
|
reposync -l --newest-only --delete --downloadcomps --download-metadata --repoid=${Repo} --download_path=/data/repo/ 2>&1 | tee /data/log/get_${Repo}.log &> /dev/null
|
||||||
|
Res $?
|
||||||
|
for var in $(find /data/repo/epel/ -name *rpm) ; do mv $var /data/repo/epel/Packages/; done
|
||||||
|
echo -n "Create repo epel : "
|
||||||
|
cd /data/repo/epel
|
||||||
|
createrepo -v /data/repo/epel 2>&1 | tee /data/log/CreateRepo_${Repo}.log &> /dev/null
|
||||||
|
Res $?
|
||||||
|
|
||||||
|
echo -n "Move EPEL : "
|
||||||
|
mkdir -p /data/repo/EPEL/el7/x86_64/ &&
|
||||||
|
mv /data/repo/epel/* /data/repo/EPEL/el7/x86_64/ &&
|
||||||
|
rmdir /data/repo/epel/
|
||||||
|
Res $?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user