devuan-live-sdk-docker/Dockerfile-test

331 lines
11 KiB
Plaintext

# https://dev1galaxy.org/viewtopic.php?id=551
#FROM devuan:jessie-slim
#FROM devuan:ascii-slim
FROM dyne/devuan:beowulf
ENV DEBIAN_FRONTEND noninteractive
RUN echo 'Acquire::http { Proxy "http://192.168.1.49:3142"; };' > /etc/apt/apt.conf.d/02proxy
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y xorriso squashfs-tools live-boot syslinux-common git zsh debootstrap sudo kpartx xz-utils sudo cgpt parted vim curl sed gawk bsdmainutils
RUN apt-get install -y live-build live-config live-config-sysvinit isolinux grub-efi-amd64-bin grub-common dosfstools gnutls-bin
#RUN apt-get install -y kpartx cgpt
#RUN git clone https://git.devuan.org/cyteen/live-sdk
RUN git clone https://git.devuan.org/sdk/live-sdk.git /live-sdk
WORKDIR /live-sdk
#RUN git submodule update --init --recursive --checkout
RUN pwd
RUN ls -lh
RUN git pull && git submodule update --init --recursive --checkout
# sub modules might be behind current libdevuansdk git, if you require a more current version of libdevuansdk clone directly:
#WORKDIR /live-sdk/lib
#RUN rm -rf libdevuansdk
#RUN git clone https://git.devuan.org/sdk/libdevuansdk
#WORKDIR /live-sdk
# NB now included in the live-sdk if extra does not have a syslinux directory with isolinux.bin
#mkdir -p /live-sdk/extra/syslinux
# from package live-build
#cp /usr/share/live/build/bootloaders/isolinux/*.c32 /live-sdk/extra/syslinux
#cp /usr/share/live/build/bootloaders/isolinux/isolinux.bin /live-sdk/extra/syslinux
# from package ISOLINUX
#cp /usr/lib/ISOLINUX/isohdpfx.bin /live-sdk/extra/syslinux
ENV USER_NAME "default"
ENV USER_PASS "default"
ENV DEFAULT_SHELL "/bin/zsh"
ENV OS "devuan"
ENV ARCH "amd64"
ENV RELEASE "beowulf"
ENV VERSION 2.0.0
ENV TEMPLATE_NAME "devuan-beowulf-live"
#ENV TEMPLATE_NAME "live-zfs"
ENV BLEND_NAME "live-zfs"
ENV BLEND_VERS "1.0"
#ENV APT_MIRROR "http://192.168.44.47:3142/pkgmaster.devuan.org/merged"
ENV APT_MIRROR "http://pkgmaster.devuan.org/merged"
ENV USE_HOOKS "yes"
ENV SECTION "main contrib non-free"
ENV IMAGE_NAME "${os}_${release}_${version}_${arch}_desktop"
ENV SOURCES_LIST "${BLENDPATH}/sources.list"
ENV MANUAL_LIST "${BLENDPATH}/manual.list"
ENV AUTO_LIST "${BLENDPATH}/auto.list"
COPY ./live-sdk/blends/${TEMPLATE_NAME} /live-sdk/blends/${BLEND_NAME}
RUN mv /live-sdk/blends/${BLEND_NAME}/${TEMPLATE_NAME}.blend /live-sdk/blends/${BLEND_NAME}/${BLEND_NAME}.blend
# Enable/disable UEFI - Currently code checks to see if the $mkefi is set not if it is yes or no and turning it off breaks the xorriso build options.
#ENV MKEFI "no"
#ENV GRUB_VER "grub-pc"
#ENV EFI_WORK ""
#RUN sed -i "s,^\(mkefi=\).*,\1\"${MKEFI}\"," /live-sdk/blends/${BLEND_NAME}/config
#RUN sed -i "s,^\(efi_work=\).*,\1\"${EFI_WORK}\"," /live-sdk/blends/${BLEND_NAME}/config
#RUN sed -i '/^mkefi=/s/^/# /' /live-sdk/blends/${BLEND_NAME}/config
ENV MKEFI "yes"
ENV GRUB_VER "grub-efi-amd64"
ENV EFI_WORK "${BLENDPATH}/efi-files"
RUN sed -i '/# mkefi=/s/# /^/' /live-sdk/blends/${BLEND_NAME}/config
#WORKDIR /live-sdk/blends/
#RUN git clone https://git.devuan.org/cyteen/blends/live-zfs
#RUN git checkout -b ${BLEND_NAME}
## Once working and building push to git
#RUN git push origin ${BLEND_NAME}
WORKDIR /live-sdk
# Add the new blend to the sdk blend_map so we can build it.
RUN pwd
RUN ls
RUN sed -i "/blend_map=.*/ s/.*/&\n\t\t\"${BLEND_NAME}\" \"\$R\/blends\/${BLEND_NAME}\/${BLEND_NAME}.blend\"/" sdk
# Add call for sourceslist
#RUN sed -i "/install-custdebs.*/ s/.*/&\n\tinstall-packageslist || zerr/" sdk
COPY bin/edit-config.sh /live-sdk/edit-config.sh
# #!/bin/bash
# /live-sdk/edit-config.sh
#
# CONFIG_FILE="${2}"
# declare -A arr
# arr+=( "${1}" )
# for TARGET_KEY in "${!arr[@]}"; do
# echo "x " ${TARGET_KEY} ${arr[${TARGET_KEY}]} ${CONFIG_FILE}
# if grep -q "^${TARGET_KEY}=" ${CONFIG_FILE}; then
# sed -i "s|^${TARGET_KEY}.*|${TARGET_KEY}=\"${arr[${TARGET_KEY}]}\"|" ${CONFIG_FILE}
# else
# sed -i "/^blend_name=.*/ s|.*|&\n${TARGET_KEY}=\"${arr[${TARGET_KEY}]}\"|" ${CONFIG_FILE}
# fi
# done
# FIXME: Some settings in the blend config fail to override libdevuansdk/conf we should test setting in blend first to identify which ones are not imported.
# Construct array for edit-config
# Taken from /live-sdk/lib/libdevuansdk/config
ENV CORE_PACKAGES \
devuan-keyring \
debian-keyring \
ca-certificates \
initramfs-tools \
e2fsprogs \
curl \
less \
vim \
nano \
sysvinit \
""
ENV BASE_PACKAGES \
apt-utils \
dselect \
parted \
openssh-server \
openssh-client \
sudo \
alsa-base \
alsa-utils \
mawk \
tmux \
screen \
#openntpd \
ntp \
wpasupplicant \
wireless-tools \
elinks \
firmware-linux-free \
btrfs-tools \
zsh \
rsync \
git-core \
mlocate \
""
#ENV PURGE_PACKAGES \
# dbus \
# ""
ENV FINALIZE_PURGE_PACKAGES \
avahi-daemon \
avahi-autoipd \
libavahi-common-data \
libavahi-common3 \
libavahi-glib1 \
libavahi-client3 \
cups-browsed \
gvfs-daemon \
libpam-gnome-keyring \
pulseaudio \
policykit-1 \
xscreensaver \
xscreensaver-data \
""
ENV CORE_VALUES " \
["core_packages="]=${CORE_PACKAGES[@]} \
"
ENV BASE_VALUES " \
["base_packages="]=${BASE_PACKAGES[@]} \
"
ENV PURGE_VALUES " \
["purge_packages="]=${PURGE_PACKAGES[@]} \
"
ENV FINALIZE_PURGE_VALUES " \
["finalize_purge_packages="]=${FINALIZE_PURGE_PACKAGES[@]} \
"
ENV BLEND_CONFIG /live-sdk/blends/${BLEND_NAME}/config
RUN edit-config-list.sh ${CORE_VALUES} ${BLEND_CONFIG}
RUN edit-config-list.sh ${BASE_VALUES} ${BLEND_CONFIG}
RUN edit-config-list.sh ${PURGE_VALUES} ${BLEND_CONFIG}
# FIXME: Does edit-config.sh cope with multi-line variables in CONFIG_VALUES below.
ENV SDK_CONFIG /live-sdk/lib/libdevuansdk/config
#ENV CONFIG_VALUES " \
# ["core_packages"]=${CORE_PACKAGES} \
# ["base_packages"]=${BASE_PACKAGES} \
# ["purge_packages"]=${PURGE_PACKAGES} \
# "
ENV CONFIG_VALUES " \
["os"]=${OS} \
["release"]=${RELEASE} \
["version"]=${VERSION} \
["mirror"]=${APT_MIRROR} \
["section"]=${SECTION} \
["image_name"]=${IMAGE_NAME} \
"
#RUN edit-config.sh ${CONFIG_VALUES} ${SDK_CONFIG}
RUN edit-config.sh ${CONFIG_VALUES} ${BLEND_CONFIG}
ENV BLEND_CONFIG_VALUES " \
["user_name"]=${USER_NAME} \
["user_pass"]=${USER_PASS} \
["default-shell"]=${DEFAULT_SHELL} \
["blend_name"]=${BLEND_NAME} \
["blend_vers"]=${BLEND_VERS} \
["hookfile"]=${USE_HOOKS} \
["arch"]=${ARCH} \
["mkefi"]=${MKEFI} \
["efi-work"]=${EFI_WORK} \
["grubversion"]=${GRUB_VER} \
["sources_list"]=${SOURCES_LIST} \
["manual_list"]=${MANUAL_LIST} \
["auto_list"]=${AUTO_LIST} \
"
RUN edit-config.sh ${BLEND_CONFIG_VALUES} ${BLEND_CONFIG}
# Add zfs var and arrs filesystems you would like to snapshot separately or
# apply and indiviual quota
#vars+=(zfs_poolname)
ENV ZFS_POOLNAME "rpool"
#arrs+=(zfs_datasets)
ENV ZFS_DATASETS " \
"/home" \
"/home/${username}" \
"/space" \
"/opt" \
"/tmp" \
"/usr" \
"/usr/share" \
"/usr/local" \
"/var" \
"/var/cache" \
"/var/cache/apt" \
"/var/lib" \
"/var/tmp" \
"/var/lib/virt" \
"/var/lib/lxc" \
"/var/lib/docker" \
"/var/log" \
"/var/spool" \
"/var/tmp" \
"
# Given on the load commandline
#RUN sed -i "s,^\(os=\).*,\1\"${OS}\"," /live-sdk/blends/${BLEND_NAME}/config
#RUN sed -i "s,^\(blend_name=\).*,\1\"${BLEND_NAME}\"," /live-sdk/blends/${BLEND_NAME}/config
#
#RUN sed -i "s,^\(username=\).*,\1\"${USER_NAME}\"," /live-sdk/blends/${BLEND_NAME}/config
#RUN sed -i "s,^\(userpass=\).*,\1\"${USER_PASS}\"," /live-sdk/blends/${BLEND_NAME}/config
#RUN sed -i "s,^\(default_shell=\).*,\1\"${DEFAULT_SHELL}\"," /live-sdk/blends/${BLEND_NAME}/config
#
#RUN sed -i "s,^\(hookscripts=\).*,\1\"${USE_HOOKS}\"," /live-sdk/blends/${BLEND_NAME}/config
#RUN sed -i "s,^\(hookscripts=\).*,\1\"${USE_HOOKS}\"," /live-sdk/blends/${BLEND_NAME}/config
#RUN sed -i "s,^\(section=\).*,\1\"${SECTION}\"," /live-sdk/blends/${BLEND_NAME}/config
#RUN sed -i "s,^\(image_name=\).*,\1\"${IMAGE_NAME}\"," /live-sdk/blends/${BLEND_NAME}/config
#
#RUN sed -i "s,^\(grubversion=\).*,\1\"${GRUB_VER}\"," /live-sdk/blends/${BLEND_NAME}/config
#
##RUN sed -i "s,^\(blend_vers=\).*,\1\"${BLEND_VERS}\"," /live-sdk/blends/${BLEND_NAME}/config
#RUN grep -q '^blend_vers=' /live-sdk/blends/${BLEND_VERS}/config && \
# sed -i "s/^blend_vers.*/mirror=${BLEND_VERS}/" /live-sdk/blends/${BLEND_NAME}/config || \
# sed -i "/blend_name=.*/ s/.*/&\n^release=${BLEND_VERS}\"/" /live-sdk/blends/${BLEND_NAME/config}
#
##RUN sed -i "s,^\(release=\).*,\1\"${RELEASE}\"," /live-sdk/blends/${BLEND_NAME}/config
#RUN grep -q '^release=' /live-sdk/blends/${BLEND_NAME}/config && \
# sed -i "s/^release.*/mirror=${RELEASE}/" /live-sdk/blends/${BLEND_NAME}/config || \
# sed -i "/blend_name=.*/ s/.*/&\n^release=${RELEASE}\"/" /live-sdk/blends/${BLEND_NAME/config}
#
#RUN grep -q '^mirror=' /live-sdk/blends/${BLEND_NAME}/config && \
# sed -i "s/^mirror.*/mirror=${APT_MIRROR}/" /live-sdk/blends/${BLEND_NAME}/config || \
# sed -i "/blend_name=.*/ s/.*/&\n^mirror=${BLEND_NAME}\"/" /live-sdk/blends/${BLEND_NAME/config}
#
#RUN sed -i "s,^\(mirror=\).*,\1\"${APT_MIRROR}\"," /live-sdk/blends/${BLEND_NAME}/config
# Add/remove packages not already in the blend
#RUN echo ""extra_packages+=( smartmontools gsmartcontrol ) >> /live-sdk/blends/${BLEND_NAME}/config
#RUN purge_packages+=( policykit-1) >> /live-sdk/blends/${BLEND_NAME}/config
# Add hook scripts not all ready in the blend
#RUN echo "" > /live-sdk/blends/${BLEND_NAME}/hooks/hook.sh
#COPY common/hooks/hook.sh /live-sdk/blends/${BLEND_NAME}/hooks/hook.sh
# Add custom debs not already in the blend
#RUN echo "custom_deb_packages+=( sanoid_1.4.14-1_amd64.deb )" >> /live-sdk/blends/${BLEND_NAME}/config
#COPY common/custom-packages/sanoid_1.4.14-1_amd64.deb /live-sdk/blends/${BLEND_NAME}/sanoid_1.4.14-1_amd64.deb
## copy a get-selections from the livecd (install your prefered programs beforehand)
#dpkg --get-selections > /var/tmp/packages.list
#/usr/bin/apt-mark showauto > /var/tmp/pkgs_auto.lst
#/usr/bin/apt-mark showmanual > /var/tmp/pkgs_manual.lst
COPY packages.list blend/${BLEND_NAME}/packages.list
#COPY pkgs_auto.list blend/${BLEND_NAME}/pkgs_auto.list
#COPY pkgs_manual.list blend/${BLEND_NAME}/pkgs_manual.list
COPY pkgs_auto.list-ascii blend/${BLEND_NAME}/pkgs_auto.list
COPY pkgs_manual.list-ascii blend/${BLEND_NAME}/pkgs_manual.list
SHELL ["/bin/zsh", "-c"]
RUN echo "#!/usr/bin/env zsh" > build-iso.zsh && \
echo "source sdk" >> build-iso.zsh && \
echo "load ${OS} ${ARCH} ${BLEND_NAME}" >> build-iso.zsh && \
echo "build_iso_dist" >> build-iso.zsh && \
chmod +x build-iso.zsh
#ENTRYPOINT ["/bin/zsh", "-f", "-c", "source sdk"]
CMD ["build-iso.zsh"]