[UPDATE] - oracle 8.X
This commit is contained in:
parent
862f52fb53
commit
d4a41cf128
5
.env
5
.env
@ -4,7 +4,10 @@
|
||||
# Version of image
|
||||
RepoVers=1
|
||||
# Centos Version
|
||||
CentOsVersion=7.9.2009
|
||||
#CentOsVersion=centos:7.9.2009
|
||||
CentOsVersion=oraclelinux:8.6
|
||||
Cible=oraclelinux
|
||||
VersionCible=8.6
|
||||
# Sync repo script
|
||||
Run=/usr/local/bin/sync.sh
|
||||
# Sync arg script
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
FROM centos:${CentOsVersion}
|
||||
#FROM centos:${CentOsVersion}
|
||||
#FROM ${CentOsVersion}
|
||||
FROM ${Cible}:${VersionCible}
|
||||
LABEL maintainer='Guillaume Astier Ruiz'
|
||||
|
||||
ENV os='centos'
|
||||
ENV osversion='7'
|
||||
ENV os="${Cible}"
|
||||
ENV osversion="${VersionCible}"
|
||||
ENV ESL-TOOLS=repo
|
||||
ENV TERM=xterm
|
||||
|
||||
RUN yum update -y
|
||||
|
||||
@ -11,9 +14,23 @@ RUN yum update -y
|
||||
|
||||
RUN yum install yum-utils createrepo vim wget -y
|
||||
RUN yum install epel-release -y
|
||||
COPY ./bin/sync.sh /usr/local/bin/sync.sh
|
||||
RUN chmod 755 /usr/local/bin/sync.sh
|
||||
COPY ./bin/empty.sh /usr/local/bin/empty.sh
|
||||
RUN chmod 755 /usr/local/bin/empty.sh
|
||||
RUN yum install screen -y
|
||||
#COPY ./bin/sync.sh /usr/local/bin/sync.sh
|
||||
COPY ./bin/ /usr/local/bin/
|
||||
#RUN chmod 755 /usr/local/bin/sync.sh
|
||||
RUN chmod 755 /usr/local/bin/*
|
||||
#COPY ./bin/empty.sh /usr/local/bin/empty.sh
|
||||
#RUN chmod 755 /usr/local/bin/empty.sh
|
||||
|
||||
|
||||
|
||||
RUN yum install openssl -y
|
||||
RUN groupadd esl -g 1000
|
||||
RUN useradd -s /bin/bash -g 1000 -u 1000 -p "$(/usr/bin/openssl passwd -1 esl)" esl
|
||||
RUN mkdir /data
|
||||
RUN chown -R esl:esl /data
|
||||
USER esl
|
||||
|
||||
|
||||
CMD ${Run} ${RunArg}
|
||||
#ENTRYPOINT [ "${Run}" "${RunArg}" ]
|
||||
|
||||
@ -6,5 +6,6 @@ services:
|
||||
image: esl-repo:${RepoVers}
|
||||
volumes:
|
||||
- ./data:/data
|
||||
- ./log:/tmp/log
|
||||
- ./bin:/usr/local/bin
|
||||
|
||||
|
||||
@ -54,8 +54,9 @@ DeleteFile() {
|
||||
|
||||
DockerConnect() {
|
||||
|
||||
Inst=$(docker ps|grep $(dirname .)_esl\-$1 | awk '{print $NF}')
|
||||
docker exec -ti ${Inst} bash
|
||||
Inst=$(docker ps|grep "esl-$1" | awk '{print $NF}')
|
||||
[[ -z "${Inst}" ]] && docker run -ti -v $(realpath $(dirname $0))/data:/data -u esl esl\-${1}:1 bash || docker exec -ti ${Inst} bash
|
||||
echo DEBUG $Inst $1
|
||||
|
||||
}
|
||||
DockerPs() {
|
||||
@ -67,7 +68,7 @@ DockerPs() {
|
||||
|
||||
|
||||
DockerStop() {
|
||||
for DockerRun in $(docker ps|grep $(dirname .)_esl\- | awk '{print $NF}')
|
||||
for DockerRun in $(docker ps|grep esl\- | awk '{print $NF}')
|
||||
do
|
||||
echo -n "Stop $DockerRun ... :"
|
||||
docker stop $DockerRun &> /dev/null
|
||||
@ -122,8 +123,10 @@ DockerComposeRun () {
|
||||
[[ -f ${Wai}/docker-compose.yml ]] && rm -f ${Wai}/docker-compose.yml
|
||||
[[ "$2" == "Print" ]] && Print="-d" || Print=""
|
||||
cp ${Wai}/Template/docker-compose.yml.$1 ${Wai}/docker-compose.yml
|
||||
echo -n "Starting DOCKER $1 ... : "
|
||||
yes | docker-compose up ${Print} --remove-orphans 2>&1 | tee /tmp/RunDocker-${1}.log &> /dev/null
|
||||
echo "Log is : log/${1} - use tail -f ./log/$1"
|
||||
docker run -ti -v $(realpath $(dirname $0))/data:/data -u esl esl-repo:1 /usr/local/bin/sync.sh
|
||||
#yes | docker-compose up ${Print} --remove-orphans 1>&1 | tee /tmp/RunDocker-${1}.log &> /dev/null
|
||||
##yes | docker-compose up ${Print} --remove-orphans
|
||||
Res $?
|
||||
echo "
|
||||
--------- Log Esl -----------
|
||||
|
||||
72
bin/common.fct
Normal file
72
bin/common.fct
Normal file
@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
|
||||
MoveCurr(){
|
||||
cpt=$1
|
||||
if [[ $cpt -ge 4 ]]
|
||||
then
|
||||
cpt=1
|
||||
else
|
||||
((cpt++))
|
||||
fi
|
||||
case $1 in
|
||||
1) echo '/' $cpt;;
|
||||
2) echo '-' $cpt;;
|
||||
3) echo '\' $cpt;;
|
||||
4) echo '|' $cpt;;
|
||||
esac
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Download (){
|
||||
Rep=$1
|
||||
cpt=1
|
||||
#tput ed
|
||||
|
||||
tput sc
|
||||
while [[ ! -z $(ps axf| grep reposync | grep -v grep) ]]
|
||||
do
|
||||
#DataCurr=$(MoveCurr $cpt)
|
||||
read -r Curr cpt <<< $(MoveCurr $cpt)
|
||||
#Curr=$(echo $DataCurr | cut -d" " -f1)
|
||||
#cpt=$(echo $DataCurr | cut -d" " -f2)
|
||||
Orpm=${Rpm}
|
||||
OrpmName=$(basename ${Orpm:-/}| sed 's/-[0-9]/|/g' | cut -d"|" -f1)
|
||||
Rpm=$(find $Rep -type f -name "*.rpm" -printf "%T@ %p\n" | sort -n | cut -d' ' -f 2- | tail -n 1)
|
||||
RpmName=$(basename ${Rpm:-/}| sed 's/-[0-9]/|/g' | cut -d"|" -f1)
|
||||
#Curr=$(MoveCurr $cpt)
|
||||
tput rc; tput el
|
||||
echo -ne "\r[${Curr}] - Downloading ${RpmName:-/}\r"
|
||||
sleep 0.2
|
||||
echo "DEBUG : $cpt $Curr" > /tmp/a
|
||||
done
|
||||
|
||||
|
||||
|
||||
}
|
||||
Action() {
|
||||
echo -n "$1 : "
|
||||
shift
|
||||
$* &> /dev/null
|
||||
if [[ $? -eq 0 ]]
|
||||
then
|
||||
echo "$(tput setaf 2)OK$(tput sgr0)"
|
||||
else
|
||||
echo "$(tput setaf 1)FAILED$(tput sgr0)"
|
||||
|
||||
fi
|
||||
Tot=$((Tot+$1))
|
||||
|
||||
}
|
||||
|
||||
WhileTrue() {
|
||||
|
||||
while true
|
||||
do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
|
||||
60
bin/esl.fct
Normal file
60
bin/esl.fct
Normal file
@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
|
||||
function centos() {
|
||||
|
||||
Repo=epel
|
||||
Action "Get 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
|
||||
|
||||
|
||||
Action "Move SeanAps EPEL : " mkdir -p /data/repo/EPEL/el7/x86_64/Packages ; for var in $(find /data/repo/epel/ -name *rpm -type f) ; do mv $var /data/repo/EPEL/el7/x86_64/Packages; done
|
||||
|
||||
|
||||
|
||||
Action "Create repo epel : " cd /data/repo/EPEL/el7/x86_64/ && createrepo -v /data/repo/EPEL/el7/x86_64/ 2>&1 | tee /data/log/CreateRepo_${Repo}.log &> /dev/null
|
||||
|
||||
Action "Get OS BASE : " mkdir -p /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
|
||||
|
||||
|
||||
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/*
|
||||
|
||||
Action "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
|
||||
|
||||
|
||||
#Action "Clean" 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/
|
||||
|
||||
}
|
||||
|
||||
RunScreen (){
|
||||
Name=$1
|
||||
shift
|
||||
Data="$*"
|
||||
screen -dmS $Name ${Data}
|
||||
|
||||
}
|
||||
|
||||
function oraclelinux () {
|
||||
|
||||
Rand=repo${RANDOM}
|
||||
Majeur=$(echo ${osversion} | cut -d"." -f1)
|
||||
Mineur=$(echo ${osversion} | cut -d"." -f2)
|
||||
|
||||
Action "Create Dir ${osversion}" mkdir -p /data/repo/OracleLinux/${osversion}/
|
||||
RunScreen appstream dnf reposync -g --newest-only --exclude='*.src' -p /data/repo/OracleLinux/${osversion}/ --download-metadata --repoid=ol${Majeur}_appstream
|
||||
Download /data/repo/OracleLinux/${osversion}/
|
||||
Action "Move SeaNaps environement" mv /data/repo/OracleLinux/${osversion}/ol${Majeur}_appstream /data/repo/OracleLinux/${osversion}/appstream
|
||||
|
||||
Action "Create BIN environement" mkdir -p /data/repo/OracleLinux/${osversion}/appstream/x86_64
|
||||
Action "Move data rpm in BIN environtment" mv /data/repo/OracleLinux/${osversion}/appstream/{getPackage,repodata} /data/repo/OracleLinux/${osversion}/appstream/x86_64
|
||||
|
||||
|
||||
Action "Create Dir ${osversion}" mkdir -p /data/repo/OracleLinux/${osversion}/
|
||||
RunScreen appstream dnf reposync -g --newest-only --exclude='*.src' -p /data/repo/OracleLinux/${osversion}/ --download-metadata --repoid=ol${Majeur}_u${Mineur}_baseos_base
|
||||
|
||||
Download /data/repo/OracleLinux/${osversion}/
|
||||
Action "Move SeaNaps environement" mv /data/repo/OracleLinux/${osversion}/baseos/latest/x86_64/*/{getPackage,repodata} /data/repo/OracleLinux/${osversion}/baseos/latest/x86_64/
|
||||
|
||||
}
|
||||
66
bin/sync.sh
66
bin/sync.sh
@ -1,28 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
source $(dirname $0)/esl.fct
|
||||
source $(dirname $0)/common.fct
|
||||
|
||||
|
||||
Res() {
|
||||
if [[ $1 -eq 0 ]]
|
||||
then
|
||||
echo "$(tput setaf 2)OK$(tput sgr0)"
|
||||
else
|
||||
echo "$(tput setaf 1)FAILED$(tput sgr0)"
|
||||
fi
|
||||
Tot=$((Tot+$1))
|
||||
|
||||
}
|
||||
|
||||
WhileTrue() {
|
||||
|
||||
while true
|
||||
do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
Tot=0
|
||||
[[ $1 == "debug" ]] && WhileTrue
|
||||
|
||||
@ -32,46 +14,12 @@ Tot=0
|
||||
[[ ! -d /data/repo ]] && mkdir -p /data/repo
|
||||
|
||||
|
||||
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 $?
|
||||
|
||||
echo -n "Move SeanAps EPEL : "
|
||||
mkdir -p /data/repo/EPEL/el7/x86_64/Packages &&
|
||||
for var in $(find /data/repo/epel/ -name *rpm -type f) ; do mv $var /data/repo/EPEL/el7/x86_64/Packages; done
|
||||
Res $?
|
||||
|
||||
|
||||
echo -n "Create repo epel : "
|
||||
cd /data/repo/EPEL/el7/x86_64/
|
||||
createrepo -v /data/repo/EPEL/el7/x86_64/ 2>&1 | tee /data/log/CreateRepo_${Repo}.log &> /dev/null
|
||||
Res $?
|
||||
|
||||
|
||||
|
||||
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/
|
||||
|
||||
case ${os} in
|
||||
centos) centos |tee /tmp/log/repo;;
|
||||
oraclelinux) oraclelinux |tee /tmp/log/repo;;
|
||||
*) echo "Nothing is possible ..."; Tot=666;;
|
||||
esac
|
||||
|
||||
|
||||
exit $Tot
|
||||
|
||||
0
log/.gitkeep
Normal file
0
log/.gitkeep
Normal file
Loading…
x
Reference in New Issue
Block a user