Compare commits
1 Commits
486bd5b715
...
5c40f8d4a4
Author | SHA1 | Date | |
---|---|---|---|
5c40f8d4a4 |
4
.github/workflows/images-debian.yml
vendored
4
.github/workflows/images-debian.yml
vendored
@ -40,7 +40,7 @@ jobs:
|
|||||||
sleep 1s
|
sleep 1s
|
||||||
done
|
done
|
||||||
|
|
||||||
ssh root@$IP "cloud-init status --wait | grep done"
|
ssh root@$IP "cloud-init status --wait"
|
||||||
|
|
||||||
ssh root@$IP apt-get update
|
ssh root@$IP apt-get update
|
||||||
ssh root@$IP apt-get install -y git podman s3cmd
|
ssh root@$IP apt-get install -y git podman s3cmd
|
||||||
@ -56,7 +56,7 @@ jobs:
|
|||||||
|
|
||||||
ssh root@$IP "echo 'ExecStart=/root/out-of-tree/tools/qemu-debian-img/generate-images.sh' >> /etc/systemd/system/images-debian.service"
|
ssh root@$IP "echo 'ExecStart=/root/out-of-tree/tools/qemu-debian-img/generate-images.sh' >> /etc/systemd/system/images-debian.service"
|
||||||
|
|
||||||
ssh root@$IP 'echo ExecStart=/bin/sh -c \"s3cmd put --acl-public /root/out-of-tree/tools/qemu-debian-img/*.tar.gz s3://out-of-tree/3.0.0/ --host=\$HOST --host-bucket=\$HOST_BUCKET --access_key=\$ACCESS_KEY --secret_key=\$SECRET_KEY\" >> /etc/systemd/system/images-debian.service'
|
ssh root@$IP 'echo ExecStart=/bin/sh -c \"s3cmd put --acl-public /root/out-of-tree/tools/qemu-debian-img/*.tar.gz s3://out-of-tree/1.0.0/ --host=\$HOST --host-bucket=\$HOST_BUCKET --access_key=\$ACCESS_KEY --secret_key=\$SECRET_KEY\" >> /etc/systemd/system/images-debian.service'
|
||||||
|
|
||||||
ssh root@$IP "echo TimeoutStopSec=1 >> /etc/systemd/system/images-debian.service"
|
ssh root@$IP "echo TimeoutStopSec=1 >> /etc/systemd/system/images-debian.service"
|
||||||
|
|
||||||
|
4
.github/workflows/images-oraclelinux.yml
vendored
4
.github/workflows/images-oraclelinux.yml
vendored
@ -40,7 +40,7 @@ jobs:
|
|||||||
sleep 1s
|
sleep 1s
|
||||||
done
|
done
|
||||||
|
|
||||||
ssh root@$IP "cloud-init status --wait | grep done"
|
ssh root@$IP "cloud-init status --wait"
|
||||||
|
|
||||||
ssh root@$IP apt-get update
|
ssh root@$IP apt-get update
|
||||||
ssh root@$IP apt-get install -y git podman s3cmd
|
ssh root@$IP apt-get install -y git podman s3cmd
|
||||||
@ -56,7 +56,7 @@ jobs:
|
|||||||
|
|
||||||
ssh root@$IP "echo 'ExecStart=/root/out-of-tree/tools/qemu-oraclelinux-img/generate-images.sh' >> /etc/systemd/system/images-oraclelinux.service"
|
ssh root@$IP "echo 'ExecStart=/root/out-of-tree/tools/qemu-oraclelinux-img/generate-images.sh' >> /etc/systemd/system/images-oraclelinux.service"
|
||||||
|
|
||||||
ssh root@$IP 'echo ExecStart=/bin/sh -c \"s3cmd put --acl-public /root/out-of-tree/tools/qemu-oraclelinux-img/*.tar.gz s3://out-of-tree/3.0.0/ --host=\$HOST --host-bucket=\$HOST_BUCKET --access_key=\$ACCESS_KEY --secret_key=\$SECRET_KEY\" >> /etc/systemd/system/images-oraclelinux.service'
|
ssh root@$IP 'echo ExecStart=/bin/sh -c \"s3cmd put --acl-public /root/out-of-tree/tools/qemu-oraclelinux-img/*.tar.gz s3://out-of-tree/1.0.0/ --host=\$HOST --host-bucket=\$HOST_BUCKET --access_key=\$ACCESS_KEY --secret_key=\$SECRET_KEY\" >> /etc/systemd/system/images-oraclelinux.service'
|
||||||
|
|
||||||
ssh root@$IP "echo TimeoutStopSec=1 >> /etc/systemd/system/images-oraclelinux.service"
|
ssh root@$IP "echo TimeoutStopSec=1 >> /etc/systemd/system/images-oraclelinux.service"
|
||||||
|
|
||||||
|
2
.github/workflows/images-ubuntu.yml
vendored
2
.github/workflows/images-ubuntu.yml
vendored
@ -58,7 +58,7 @@ jobs:
|
|||||||
|
|
||||||
ssh root@$IP "echo 'ExecStart=/root/out-of-tree/tools/qemu-ubuntu-img/generate-images.py' >> /etc/systemd/system/images-ubuntu.service"
|
ssh root@$IP "echo 'ExecStart=/root/out-of-tree/tools/qemu-ubuntu-img/generate-images.py' >> /etc/systemd/system/images-ubuntu.service"
|
||||||
|
|
||||||
ssh root@$IP 'echo ExecStart=/bin/sh -c \"s3cmd put --acl-public /root/out-of-tree/tools/qemu-ubuntu-img/*.tar.gz s3://out-of-tree/3.0.0/ --host=\$HOST --host-bucket=\$HOST_BUCKET --access_key=\$ACCESS_KEY --secret_key=\$SECRET_KEY\" >> /etc/systemd/system/images-ubuntu.service'
|
ssh root@$IP 'echo ExecStart=/bin/sh -c \"s3cmd put --acl-public /root/out-of-tree/tools/qemu-ubuntu-img/*.tar.gz s3://out-of-tree/1.0.0/ --host=\$HOST --host-bucket=\$HOST_BUCKET --access_key=\$ACCESS_KEY --secret_key=\$SECRET_KEY\" >> /etc/systemd/system/images-ubuntu.service'
|
||||||
|
|
||||||
ssh root@$IP "echo TimeoutStopSec=1 >> /etc/systemd/system/images-ubuntu.service"
|
ssh root@$IP "echo TimeoutStopSec=1 >> /etc/systemd/system/images-ubuntu.service"
|
||||||
|
|
||||||
|
35
tools/qemu-ubuntu-img/14.04/Dockerfile
Normal file
35
tools/qemu-ubuntu-img/14.04/Dockerfile
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# Copyright 2018 Mikhail Klementev. All rights reserved.
|
||||||
|
# Use of this source code is governed by a AGPLv3 license
|
||||||
|
# (or later) that can be found in the LICENSE file.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# $ docker build -t gen-ubuntu1404-image .
|
||||||
|
# $ docker run --privileged -v $(pwd):/shared -t gen-ubuntu1404-image
|
||||||
|
#
|
||||||
|
# ubuntu1404.img will be created in current directory. You can change $(pwd) to
|
||||||
|
# different directory to use different destination for image.
|
||||||
|
#
|
||||||
|
FROM ubuntu:14.04
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y debootstrap qemu
|
||||||
|
|
||||||
|
ENV TMPDIR=/tmp/ubuntu
|
||||||
|
ENV IMAGEDIR=/tmp/image
|
||||||
|
ENV IMAGE=/shared/out_of_tree_ubuntu_14__04.img
|
||||||
|
ENV REPOSITORY=http://archive.ubuntu.com/ubuntu
|
||||||
|
ENV RELEASE=trusty
|
||||||
|
|
||||||
|
RUN mkdir $IMAGEDIR
|
||||||
|
|
||||||
|
# Must be executed with --privileged because of /dev/loop
|
||||||
|
CMD debootstrap --include=openssh-server,policykit-1 \
|
||||||
|
$RELEASE $TMPDIR $REPOSITORY && \
|
||||||
|
/shared/setup.sh $TMPDIR && \
|
||||||
|
qemu-img create $IMAGE 2G && \
|
||||||
|
mkfs.ext4 -F $IMAGE && \
|
||||||
|
mount -o loop $IMAGE $IMAGEDIR && \
|
||||||
|
cp -a $TMPDIR/* $IMAGEDIR/ && \
|
||||||
|
umount $IMAGEDIR
|
19
tools/qemu-ubuntu-img/14.04/setup.sh
Executable file
19
tools/qemu-ubuntu-img/14.04/setup.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh -eux
|
||||||
|
# Copyright 2018 Mikhail Klementev. All rights reserved.
|
||||||
|
# Use of this source code is governed by a AGPLv3 license
|
||||||
|
# (or later) that can be found in the LICENSE file.
|
||||||
|
TMPDIR=$1
|
||||||
|
chroot $TMPDIR /bin/sh -c 'useradd -m user'
|
||||||
|
sed -i 's/root:\*:/root::/' $TMPDIR/etc/shadow
|
||||||
|
sed -i 's/user:!!:/user::/' $TMPDIR/etc/shadow
|
||||||
|
echo auth sufficient pam_permit.so > $TMPDIR/etc/pam.d/sshd
|
||||||
|
sed -i '/PermitEmptyPasswords/d' $TMPDIR/etc/ssh/sshd_config
|
||||||
|
echo PermitEmptyPasswords yes >> $TMPDIR/etc/ssh/sshd_config
|
||||||
|
sed -i '/PermitRootLogin/d' $TMPDIR/etc/ssh/sshd_config
|
||||||
|
echo PermitRootLogin yes >> $TMPDIR/etc/ssh/sshd_config
|
||||||
|
sed -i '/UseDNS/d' $TMPDIR/etc/ssh/sshd_config
|
||||||
|
echo UseDNS no >> $TMPDIR/etc/ssh/sshd_config
|
||||||
|
|
||||||
|
echo '#!/bin/sh' > $TMPDIR/etc/rc.local
|
||||||
|
echo 'dhclient eth0' >> $TMPDIR/etc/rc.local
|
||||||
|
chmod +x $TMPDIR/etc/rc.local
|
@ -7,13 +7,13 @@ script_dir = os.path.dirname(os.path.realpath(__file__))
|
|||||||
os.chdir(script_dir)
|
os.chdir(script_dir)
|
||||||
|
|
||||||
releases = [
|
releases = [
|
||||||
('12.04', 'precise', 'http://old-releases.ubuntu.com/ubuntu')
|
# ('12.04', 'precies'),
|
||||||
('14.04', 'trusty', 'http://archive.ubuntu.com/ubuntu')
|
# ('14.04', 'trusty'),
|
||||||
('16.04', 'xenial', 'http://archive.ubuntu.com/ubuntu')
|
# ('16.04', 'xenial'),
|
||||||
('18.04', 'bionic', 'http://archive.ubuntu.com/ubuntu')
|
# ('18.04', 'bionic'),
|
||||||
('20.04', 'focal', 'http://archive.ubuntu.com/ubuntu')
|
# ('20.04', 'focal'),
|
||||||
('22.04', 'jammy', 'http://archive.ubuntu.com/ubuntu')
|
# ('22.04', 'jammy'),
|
||||||
('24.04', 'noble', 'http://archive.ubuntu.com/ubuntu')
|
('24.04', 'noble'),
|
||||||
]
|
]
|
||||||
|
|
||||||
template = '''
|
template = '''
|
||||||
@ -27,7 +27,7 @@ RUN apt install -y linux-image-generic
|
|||||||
ENV TMPDIR=/tmp/ubuntu
|
ENV TMPDIR=/tmp/ubuntu
|
||||||
ENV IMAGEDIR=/tmp/image
|
ENV IMAGEDIR=/tmp/image
|
||||||
ENV IMAGE=/shared/out_of_tree_ubuntu_{img_version}.img
|
ENV IMAGE=/shared/out_of_tree_ubuntu_{img_version}.img
|
||||||
ENV REPOSITORY={repository}
|
ENV REPOSITORY=http://archive.ubuntu.com/ubuntu
|
||||||
ENV RELEASE={codename}
|
ENV RELEASE={codename}
|
||||||
|
|
||||||
RUN mkdir $IMAGEDIR
|
RUN mkdir $IMAGEDIR
|
||||||
@ -47,7 +47,7 @@ def run_cmd(cmd):
|
|||||||
print(f"+ {cmd}")
|
print(f"+ {cmd}")
|
||||||
subprocess.run(cmd, shell=True, check=True, executable='/bin/bash')
|
subprocess.run(cmd, shell=True, check=True, executable='/bin/bash')
|
||||||
|
|
||||||
for version, codename, repository in releases:
|
for version, codename in releases:
|
||||||
numeric_version = version.replace('.', '')
|
numeric_version = version.replace('.', '')
|
||||||
img_version=version.replace(".","__")
|
img_version=version.replace(".","__")
|
||||||
|
|
||||||
@ -55,7 +55,6 @@ for version, codename, repository in releases:
|
|||||||
version=version,
|
version=version,
|
||||||
img_version=img_version,
|
img_version=img_version,
|
||||||
codename=codename,
|
codename=codename,
|
||||||
repository=repository,
|
|
||||||
numeric_version=numeric_version)
|
numeric_version=numeric_version)
|
||||||
|
|
||||||
os.makedirs(str(version), exist_ok=True)
|
os.makedirs(str(version), exist_ok=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user