diff --git a/library/anolisos/23.2/Dockerfile b/library/anolisos/23.2/Dockerfile new file mode 100644 index 0000000..079e907 --- /dev/null +++ b/library/anolisos/23.2/Dockerfile @@ -0,0 +1,4 @@ +From scratch +MAINTAINER zhangwenlong@loongson.cn +ADD AnolisOS-23.rootfs.loongarch64.tar.gz / +CMD ["/bin/bash"] diff --git a/library/anolisos/23.2/Makefile b/library/anolisos/23.2/Makefile new file mode 100644 index 0000000..18b103b --- /dev/null +++ b/library/anolisos/23.2/Makefile @@ -0,0 +1,30 @@ +# This file is generated by the template. + +REGISTRY ?=lcr.loongnix.cn +ORGANIZATION ?=library +REPOSITORY ?=anolisos +TAG ?=23.2 +LATEST ?=true + +IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG) +LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest + +default: image + +rootfs: + bash mkimage-rootfs.sh +image: rootfs + docker build \ + --build-arg http_proxy=$(http_proxy) \ + --build-arg https_proxy=$(https_proxy) \ + -t $(IMAGE) \ + . + +push: + docker push $(IMAGE) + #latest image + @if [ $(LATEST) = "true" ]; \ + then \ + docker tag $(IMAGE) $(LATEST_IMAGE); \ + docker push $(LATEST_IMAGE); \ + fi diff --git a/library/anolisos/23.2/mkimage-rootfs.sh b/library/anolisos/23.2/mkimage-rootfs.sh new file mode 100755 index 0000000..58b470e --- /dev/null +++ b/library/anolisos/23.2/mkimage-rootfs.sh @@ -0,0 +1,169 @@ +#!/bin/sh +# +# for AnolisOS 23 +# create rootfs.tar from repository +# +#set -x + +set -e + +arch=loongarch64 +#release=$1 +releasever=23 +version=23 +if [ -z $version ] +then + echo "releasever or version is empty!!!" + exit 1 +fi + +output="AnolisOS-${version}.rootfs.${arch}.tar.gz" + +repos_baseos_url="https://build.openanolis.cn/kojifiles/output/nightly/anolis-23-20241209.4/compose/os/loongarch64/os/" + +trap cleanup TERM EXIT + +work_dir=$(mktemp -d $(pwd)/rootfs-image.XXXXXX) +rootfs=${work_dir}/rootfs + +repo_dir="${work_dir}/yum.repo.d" +repo_conf="${repo_dir}/AnolisOS.repo" +setting_scripts=setting.sh + +pkg_list=" + basesystem bash ca-certificates anolis-gpg-keys anolis-release + anolis-repos chkconfig cracklib crypto-policies dnf passwd + expat gawk gdbm glib2 glibc gmp gnupg2 gpgme grep ima-evm-utils + json-c mpfr ncurses-base procps rpm-build git findutils dnf-plugins-core + npth p11-kit p11-kit-trust pcre pcre2 popt readline rootfiles + rpm sed setup systemd systemd-libs tzdata util-linux vim-minimal xz yum +" +#pkg_list=" +# acl basesystem bash ca-certificates anolis-gpg-keys anolis-release +# anolis-repos chkconfig cracklib crypto-policies dnf +# expat gawk gdbm glib2 glibc gmp gnupg2 gpgme grep ima-evm-utils +# ipcalc iputils json-c kexec-tools kmod langpacks-en less lzo mpfr ncurses-base +# npth p11-kit p11-kit-trust pam pcre pcre2 popt procps-ng readline rootfiles +# rpm sed setup systemd-libs tzdata util-linux vim-minimal xz yum +#" + +#################################################################### +cleanup() +{ + rm -rf ${work_dir} +} +#################################################################### + +mkdir -pv ${rootfs} || : +mkdir -pv ${repo_dir} || : + +#################################################################### +# gen repos conf +#################################################################### +cat > ${repo_conf} << EOF +[baseos] +name=AnolisOS-$releasever-baseos +baseurl=${repos_baseos_url} +gpgcheck=0 +enabled=1 +priority=1 +excludepkgs="${exclude_pkgs}" +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LOONGNIX +EOF +#################################################################### + + +#################################################################### +DNF_OPTS="\ + --setopt=install_weak_deps=False \ + --setopt=reposdir=${repo_dir} \ + --releasever=${releasever} \ + --installroot=${rootfs} \ + --nodocs" + +echo "Install packages : $pkg_list" + +rpmdb --root=${rootfs} --initdb +dnf ${DNF_OPTS} makecache --refresh +dnf ${DNF_OPTS} -y install ${pkg_list} +#################################################################### + +#################################################################### +cat > ${rootfs}/${setting_scripts} << EOF +#!/bin/bash + +## config TERM is linux +echo 'export TERM=linux' >> etc/bash.bashrc +echo 'container' > /etc/dnf/vars/infra + +#Generate installtime file record +/bin/date +%Y%m%d_%H%M > /etc/BUILDTIME + +# Limit languages to help reduce size. +LANG="en_US" +echo "%_install_langs $LANG" > /etc/rpm/macros.image-language-conf +echo "LANG=en_US.UTF-8" > /etc/locale.conf + +pushd /usr/share/locale > /dev/null + ls | egrep -x -v "en|en@arabic|en@boldquot|en@cyrillic|en@greek|en@hebrew|en@piglatin|en@quot|en@shaw|en_CA|en_GB|en_US|locale.alias" | xargs rm -rf +popd > /dev/null + +# systemd fixes +:> /etc/machine-id +systemd-tmpfiles --create --boot +# mask mounts and login bits +systemctl mask systemd-logind.service getty.target console-getty.service +systemctl mask sys-fs-fuse-connections.mount systemd-remount-fs.service dev-hugepages.mount + +# Remove things we don't need +yum clean all > /dev/null +rm -rf /etc/udev/hwdb.bin +rm -rf /usr/lib/udev/hwdb.d/ +rm -rf /boot +rm -rf /var/lib/dnf/history.* +rm -rf /usr/src/ +rm -rf /home/* +rm -rf /var/log/* +rm -rf /var/cache/* +rm -rf /var/lib/yum/* +## Introduced by binutils +rm -rf /usr/bin/gdb +rm -f \$0 +########################################################################### +EOF +#################################################################### + +chmod +x ${rootfs}/${setting_scripts} +chroot ${rootfs} /${setting_scripts} + +##解决在rootfs中su命令没有权限问题 +#file_list="fingerprint-auth password-auth postlogin smartcard-auth system-auth user-profile" +#for file in ${file_list} +#do +# chroot ${rootfs} authselect create-profile ${file} +# chroot ${rootfs} ln -s /etc/authselect/custom/${file} /etc/pam.d/${file} +#done + +##解决在chroot中/dev/null没有权限问题 +chroot ${rootfs} rm -rf /dev/null +chroot ${rootfs} mknod /dev/null c 1 3 +chroot ${rootfs} chmod 666 /dev/null + +cur_dir=$(pwd) +pushd ${rootfs} > /dev/null + if [ -e "${cur_dir}/${output}" ]; then + echo "Remove old ${output}" + rm -rf "${cur_dir}/${output}" + fi + + echo "Generating ${output} ...." +# tar --numeric-owner --exclude='dev/*' -acf "${cur_dir}/${output}" . + tar --numeric-owner -acf "${cur_dir}/${output}" . +popd > /dev/null + +echo "Generating ${output} md5sum...." +sync && md5sum ${output} > ${output}.md5 + +###################################### +sync && echo -e "\n^^^^^^ done ^^^^^^^^^^\n" +###################################### diff --git a/library/loongnix-server/23.1-beta2/Dockerfile b/library/loongnix-server/23.1-beta2/Dockerfile new file mode 100644 index 0000000..0b095b4 --- /dev/null +++ b/library/loongnix-server/23.1-beta2/Dockerfile @@ -0,0 +1,4 @@ +From scratch +MAINTAINER zhangwenlong@loongson.cn +ADD Loongnix-Server-23.rootfs.loongarch64.tar.gz / +CMD ["/bin/bash"] diff --git a/library/loongnix-server/23.1-beta2/Makefile b/library/loongnix-server/23.1-beta2/Makefile new file mode 100644 index 0000000..265128e --- /dev/null +++ b/library/loongnix-server/23.1-beta2/Makefile @@ -0,0 +1,30 @@ +# This file is generated by the template. + +REGISTRY ?=lcr.loongnix.cn +ORGANIZATION ?=library +REPOSITORY ?=loongnix-server +TAG ?=23.1-beta2 +LATEST ?=true + +IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG) +LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest + +default: image + +rootfs: + bash mkimage-rootfs.sh +image: rootfs + docker build \ + --build-arg http_proxy=$(http_proxy) \ + --build-arg https_proxy=$(https_proxy) \ + -t $(IMAGE) \ + . + +push: + docker push $(IMAGE) + #latest image + @if [ $(LATEST) = "true" ]; \ + then \ + docker tag $(IMAGE) $(LATEST_IMAGE); \ + docker push $(LATEST_IMAGE); \ + fi diff --git a/library/loongnix-server/23.1-beta2/mkimage-rootfs.sh b/library/loongnix-server/23.1-beta2/mkimage-rootfs.sh new file mode 100755 index 0000000..5bb93a3 --- /dev/null +++ b/library/loongnix-server/23.1-beta2/mkimage-rootfs.sh @@ -0,0 +1,169 @@ +#!/bin/sh +# +# for Loongnix-Server 23 +# create rootfs.tar from repository +# +#set -x + +set -e + +arch=loongarch64 +#release=$1 +releasever=23 +version=23 +if [ -z $version ] +then + echo "releasever or version is empty!!!" + exit 1 +fi + +output="Loongnix-Server-${version}.rootfs.${arch}.tar.gz" + +repos_baseos_url="https://pkg.loongnix.cn/loongnix-server/23.1/os/loongarch64/" + +trap cleanup TERM EXIT + +work_dir=$(mktemp -d $(pwd)/rootfs-image.XXXXXX) +rootfs=${work_dir}/rootfs + +repo_dir="${work_dir}/yum.repo.d" +repo_conf="${repo_dir}/Loongnix-server.repo" +setting_scripts=setting.sh + +pkg_list=" + basesystem bash ca-certificates loongnix-gpg-keys loongnix-release + loongnix-repos chkconfig cracklib crypto-policies dnf passwd + expat gawk gdbm glib2 glibc gmp gnupg2 gpgme grep ima-evm-utils + json-c mpfr ncurses-base procps rpm-build git findutils dnf-plugins-core + npth p11-kit p11-kit-trust pcre pcre2 popt readline rootfiles + rpm sed setup systemd systemd-libs tzdata util-linux vim-minimal xz yum +" +#pkg_list=" +# acl basesystem bash ca-certificates loongnix-gpg-keys loongnix-release +# loongnix-repos chkconfig cracklib crypto-policies dnf +# expat gawk gdbm glib2 glibc gmp gnupg2 gpgme grep ima-evm-utils +# ipcalc iputils json-c kexec-tools kmod langpacks-en less lzo mpfr ncurses-base +# npth p11-kit p11-kit-trust pam pcre pcre2 popt procps-ng readline rootfiles +# rpm sed setup systemd-libs tzdata util-linux vim-minimal xz yum +#" + +#################################################################### +cleanup() +{ + rm -rf ${work_dir} +} +#################################################################### + +mkdir -pv ${rootfs} || : +mkdir -pv ${repo_dir} || : + +#################################################################### +# gen repos conf +#################################################################### +cat > ${repo_conf} << EOF +[baseos] +name=Loongnix-Server-$releasever-baseos +baseurl=${repos_baseos_url} +gpgcheck=0 +enabled=1 +priority=1 +excludepkgs="${exclude_pkgs}" +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LOONGNIX +EOF +#################################################################### + + +#################################################################### +DNF_OPTS="\ + --setopt=install_weak_deps=False \ + --setopt=reposdir=${repo_dir} \ + --releasever=${releasever} \ + --installroot=${rootfs} \ + --nodocs" + +echo "Install packages : $pkg_list" + +rpmdb --root=${rootfs} --initdb +dnf ${DNF_OPTS} makecache --refresh +dnf ${DNF_OPTS} -y install ${pkg_list} +#################################################################### + +#################################################################### +cat > ${rootfs}/${setting_scripts} << EOF +#!/bin/bash + +## config TERM is linux +echo 'export TERM=linux' >> etc/bash.bashrc +echo 'container' > /etc/dnf/vars/infra + +#Generate installtime file record +/bin/date +%Y%m%d_%H%M > /etc/BUILDTIME + +# Limit languages to help reduce size. +LANG="en_US" +echo "%_install_langs $LANG" > /etc/rpm/macros.image-language-conf +echo "LANG=en_US.UTF-8" > /etc/locale.conf + +pushd /usr/share/locale > /dev/null + ls | egrep -x -v "en|en@arabic|en@boldquot|en@cyrillic|en@greek|en@hebrew|en@piglatin|en@quot|en@shaw|en_CA|en_GB|en_US|locale.alias" | xargs rm -rf +popd > /dev/null + +# systemd fixes +:> /etc/machine-id +systemd-tmpfiles --create --boot +# mask mounts and login bits +systemctl mask systemd-logind.service getty.target console-getty.service +systemctl mask sys-fs-fuse-connections.mount systemd-remount-fs.service dev-hugepages.mount + +# Remove things we don't need +yum clean all > /dev/null +rm -rf /etc/udev/hwdb.bin +rm -rf /usr/lib/udev/hwdb.d/ +rm -rf /boot +rm -rf /var/lib/dnf/history.* +rm -rf /usr/src/ +rm -rf /home/* +rm -rf /var/log/* +rm -rf /var/cache/* +rm -rf /var/lib/yum/* +## Introduced by binutils +rm -rf /usr/bin/gdb +rm -f \$0 +########################################################################### +EOF +#################################################################### + +chmod +x ${rootfs}/${setting_scripts} +chroot ${rootfs} /${setting_scripts} + +##解决在rootfs中su命令没有权限问题 +file_list="fingerprint-auth password-auth postlogin smartcard-auth system-auth user-profile" +for file in ${file_list} +do + chroot ${rootfs} authselect create-profile ${file} + chroot ${rootfs} ln -s /etc/authselect/custom/${file} /etc/pam.d/${file} +done + +##解决在chroot中/dev/null没有权限问题 +chroot ${rootfs} rm -rf /dev/null +chroot ${rootfs} mknod /dev/null c 1 3 +chroot ${rootfs} chmod 666 /dev/null + +cur_dir=$(pwd) +pushd ${rootfs} > /dev/null + if [ -e "${cur_dir}/${output}" ]; then + echo "Remove old ${output}" + rm -rf "${cur_dir}/${output}" + fi + + echo "Generating ${output} ...." +# tar --numeric-owner --exclude='dev/*' -acf "${cur_dir}/${output}" . + tar --numeric-owner -acf "${cur_dir}/${output}" . +popd > /dev/null + +echo "Generating ${output} md5sum...." +sync && md5sum ${output} > ${output}.md5 + +###################################### +sync && echo -e "\n^^^^^^ done ^^^^^^^^^^\n" +###################################### diff --git a/library/openeuler/24.03-LTS-SP1/Dockerfile b/library/openeuler/24.03-LTS-SP1/Dockerfile new file mode 100644 index 0000000..b2b98f2 --- /dev/null +++ b/library/openeuler/24.03-LTS-SP1/Dockerfile @@ -0,0 +1,4 @@ +From scratch +MAINTAINER zhangwenlong@loongson.cn +ADD openEuler-24.03.rootfs.loongarch64.tar.gz / +CMD ["/bin/bash"] diff --git a/library/openeuler/24.03-LTS-SP1/Makefile b/library/openeuler/24.03-LTS-SP1/Makefile new file mode 100644 index 0000000..b9495d6 --- /dev/null +++ b/library/openeuler/24.03-LTS-SP1/Makefile @@ -0,0 +1,30 @@ +# This file is generated by the template. + +REGISTRY ?=lcr.loongnix.cn +ORGANIZATION ?=library +REPOSITORY ?=openeuler +TAG ?=24.03-LTS-SP1 +LATEST ?=true + +IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG) +LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest + +default: image + +rootfs: + bash mkimage-rootfs-openeuler.sh +image: rootfs + docker build \ + --build-arg http_proxy=$(http_proxy) \ + --build-arg https_proxy=$(https_proxy) \ + -t $(IMAGE) \ + . + +push: + docker push $(IMAGE) + #latest image + @if [ $(LATEST) = "true" ]; \ + then \ + docker tag $(IMAGE) $(LATEST_IMAGE); \ + docker push $(LATEST_IMAGE); \ + fi diff --git a/library/openeuler/24.03-LTS-SP1/mkimage-rootfs-openeuler.sh b/library/openeuler/24.03-LTS-SP1/mkimage-rootfs-openeuler.sh new file mode 100755 index 0000000..5f5ee39 --- /dev/null +++ b/library/openeuler/24.03-LTS-SP1/mkimage-rootfs-openeuler.sh @@ -0,0 +1,162 @@ +#!/bin/sh +# +# for openEuler 24.03 +# create rootfs.tar from repository +# +#set -x + +set -e + +arch=loongarch64 +#release=$1 +releasever=24.03 +version=24.03 +if [ -z $version ] +then + echo "releasever or version is empty!!!" + exit 1 +fi + +output="openEuler-${version}.rootfs.${arch}.tar.gz" + +repos_baseos_url="https://eulermaker.compass-ci.openeuler.openatom.cn/api/ems2/repositories/openEuler-24.03-LTS-SP1-everything:loongarch/openEuler%3A24.03-LTS-SP1/loongarch64/" + +trap cleanup TERM EXIT + +work_dir=$(mktemp -d $(pwd)/rootfs-image.XXXXXX) +rootfs=${work_dir}/rootfs + +repo_dir="${work_dir}/yum.repo.d" +repo_conf="${repo_dir}/openEuler.repo" +setting_scripts=setting.sh + +pkg_list=" + basesystem bash ca-certificates openEuler-release openEuler-gpg-keys + openEuler-repos chkconfig cracklib crypto-policies dnf + expat gawk gdbm glib2 gmp gnupg2 gpgme grep ima-evm-utils-libs + json-c mpfr ncurses-base procps-ng rpm findutils + npth p11-kit p11-kit-trust pcre2 popt readline rootfiles + rpm sed setup systemd-libs tzdata vim-minimal xz yum + git git-core make gcc procps rpm-build findutils dnf-plugins-core +" + +#################################################################### +cleanup() +{ + rm -rf ${work_dir} +} +#################################################################### + +mkdir -pv ${rootfs} || : +mkdir -pv ${repo_dir} || : + +#################################################################### +# gen repos conf +#################################################################### +cat > ${repo_conf} << EOF +[baseos] +name=openEuler-$releasever +baseurl=${repos_baseos_url} +gpgcheck=0 +enabled=1 +priority=2 +excludepkgs="${exclude_pkgs}" +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LOONGNIX +EOF +#################################################################### + + +#################################################################### +DNF_OPTS="\ + --setopt=install_weak_deps=False \ + --setopt=reposdir=${repo_dir} \ + --releasever=${releasever} \ + --installroot=${rootfs} \ + --nodocs" + +echo "Install packages : $pkg_list" + +rpmdb --root=${rootfs} --initdb +dnf ${DNF_OPTS} makecache --refresh +dnf ${DNF_OPTS} -y install ${pkg_list} +#################################################################### + +#################################################################### +cat > ${rootfs}/${setting_scripts} << EOF +#!/bin/bash + +## config TERM is linux +echo 'export TERM=linux' >> etc/bash.bashrc +echo 'container' > /etc/dnf/vars/infra + +#Generate installtime file record +/bin/date +%Y%m%d_%H%M > /etc/BUILDTIME + +# Limit languages to help reduce size. +LANG="en_US" +echo "%_install_langs $LANG" > /etc/rpm/macros.image-language-conf +echo "LANG=en_US.UTF-8" > /etc/locale.conf + +#pushd /usr/share/locale > /dev/null +# ls | egrep -x -v "en|en@arabic|en@boldquot|en@cyrillic|en@greek|en@hebrew|en@piglatin|en@quot|en@shaw|en_CA|en_GB|en_US|locale.alias" | xargs rm -rf +#popd > /dev/null + +# systemd fixes +:> /etc/machine-id +systemd-tmpfiles --create --boot +# mask mounts and login bits +systemctl mask systemd-logind.service getty.target console-getty.service +systemctl mask sys-fs-fuse-connections.mount systemd-remount-fs.service dev-hugepages.mount + +# Remove things we don't need +yum clean all > /dev/null +rm -rf /etc/udev/hwdb.bin +rm -rf /usr/lib/udev/hwdb.d/ +rm -rf /boot +rm -rf /var/lib/dnf/history.* +rm -rf /usr/src/ +rm -rf /home/* +rm -rf /var/log/* +rm -rf /var/cache/* +rm -rf /var/lib/yum/* +## Introduced by binutils +rm -rf /usr/bin/gdb +rm -f \$0 +########################################################################### +EOF +#################################################################### + +chmod +x ${rootfs}/${setting_scripts} +chroot ${rootfs} /${setting_scripts} + +##解决在rootfs中su命令没有权限问题 +#file_list="fingerprint-auth password-auth postlogin smartcard-auth system-auth user-profile" +#for file in ${file_list} +#do +# chroot ${rootfs} authselect create-profile ${file} +# chroot ${rootfs} ln -s /etc/authselect/custom/${file} /etc/pam.d/${file} +#done + +##解决在chroot中/dev/null没有权限问题 +chroot ${rootfs} rm -rf /dev/null +chroot ${rootfs} mknod /dev/null c 1 3 +chroot ${rootfs} chmod 666 /dev/null + +cur_dir=$(pwd) +pushd ${rootfs} > /dev/null + if [ -e "${cur_dir}/${output}" ]; then + echo "Remove old ${output}" + rm -rf "${cur_dir}/${output}" + fi + + echo "Generating ${output} ...." +# tar --numeric-owner --exclude='dev/*' -acf "${cur_dir}/${output}" . + tar --numeric-owner -acf "${cur_dir}/${output}" . +popd > /dev/null + +echo "Generating ${output} md5sum...." +sync && md5sum ${output} > ${output}.md5 + +###################################### +sync && echo -e "\n^^^^^^ done ^^^^^^^^^^\n" +######################################