devuan-live-sdk-docker/Dockerfile-submodule-e17

905 lines
32 KiB
Plaintext

# syntax = docker/dockerfile:experimental
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 rm -f /etc/apt/apt.conf.d/docker-clean; \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt \
apt-get update && apt-get -y upgrade
RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt \
apt-get install -y xorriso squashfs-tools live-boot live-build live-config live-config-sysvinit \
syslinux-common git zsh debootstrap sudo kpartx xz-utils sudo cgpt parted vim curl sed gawk bsdmainutils \
rsync slim openssh-client isolinux grub-efi-amd64-bin grub-common dosfstools gnutls-bin
#RUN apt-get install -y kpartx cgpt
ARG GITLAB_URL="git.ring-zero.co.uk/"
ARG GITLAB_PORT="10022"
ARG GITLAB_USER=cyteen
ENV USER_NAME "default"
ENV USER_PASS "default"
ENV ROOT_CRED "root:toor"
ENV USER_CRED "${USER_NAME}:${USER_PASS}"
ENV DEFAULT_SHELL "/bin/zsh"
ENV OS "devuan"
ENV ARCH "amd64"
ARG RELEASE="beowulf"
ENV VERSION 2.0.0
ARG TEMPLATE_NAME="devuan-beowulf-live-e17"
ARG BLEND_NAME="live-zfs-e17"
ARG BLEND_VERS="3.0-test-$(date +%Y-%m-%d)"
ARG APT_MIRROR="https://deb.devuan.org/merged"
ENV USE_HOOKS "yes"
ENV SECTION "main contrib non-free"
ENV RELEASE_CONF "$BLENDPATH/${release}/config"
ENV IMAGE_NAME "${OS}_${RELEASE}_${VERSION}_${ARCH}_desktop"
ENV BASE_PACKAGES_OPTION "--no-install-recommends"
ENV EXTRA_PACKAGES_OPTION "--no-install-recommends"
ENV SOURCES_LIST "${BLENDPATH}/sources.list"
ENV MANUAL_LIST "${BLENDPATH}/manual.list"
ENV AUTO_LIST "${BLENDPATH}/auto.list"
ARG GIT_EMAIL_URL="ring-zero.co.uk"
ARG GIT_EMAIL_NAME="cyteen"
ARG GIT_NAME="Cyteen May"
RUN git config --global user.email "${GIT_EMAIL_NAME}@${GIT_EMAIL_URL}"
RUN git config --global user.name "${GIT_NAME}"
# Add any domains needed to the known hosts file.
RUN mkdir -p -m 0600 /root/.ssh && ssh-keyscan git.devuan.org >> /root/.ssh/known_hosts
# ssh-keyscan -p 10020 git.ring-zero.co.uk >> ${HOME}/.ssh/know_hosts
RUN mkdir -p -m 0600 /root/.ssh && ssh-keyscan -p ${GITLAB_PORT} ${GITLAB_URL} >> /root/.ssh/known_hosts
WORKDIR /var/tmp
## Create an empty project for the new blend.
RUN mkdir ${BLEND_NAME}
WORKDIR /tmp/${BLEND_NAME}
RUN git init && \
mkdir ${RELEASE}
# Add the blend scripts submodule to the new blend.
# ssh://git@git.ring-zero.co.uk:10022/scripts/automate.git beowulf/scripts
RUN --mount=type=ssh git submodule add ssh://git@${GITLAB_URL}:${GITLAB_PORT}/scripts/automate.git ${RELEASE}/scripts
RUN git add .
RUN git commit -m "Dockerfile: commit after adding submodule."
# Directly push it to GitLab to create the new project, see:
# https://docs.gitlab.com/ee/gitlab-basics/create-project.html#push-to-create-a-new-project
# ssh://git@git.ring-zero.co.uk:10022/sdk/blends/live-zfs-e17.git master
RUN --mount=type=ssh git push --set-upstream ssh://git@${GITLAB_URL}:${GITLAB_PORT}/sdk/blends/${BLEND_NAME}.git master
## Clone the live-sdk upstream to the root directory.
#RUN --mount=type=ssh git clone https://${GITLAB_URL}/${GITLAB_USER}/live-sdk
#RUN --mount=type=ssh git clone https://git.devuan.org/sdk/live-sdk.git /live-sdk
#RUN --mount=type=ssh git clone git@git.devuan.org:sdk/live-sdk.git /live-sdk
RUN --mount=type=ssh git clone ssh://git@${GITLAB_URL}:${GITLAB_PORT}/sdk/live-sdk.git /live-sdk
#RUN git remote remove origin && git remote add origin ${GITLAB_URL}:sdk/live-sdk.git
WORKDIR /live-sdk
## Create local branch of the live-sdk to add only local git submodules UNIQUE:
RUN git checkout -b ${BLEND_NAME}
## Change the submodules to local for zuper and libdevuansdk
# git config --file=.gitmodules submodule.lib/zuper.url ssh://git@git.ring-zero.co.uk:10022/sdk/zuper.git
RUN git config --file=.gitmodules submodule.lib/zuper.url ssh://git@${GITLAB_URL}:${GITLAB_PORT}/sdk/zuper.git
#git config --file=.gitmodules submodule.lib/libdevuansdk.url ssh://git@git.ring-zero.co.uk:10022/sdk/libdevuansdk.git
RUN git config --file=.gitmodules submodule.lib/libdevuansdk.url ssh://git@${GITLAB_URL}:${GITLAB_PORT}/sdk/libdevuansdk.git
RUN git config --file=.gitmodules submodule.lib/libdevuansdk.branch ring-zero
RUN git add .
RUN git commit -am "Set library submodules to ring-zero gitlab repo."
RUN git submodule sync
RUN cat .git/config
RUN cat .gitmodules
## Add submodules to the branch
# the new blend submodule
# git submodule add ssh://git@git.ring-zero.co.uk:10022/sdk/blends/live-zfs-e17.git \
# blends/${BLEND_NAME} --recursive
RUN --mount=type=ssh git submodule add ssh://git@${GITLAB_URL}:${GITLAB_PORT}/sdk/blends/${BLEND_NAME} \
blends/${BLEND_NAME} --recursive
# the template blend submodule
# git submodule add -b ring-zero ssh://git@git.ring-zero.co.uk:10022/sdk/blends/devuan-beowulf-live-e17.git blends/devuan-beowulf-live-e17 --recursive
RUN --mount=type=ssh git submodule add -b ring-zero ssh://git@${GITLAB_URL}:${GITLAB_PORT}/sdk/blends/${TEMPLATE_NAME} \
blends/${TEMPLATE_NAME} --recursive
RUN git add .
RUN git commit -m "Add blends as submodules from ring-zero gitlab repo."
# re-synchronize the information in .git/config with the information in .gitmodules
RUN git submodule sync
#RUN --mount=type=ssh git push --set-upstream git@${GITLAB_URL}:${GITLAB_USER}/live-sdk.git master
## Update submodules recursively,
# /live-sdk/lib/libdevuansdk
# /live-sdk/lib/zuper
# /live-sdk/blends/${BLEND_NAME}
# /live-sdk//blends/${BLEND_NAME}/scripts
# /live-sdk//blends/${TEMPLATE_NAME}/scripts
#RUN git submodule update --init --recursive --checkout
#RUN --mount=type=ssh git pull && git submodule update --init --recursive --checkout
RUN --mount=type=ssh git submodule update --init --recursive --remote
RUN git add -A
## Starting with an empty BLEND_NAME. Copy the template blend into the new blend
RUN cp -R /live-sdk/blends/${TEMPLATE_NAME}/* /live-sdk/blends/${BLEND_NAME}/
# Rename the blend file of the transfered blend to the new 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/${GITLAB_USER}/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 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
# 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 EXTRA_PACKAGES \
librsvg2-common \
fonts-quicksand \
fonts-liberation \
fonts-symbola \
xserver-xorg-input-all \
xserver-xorg-video-all \
anacron \
bluetooth \
iw \
powertop \
vim-gtk3 \
wireless-tools \
wpasupplicant \
tasksel \
xfce4 \
xfce4-goodies \
xfce4-power-manager \
xfce4-terminal \
atril \
dbus-x11 \
hunspell-en-gb \
hyphen-en-gb \
mythes-en-us \
synaptic \
system-config-printer \
tango-icon-theme \
xsane \
enlightenment \
terminology \
libeet-bin \
libeina-bin \
rox-filer \
neovim \
firmware-atheros \
firmware-bnx2 \
firmware-bnx2x \
firmware-brcm80211 \
firmware-intelwimax \
firmware-iwlwifi \
firmware-libertas \
firmware-linux-nonfree \
firmware-misc-nonfree \
firmware-myricom \
firmware-netxen \
firmware-qlogic \
firmware-ralink \
firmware-realtek \
firmware-ti-connectivity \
firmware-zd1211 \
sudo \
yad \
refractainstaller-gui \
refractasnapshot-gui \
linux-headers-amd64 \
#libreoffice \
#libreoffice-gtk3 \
#libreoffice-help-en-gb \
#mousepad \
#network-manager-gnome \
#avahi-daemon \
#lightdm \
#quodlibet \
#lig_t-locker \
#orca \
""
RUN mkdir -p /live-sdk/blends/${BLEND_NAME}/${RELEASE}/rootfs-overlay/etc && \
echo spl >> /live-sdk/blends/${BLEND_NAME}/${RELEASE}/rootfs-overlay/etc/modules && \
echo zfs >> /live-sdk/blends/${BLEND_NAME}/${RELEASE}/rootfs-overlay/etc/modules
ENV BASE_PACKAGES \
apt-utils \
openrc \
dselect \
parted \
openssh-server \
openssh-client \
sudo \
alsa-utils \
mawk \
tmux \
screen \
ntp \
wpasupplicant \
wireless-tools \
elinks \
firmware-linux-free \
btrfs-progs \
zsh \
rsync \
git \
mlocate \
libbullet2.87 \
libgif7 \
libgles2 \
libibus-1.0-5 \
libpoppler-cpp0v5 \
libscim8v5 \
libxcb-xkb1 \
libxkbcommon-x11-0 \
libbluetooth3 \
#virtualbox-guest-additions-iso \
#qemu-guest-agent \
#cloud-guest-utils \
#openntpd \
""
ENV PURGE_PACKAGES \
apparmor \
apparmor-utils \
auditd \
apparmor-profiles \
apparmor-profiles-extra \
avahi-daemon \
avahi-autoipd \
libavahi-common-data \
libavahi-common3 \
libavahi-glib1 \
libavahi-client3 \
cups-browsed \
gvfs-daemon \
libpam-gnome-keyring \
pulseaudio \
pulseaudio-utils \
libpulsedsp \
xscreensaver \
xscreensaver-data \
""
## instalation order is important
ENV CUSTOM_DEB_PACKAGES \
bluealsa_2.1.0-1_amd64.deb \
checkinstall_1.6.2+git20170426.d24a630-2_amd64.deb \
dissenter-browser_0.70.122_amd64.deb \
libupnp6_1.6.19+git20160116-1.2_amd64.deb \
djmount_0.71-7.1_amd64.deb \
shellcheck_0.7.0-2~bpo10+1_amd64.deb \
torbrowser-launcher_0.3.2-7_amd64.deb \
#efl-doc_1.23.3-5_all.deb \
#libecore1_1.23.3-5_amd64.deb \
#libecore-bin_1.23.3-5_amd64.deb \
#libecore-file1_1.23.3-5_amd64.deb \
#libeeze1_1.23.3-5_amd64.deb \
#libeeze-bin_1.23.3-5_amd64.deb \
#libecore-audio1_1.23.3-5_amd64.deb \
#libecore-con1_1.23.3-5_amd64.deb \
#libeina1a_1.23.3-5_amd64.deb \
#libemile1_1.23.3-5_amd64.deb \
#libeet1_1.23.3-5_amd64.deb \
#libector1_1.23.3-5_amd64.deb \
#libeina-bin_1.23.3-5_amd64.deb \
#libecore-ipc1_1.23.3-5_amd64.deb \
#libeio1_1.23.3-5_amd64.deb \
#libefreet-bin_1.23.3-5_amd64.deb \
#libembryo-bin_1.23.3-5_amd64.deb \
#libembryo1_1.23.3-5_amd64.deb \
#libelua1_1.23.3-5_amd64.deb \
#libelua-bin_1.23.3-5_amd64.deb \
#libeolian1_1.23.3-5_amd64.deb \
#libelocation1_1.23.3-5_amd64.deb \
#\
#libecore-fb1_1.23.3-5_amd64.deb \
#libecore-x1_1.23.3-5_amd64.deb \
#libevas1-engines-x_1.23.3-5_amd64.deb \
#libevas1_1.23.3-5_amd64.deb \
#libecore-evas1_1.23.3-5_amd64.deb \
#libecore-input1_1.23.3-5_amd64.deb \
#libelput1_1.23.3-5_amd64.deb \
#libecore-wl2-1_1.23.3-5_amd64.deb \
#libecore-drm2-1_1.23.3-5_amd64.deb \
#\
#libeet-bin_1.23.3-5_amd64.deb \
#libelementary-bin_1.23.3-5_amd64.deb \
#libevas-loaders_1.23.3-5_amd64.deb \
#libevas1-engines-drm_1.23.3-5_amd64.deb \
#libevas1-engines-fb_1.23.3-5_amd64.deb \
#libevas1-engines-wayland_1.23.3-5_amd64.deb \
#libecore-imf1_1.23.3-5_amd64.deb \
#libedje-bin_1.23.3-5_amd64.deb \
#libedje1_1.23.3-5_amd64.deb \
#\
#libelementary-data_1.23.3-5_all.deb \
#libelementary1_1.23.3-5_amd64.deb \
#libemotion1_1.23.3-5_amd64.deb \
#libemotion-players_1.23.3-5_amd64.deb \
#libephysics1_1.23.3-5_amd64.deb \
#libethumb-client-bin_1.23.3-5_amd64.deb \
#libethumb-client1_1.23.3-5_amd64.deb \
#libethumb1_1.23.3-5_amd64.deb \
#enlightenment-data_0.23.1-1_all.deb \
#enlightenment_0.23.1-1_amd64.deb \
#terminology-data_1.6.0-1_all.deb \
#terminology_1.6.0-1_amd64.deb \
#\
#enlightenment-dev_0.23.1-1_amd64.deb \
#libefl-all-dev_1.23.3-5_amd64.deb \
\
#enlightenment-dbgsym_0.23.1-1_amd64.deb \
#libecore-audio1-dbgsym_1.23.3-5_amd64.deb \
#libecore-bin-dbgsym_1.23.3-5_amd64.deb \
#libecore-con1-dbgsym_1.23.3-5_amd64.deb \
#libecore-drm2-1-dbgsym_1.23.3-5_amd64.deb \
#libecore-evas1-dbgsym_1.23.3-5_amd64.deb \
#libecore-fb1-dbgsym_1.23.3-5_amd64.deb \
#libecore-file1-dbgsym_1.23.3-5_amd64.deb \
#libecore-imf1-dbgsym_1.23.3-5_amd64.deb \
#libecore-input1-dbgsym_1.23.3-5_amd64.deb \
#libecore-ipc1-dbgsym_1.23.3-5_amd64.deb \
#libecore-wl2-1-dbgsym_1.23.3-5_amd64.deb \
#libecore-x1-dbgsym_1.23.3-5_amd64.deb \
#libecore1-dbgsym_1.23.3-5_amd64.deb \
#libector1-dbgsym_1.23.3-5_amd64.deb \
#libedje-bin-dbgsym_1.23.3-5_amd64.deb \
#libedje1-dbgsym_1.23.3-5_amd64.deb \
#libeet-bin-dbgsym_1.23.3-5_amd64.deb \
#libeet1-dbgsym_1.23.3-5_amd64.deb \
#libeeze-bin-dbgsym_1.23.3-5_amd64.deb \
#libeeze1-dbgsym_1.23.3-5_amd64.deb \
#libefl-all-dev-dbgsym_1.23.3-5_amd64.deb \
#libefreet-bin-dbgsym_1.23.3-5_amd64.deb \
#libefreet1a-dbgsym_1.23.3-5_amd64.deb \
#libeina-bin-dbgsym_1.23.3-5_amd64.deb \
#libeina1a-dbgsym_1.23.3-5_amd64.deb \
#libeio1-dbgsym_1.23.3-5_amd64.deb \
#libelementary-bin-dbgsym_1.23.3-5_amd64.deb \
#libelementary1-dbgsym_1.23.3-5_amd64.deb \
#libelocation1-dbgsym_1.23.3-5_amd64.deb \
#libelput1-dbgsym_1.23.3-5_amd64.deb \
#libelua-bin-dbgsym_1.23.3-5_amd64.deb \
#libelua1-dbgsym_1.23.3-5_amd64.deb \
#libembryo-bin-dbgsym_1.23.3-5_amd64.deb \
#libembryo1-dbgsym_1.23.3-5_amd64.deb \
#libemile1-dbgsym_1.23.3-5_amd64.deb \
#libemotion-players-dbgsym_1.23.3-5_amd64.deb \
#libemotion1-dbgsym_1.23.3-5_amd64.deb \
#libeolian1-dbgsym_1.23.3-5_amd64.deb \
#libephysics1-dbgsym_1.23.3-5_amd64.deb \
#libethumb-client-bin-dbgsym_1.23.3-5_amd64.deb \
#libethumb-client1-dbgsym_1.23.3-5_amd64.deb \
#libethumb1-dbgsym_1.23.3-5_amd64.deb \
#libevas-loaders-dbgsym_1.23.3-5_amd64.deb \
#libevas1-dbgsym_1.23.3-5_amd64.deb \
#libevas1-engines-drm-dbgsym_1.23.3-5_amd64.deb \
#libevas1-engines-fb-dbgsym_1.23.3-5_amd64.deb \
#libevas1-engines-wayland-dbgsym_1.23.3-5_amd64.deb \
#libevas1-engines-x-dbgsym_1.23.3-5_amd64.deb \
#terminology-dbgsym_1.6.0-1_amd64.deb \
""
ENV CUSTOM_SCRIPTS \
001_apt_suggests-recommends.sh \
001_locales.sh \
001_resolvconf.sh \
010_sysctl.sh \
010_generate-ssh.sh \
010_apt-get.sh \
001_system_bell.sh \
010_saltstack.sh \
020_console.sh \
020_zsh_quickstart.sh \
020_zsh_aliases.d.sh \
020_lsd.sh \
020_grc.sh \
010_alsa.sh \
020_conky.sh \
020_djmount.sh \
020_vim.sh \
020_meld.sh \
020_themes.sh \
020_audacity.sh \
020_powerline-bash.sh \
020_fonts.sh \
020_nanorc.sh \
020_neovim.sh \
020_mutt-wizard.sh \
020_mutt-notmuch.sh \
020_mutt-khard.sh \
020_shellcheck.sh \
020_neofetch_motd.sh \
020_tmux.sh \
020_rox-filer.sh \
020_hexchat.sh \
020_pidgin.sh \
020_brave_browser.sh \
020_slim.sh \
020_docker.sh \
020_docker-compose.sh \
050_wicd.sh \
050_remove_xscreensaver.sh \
""
ENV FINALIZE_PURGE_PACKAGES \
""
### ## 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 SDK_CONFIG /live-sdk/lib/libdevuansdk/config
ENV BLEND_CONFIG /live-sdk/blends/${BLEND_NAME}/config
ENV BLEND_PACKAGE_CONFIG /live-sdk/blends/${BLEND_NAME}/${RELEASE}/config
#### # Bash-isms follow, so:
#### SHELL ["/bin/bash", "-c"]
####
#### # Use sed to insert ..._package sections if missing. The Q42 is a forced exit status.
#### # Assumes the base_package stanza is present.
#### RUN ( \
#### if $(sed -n -e "/^core_package/ Q42" ${BLEND_CONFIG} ); then sed -i "/^base_packages/ i\core_packages+=(\n)\n" ${BLEND_CONFIG}; fi; \
#### # if $(sed -n -e "/^extra_package/ Q42" ${BLEND_CONFIG} ); then sed -i "/^base_packages/ i\EXTRA_packages+=(\n)\n" ${BLEND_CONFIG}; fi; \
#### if $(sed -n -e "/^purge_package/ Q42" ${BLEND_CONFIG} ); then sed -i "/^base_packages/ i\purge_packages+=(\n)\n" ${BLEND_CONFIG}; fi; \
#### # if $(sed -n -e "/^custom_deb_package/ Q42" ${BLEND_CONFIG} ); then sed -i "/^base_packages/ i\custom_deb_packages+=(\n)\n" ${BLEND_CONFIG}; fi; \
#### # if $(sed -n -e "/^finalize_purge_package/ Q42" ${BLEND_CONFIG} ); then sed -i "/^base_packages/ i\finalize_purge_packages+=(\n)\n" ${BLEND_CONFIG}; fi; \
#### # if $(sed -n -e "/^blend_package/ Q42" ${BLEND_CONFIG} ); then sed -i "/^base_packages/ i\blend_packages+=(\n)\n" ${BLEND_CONFIG}; fi; \
#### # \
#### # Use sed to replace block of values. \
#### # This works and is copy/pasteable to a bash shell, but the '[@]' elements are not strictly needed in a Dockerfile. \
#### # RUN ( \
#### sed -i \
#### -e "/^core_packages/,/^)$/ c\core_packages=(\n${CORE_PACKAGES[@]}\n)" \
#### # -e "/^base_packages/,/^)$/ c\base_packages=(\n${BASE_PACKAGES[@]}\n)" \
#### # -e "/^extra_packages/,/^)$/ i\extra_packages+=(\n${EXTRA_PACKAGES[@]}\n);Q" \
#### -e "/^purge_packages/,/^)$/ c\purge_packages+=(\n${PURGE_PACKAGES[@]}\n)" \
#### # -e "/^custom_deb_packages/,/^)$/ c\custom_deb_packages+=(\n${CUSTOM_DEB_PACKAGES[@]}\n)" \
#### # -e "/^finalize_purge_packages/,/^)$/ c\finalize_purge_packages+=(\n${FINALIZE_PURGE_PACKAGES[@]}\n)" \
#### ${BLEND_CONFIG}; \
#### ## \
#### ## Use sed to format the lists one per line, tabbed. \
#### ## Works for not- and tab-indented lists. \
#### ##RUN ( \
#### sed -i \
#### ## -e "/^core_packages/, /^)$/ { n; s/^/\t/; s/ \t/\n\t/g; s/ \([^\t]\)/\n\t\1/g; }" \
#### ## -e "/^base_packages/, /^)$/ { n; s/^/\t/; s/ \t/\n\t/g; s/ \([^\t]\)/\n\t\1/g; }" \
#### ### -e "/^extra_packages/,/^)$/ { n; s/^/\t/; s/ \t/\n\t/g; s/ \([^\t]\)/\n\t\1/g; }" \
#### ## -e "/^purge_packages/,/^)$/ { n; s/^/\t/; s/ \t/\n\t/g; s/ \([^\t]\)/\n\t\1/g; }" \
#### -e "/^custom_deb_packages/,/^)$/ { n; s/^/\t/; s/ \t/\n\t/g; s/ \([^\t]\)/\n\t\1/g; }" \
#### ## -e "/^finalize_purge_packages/,/^)$/ { n; s/^/\t/; s/ \t/\n\t/g; s/ \([^\t]\)/\n\t\1/g; }" \
#### ${BLEND_CONFIG}; \
#### cat ${BLEND_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 CONFIG_VALUES " \
### # ["core_packages"]=${CORE_PACKAGES} \
### # ["base_packages"]=${BASE_PACKAGES} \
### # ["purge_packages"]=${PURGE_PACKAGES} \
### # "
# These values are over-ridden by the blend conf files so should probably only be changed when releasing sdk updates.
ENV SDK_CONFIG_VALUES "\
["os"]='${OS}' \
["release"]='${RELEASE}' \
["version"]='${VERSION}' \
["mirror"]='${APT_MIRROR}' \
["section"]='${SECTION}' \
["image_name"]='${IMAGE_NAME}' \
["rootcredentials"]='${ROOT_CRED}' \
["usercredentials"]='${USER_CRED}' \
["corepackages_option"]='' \
["core_packages"]='${CORE_PACKAGES}' \
["base_packages_option"]='' \
["base_packages"]='${BASE_PACKAGES}' \
["purge_packages_option"]='' \
["purge_packages"]='${PURGE_PACKAGES}' \
"
#RUN /live-sdk/edit-config.sh "${CONFIG_VALUES}" ${SDK_CONFIG}
ENV CONFIG_VALUES " \
["core_packages"]='${CORE_PACKAGES}' \
["base_packages"]='${BASE_PACKAGES}' \
["purge_packages"]='${PURGE_PACKAGES}' \
["extra_packages"]='${EXTRA_PACKAGES}' \
["custom_deb_packages"]='${CUSTOM_DEB_PACKAGES}' \
["custom_scripts"]='${CUSTOM_SCRIPTS}' \
["finalize_purge_packages"]='${FINALIZE_PURGE_PACKAGES}' \
"
RUN /live-sdk/edit-config.sh "${CONFIG_VALUES}" ${BLEND_PACKAGE_CONFIG}
ENV BLEND_CONFIG_VALUES " \
["blend_name"]='${BLEND_NAME}' \
["release"]='${RELEASE}' \
["version"]='${BLEND_VERS}' \
["username"]='${USER_NAME}' \
["userpass"]='${USER_PASS}' \
["default_shell"]='${DEFAULT_SHELL}' \
["manual_list"]='${MANUAL_LIST}' \
["auto_list"]='${AUTO_LIST}' \
["grubversion"]='${GRUB_VER}' \
["mirror"]='${APT_MIRROR}' \
["section"]='${SECTION}' \
["release_conf"]='${RELEASE_CONF}' \
["image_name"]='${IMAGE_NAME}' \
# ["mkefi"]='${MKEFI}' \
# ["efi_work"]='${EFI_WORK}' \
# ["base_packages_option"]='${BASE_PACKAGES_OPTION}'
# ["extra_packages_option"]='${EXTRA_PACKAGES_OPTION}'
# ["hookscripts"]='${USE_HOOKS}' \
# ["arch"]='${ARCH}' \
# ["sources_list"]='${SOURCES_LIST}' \
"
RUN /live-sdk/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 blends/${BLEND_NAME}/packages.list
#COPY pkgs_auto.list blends/${BLEND_NAME}/pkgs_auto.list
#COPY pkgs_manual.list blends/${BLEND_NAME}/pkgs_manual.list
COPY pkgs_auto.list-ascii blends/${BLEND_NAME}/pkgs_auto.list
COPY pkgs_manual.list-ascii blends/${BLEND_NAME}/pkgs_manual.list
## Commit changes to the new blend repo
WORKDIR /live-sdk/blends/${BLEND_NAME}
RUN git add .
RUN git commit -m "Docker build: commit before push."
# ssh://git@git.ring-zero.co.uk:10022/sdk/blends/live-zfs-e17.git --all
RUN --mount=type=ssh git push ssh://git@${GITLAB_URL}:${GITLAB_PORT}/sdk/blends/${BLEND_NAME}.git --all
SHELL ["/bin/zsh", "-c"]
## Build sequence:
# source sdk
# load ${OS} ${ARCH} ${BLEND_NAME}
# AUTOMATE_HOME=${strapdir}/var/tmp/automate
# devprocsys umount ${strapdir}
## build_iso_dist() {
# bootstrap_complete_base
# (*) bootstrapping devuan amd64 base
# (*) running debootstrap stage 1 - retrieve and validate
# (*) running debootstrap stage 2 - unpack and configure
# (*) writing system configuration
# (*) running debootstrap stage 3 - mount and chroot
# (*) chrooting to execute thirdstage...
# writes file 'thirdstage' to the chroot
# bootstrap_config_thirdstage | sudo tee $strapdir/thirdstage >/dev/null
#
# and runs it with
# chroot-script -d thirdstage || zerr
#
#
# debconf-set-selections /debconf.set
# apt-get --yes --force-yes install ${core_packages_option} ${core_packages}
# apt-get --yes --force-yes install ${base_packages_option} ${base_packages}
# apt-get --yes --force-yes purge ${purge_packages_option} ${purge_packages}
# apt-get --yes --force-yes autoremove
# sed -e 's/# en_US.UTF-8/en_US.UTF-8/' -i /etc/locale.gen
# (*) Creating boostrap tarball in /live-sdk/tmp/bootstrap-devuan-amd64-stage3.tgz
# (*) chrooting to execute postunpack... - install blend debs
#
# cp -a ${live_sdk-$PWD/}automate ${strapdir}/var/tmp
# cp -a automate ${strapdir}/var/tmp
#
# blend_preinst from the blend file:
# (*) executing devuan-desktop-live_ preinst
# (*) adding user devuan:devuan
# (*) chrooting to execute adduser... add-user $username $userpass
# (*) copying blend-specific debs... cp -fv "$blend_release_path"/*.deb "$R/extra/custom-packages"
#
# devprocsys mount $strapdir
# chroot-script /var/tmp/automate/001_locales.sh
# chroot-script /var/tmp/automate/010_apt-get.sh
# chroot-script /var/tmp/automate/010_saltstack.sh
# chroot-script /var/tmp/automate/020_console.sh
# chroot-script /var/tmp/automate/020_zsh_quickstart.sh
# chroot-script /var/tmp/automate/020_zsh_aliases.d.sh
# chroot-script /var/tmp/automate/020_lsd.sh
# chroot-script /var/tmp/automate/020_grc.sh
# chroot-script /var/tmp/automate/010_alsa.sh
# chroot-script /var/tmp/automate/020_vim.sh
# chroot-script /var/tmp/automate/020_meld.sh
# chroot-script /var/tmp/automate/020_themes.sh
# chroot-script /var/tmp/automate/020_powerline-bash.sh
# chroot-script /var/tmp/automate/020_nanorc.sh
# chroot-script /var/tmp/automate/020_neovim.sh
# chroot-script /var/tmp/automate/020_neofetch_motd.sh
# chroot-script /var/tmp/automate/020_tmux.sh
# chroot-script /var/tmp/automate/020_rox-filer.sh
# chroot-script /var/tmp/automate/020_hexchat.sh
# chroot-script /var/tmp/automate/020_pidgin.sh
# chroot-script /var/tmp/automate/020_torbrowser.sh
# chroot-script /var/tmp/automate/050_wicd.sh
# chroot-script /var/tmp/automate/050_remove_xscreensaver.sh
# devprocsys umount $strapdir
# iso_prepare_strap
# (*) preparing strapdir for livecd
# (*) chrooting to execute isoprep...
# build_kernel_${arch}
# (*) installing stock kernel for amd64
# (*) chrooting to execute install-linux...
# iso_setup_isolinux
# (*) setting up isolinux
# iso_write_isolinux_cfg
# (*) writing isolinux configuration
# (*) copying isolinux overlay
# blend_postinst from the blend file:
# install-custdebs
# chroot-script -d install-debs
# rsync the rootfs-overlay
# (*) executing devuan-desktop-live_ postinst
# (*) chrooting to execute install-debs...
# (*) chrooting to execute finalize...
# add user to groups: cdrom floppy audio dip video plugdev netdev lpadmin scanner
# set default shell
# copy the /root dotfiles to /home/${username}
# chown the home directory
# update-initramfs -u -k -all
# change sources.list to deb.debuan.org
# fill_apt_cache
# iso_squash_strap
# (*) creating squashfs out of strapdir
# iso_xorriso_build
# (*) building iso...
#}
#-------------------------------------------------------------------------------------
# Log creation order
# bootstrap_complete_base
# dpkgdivert.log
# postunpack.log
# thirdstage.log
# blend_preinst
# blend_postinst
# install-debs
# install-scripts.log
# adduser.log
# finalize.log
#
#-------------------------------------------------------------------------------------
# # Inject default background in e17 configuration (for all known profiles)
## eet -l e.cfg # list all keys, usually just "config"
## eet -d e.cfg config e.src # writes human readable values to file e.src
## $EDITOR e.src # change whatever you like
## eet -e e.cfg config e.src 1 # recompress to binary cfg file
#
# e.cfg
# enlightenment-standard.png
# module.conf.cfg
# module.fileman.cfg
# module.ibox.cfg
# module.temperature.cfg
# e_bindings.cfg
# module.battery.cfg
# module.cpufreq.cfg
# module.ibar.cfg
# module.pager.cfg
# profile.desktop
#
# E_CFG_HOME /usr/share/enlightenment/data/config
#
# for profile in mobile standard tiling default computer; do
# dpkg-divert --local --add ${E_CFG_HOME}/$profile/e.cfg
# eet -d ${E_CFG_HOME}/$profile/e.cfg config /var/tmp/e.src
# awk '/value "desktop_default_name"/ {print " value \"desktop_default_background\" string: \"/usr/share/enlightenment/data/backgrounds/kali-wallpaper_1920x1200.edj\";"}; {print}' /var/tmp/e.src >/var/tmp/e2.src
# eet -e ${E_CFG_HOME}/$profile/e.cfg config /var/tmp/e2.src 1
# rm -f /tmp/e.src /tmp/e2.src
# done
#---------------------------------------------------------------------------------------
## 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
#RUN ( \
# ( echo "#!/usr/bin/env zsh"; \
# echo "source sdk"; \
# echo "load ${OS} ${ARCH} ${BLEND_NAME}"; \
# echo "build_iso_dist" \
# ) >> build-iso.zsh \
# && chmod +x build-iso.zsh && ls -l build-iso.zsh && cat build-iso.zsh \
# )
## COPY bin/build-iso.zsh build-iso.zsh
RUN source ${live_sdk-$PWD/}sdk && \
load ${OS} ${ARCH} ${BLEND_NAME} && \
bootstrap_complete_base || { zerr; wrapup }
RUN blend_preinst || { zerr; wrapup }
RUN iso_prepare_strap || { zerr; wrapup } && \
build_kernel_${arch} || { zerr; wrapup } && \
iso_setup_isolinux || { zerr; wrapup } && \
iso_write_isolinux_cfg || { zerr; wrapup }
#RUN blend_postinst || { zerr; wrapup }
#
#RUN fill_apt_cache || { zerr; wrapup } && \
# iso_squash_strap || { zerr; wrapup } && \
# Final step to build the iso place in CMD
# iso_xorriso_build || { zerr; wrapup }
#RUN ( ls -l build-iso.zsh; ./build-iso.zsh )
#RUN cat ${SDK_CONFIG}; cat ${BLEND_CONFIG}
### #ENTRYPOINT ["/bin/zsh", "-f", "-c", "source sdk"]
CMD ["iso_xorriso_build"]