Add Oracle Linux image generator
This commit is contained in:
parent
0e85866822
commit
48be2df1b0
4
tools/qemu-oraclelinux-image/.gitignore
vendored
Normal file
4
tools/qemu-oraclelinux-image/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
|
!Dockerfile.template
|
||||||
|
!generate-images.sh
|
48
tools/qemu-oraclelinux-image/Dockerfile.template
Normal file
48
tools/qemu-oraclelinux-image/Dockerfile.template
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
FROM oraclelinux:_VERSION_
|
||||||
|
|
||||||
|
RUN yum -y update
|
||||||
|
RUN yum -y groupinstall "Development Tools"
|
||||||
|
RUN yum -y install qemu-img e2fsprogs
|
||||||
|
|
||||||
|
ENV TMPDIR=/tmp/oraclelinux
|
||||||
|
|
||||||
|
RUN sed -i 's/$ociregion//' /etc/yum.repos.d/*
|
||||||
|
RUN sed -i 's/$ocidomain/oracle.com/' /etc/yum.repos.d/*
|
||||||
|
|
||||||
|
RUN yum --installroot=$TMPDIR \
|
||||||
|
--releasever=_VERSION_ \
|
||||||
|
--disablerepo='*' \
|
||||||
|
--enablerepo=ol_VERSION__baseos_latest \
|
||||||
|
-y groupinstall Base
|
||||||
|
|
||||||
|
RUN cp /etc/yum.repos.d/* $TMPDIR/etc/yum.repos.d/
|
||||||
|
|
||||||
|
RUN yum --installroot=$TMPDIR \
|
||||||
|
--releasever=_VERSION_ \
|
||||||
|
--disablerepo='*' \
|
||||||
|
--enablerepo=ol_VERSION__baseos_latest \
|
||||||
|
-y install openssh-server openssh-clients dhclient
|
||||||
|
|
||||||
|
RUN chroot $TMPDIR /bin/sh -c 'useradd -m user'
|
||||||
|
RUN sed -i 's/root:\*:/root::/' $TMPDIR/etc/shadow
|
||||||
|
RUN sed -i 's/user:!!:/user::/' $TMPDIR/etc/shadow
|
||||||
|
RUN sed -i '/PermitEmptyPasswords/d' $TMPDIR/etc/ssh/sshd_config
|
||||||
|
RUN echo PermitEmptyPasswords yes >> $TMPDIR/etc/ssh/sshd_config
|
||||||
|
RUN sed -i '/PermitRootLogin/d' $TMPDIR/etc/ssh/sshd_config
|
||||||
|
RUN echo PermitRootLogin yes >> $TMPDIR/etc/ssh/sshd_config
|
||||||
|
|
||||||
|
# network workaround
|
||||||
|
RUN chmod +x $TMPDIR/etc/rc.local
|
||||||
|
RUN echo 'dhclient' >> $TMPDIR/etc/rc.local
|
||||||
|
|
||||||
|
ENV IMAGEDIR=/tmp/image
|
||||||
|
ENV IMAGE=/shared/out_of_tree_oraclelinux__VERSION_.img
|
||||||
|
|
||||||
|
RUN mkdir $IMAGEDIR
|
||||||
|
|
||||||
|
# Must be executed with --privileged because of /dev/loop
|
||||||
|
CMD qemu-img create $IMAGE 4G && \
|
||||||
|
mkfs.ext4 -F $IMAGE && \
|
||||||
|
mount -o loop $IMAGE $IMAGEDIR && \
|
||||||
|
cp -a $TMPDIR/* $IMAGEDIR/ && \
|
||||||
|
umount $IMAGEDIR
|
15
tools/qemu-oraclelinux-image/generate-images.sh
Executable file
15
tools/qemu-oraclelinux-image/generate-images.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh -eux
|
||||||
|
|
||||||
|
for version in 6 7 8 9; do
|
||||||
|
mkdir $version
|
||||||
|
sed "s/_VERSION_/${version}/" Dockerfile.template >> $version/Dockerfile
|
||||||
|
if [[ $version -eq 6 ]]; then
|
||||||
|
sed -i 's/baseos_latest/u10_base/' $version/Dockerfile
|
||||||
|
fi
|
||||||
|
if [[ $version -eq 7 ]]; then
|
||||||
|
sed -i 's/baseos_latest/u9_base/' $version/Dockerfile
|
||||||
|
fi
|
||||||
|
docker build -t gen-oraclelinux${version}-image $version
|
||||||
|
rm -rf $version
|
||||||
|
docker run --privileged -v $(pwd):/shared -t gen-oraclelinux${version}-image
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user