Skip to content

Commit

Permalink
Improve syntax highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabbenD committed Sep 18, 2023
1 parent 8046e8f commit 5cd5644
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
15 changes: 8 additions & 7 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ ARG OSTREE_SYS_ROOT_LABEL
ARG OSTREE_SYS_HOME_LABEL

# Remove container specific storage optimization in Pacman
RUN sed -i -e 's|^NoExtract.*||g' /etc/pacman.conf && \
RUN sed -i -e "s|^NoExtract.*||g" /etc/pacman.conf && \
pacman --noconfirm -Syu

# Clock
RUN ln -sf /usr/share/zoneinfo/Europe/Stockholm /etc/localtime

# Language
RUN echo 'LANG=en_US.UTF-8' | tee /etc/locale.conf && \
echo 'en_US.UTF-8 UTF-8' | tee /etc/locale.gen && \
RUN echo "LANG=en_US.UTF-8" | tee /etc/locale.conf && \
echo "en_US.UTF-8 UTF-8" | tee /etc/locale.gen && \
locale-gen

# Peripherals
RUN echo 'KEYMAP=sv-latin1' | tee /etc/vconsole.conf
RUN echo "KEYMAP=sv-latin1" | tee /etc/vconsole.conf

# Networking
RUN pacman --noconfirm -S networkmanager && \
Expand Down Expand Up @@ -87,9 +87,10 @@ RUN echo "LABEL=${OSTREE_SYS_ROOT_LABEL} / xfs rw,relatime

# https://ostree.readthedocs.io/en/stable/manual/adapting-existing/

# Move Pacman database
RUN sed -i \
-e 's|^#\(DBPath\s*=\s*\).*|\1/usr/lib/pacman|g' \
-e 's|^#\(IgnoreGroup\s*=\s*\).*|\1modified|g' \
-e "s|^#\(DBPath\s*=\s*\).*|\1/usr/lib/pacman|g" \
-e "s|^#\(IgnoreGroup\s*=\s*\).*|\1modified|g" \
/etc/pacman.conf && \
mv /var/lib/pacman /usr/lib/

Expand Down Expand Up @@ -136,7 +137,7 @@ RUN rm -r /var/*
RUN mkdir /sysroot && \
ln -s sysroot/ostree /ostree

# Skip 'Device or resource busy' errors
# Skip "Device or resource busy" errors
RUN mv /etc /usr/ || :

RUN moduledir=$(find /usr/lib/modules -mindepth 1 -maxdepth 1 -type d) && \
Expand Down
26 changes: 13 additions & 13 deletions ostree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ set -e
function ENV_CREATE_OPTS {
# Do not touch disks in a booted system:
if [[ ! -d "/ostree" ]]; then
export OSTREE_SYS_ROOT=${OSTREE_SYS_ROOT:=/mnt} # Override
export OSTREE_DEV_DISK=${OSTREE_DEV_DISK:=/dev/disk/by-id/${OSTREE_DEV_SCSI}} # Required for install
export OSTREE_DEV_BOOT=${OSTREE_DEV_BOOT:=${OSTREE_DEV_DISK}-part1}
export OSTREE_DEV_ROOT=${OSTREE_DEV_ROOT:=${OSTREE_DEV_DISK}-part2}
export OSTREE_DEV_HOME=${OSTREE_DEV_HOME:=${OSTREE_DEV_DISK}-part3}
export OSTREE_SYS_ROOT=${OSTREE_SYS_ROOT:="/mnt"} # Override
export OSTREE_DEV_DISK=${OSTREE_DEV_DISK:="/dev/disk/by-id/${OSTREE_DEV_SCSI}"} # Required for install
export OSTREE_DEV_BOOT=${OSTREE_DEV_BOOT:="${OSTREE_DEV_DISK}-part1"}
export OSTREE_DEV_ROOT=${OSTREE_DEV_ROOT:="${OSTREE_DEV_DISK}-part2"}
export OSTREE_DEV_HOME=${OSTREE_DEV_HOME:="${OSTREE_DEV_DISK}-part3"}
fi

# Configurable:
export OSTREE_SYS_ROOT=${OSTREE_SYS_ROOT:=/}
export OSTREE_SYS_BUILD=${OSTREE_SYS_BUILD:=/tmp/rootfs}
export OSTREE_SYS_ROOT=${OSTREE_SYS_ROOT:="/"}
export OSTREE_SYS_BUILD=${OSTREE_SYS_BUILD:="/tmp/rootfs"}

export OSTREE_SYS_BOOT_LABEL=${OSTREE_SYS_BOOT_LABEL:=SYS_BOOT}
export OSTREE_SYS_ROOT_LABEL=${OSTREE_SYS_ROOT_LABEL:=SYS_ROOT}
export OSTREE_SYS_HOME_LABEL=${OSTREE_SYS_HOME_LABEL:=SYS_HOME}
export OSTREE_SYS_BOOT_LABEL=${OSTREE_SYS_BOOT_LABEL:="SYS_BOOT"}
export OSTREE_SYS_ROOT_LABEL=${OSTREE_SYS_ROOT_LABEL:="SYS_ROOT"}
export OSTREE_SYS_HOME_LABEL=${OSTREE_SYS_HOME_LABEL:="SYS_HOME"}

# Dynamic:
export SCRIPT_DIRECTORY=$(dirname "$0")
Expand Down Expand Up @@ -74,7 +74,7 @@ function OSTREE_CREATE_REPO {
ostree admin init-fs --sysroot=${OSTREE_SYS_ROOT} --modern ${OSTREE_SYS_ROOT}
ostree admin stateroot-init --sysroot=${OSTREE_SYS_ROOT} archlinux
ostree init --repo=${OSTREE_SYS_ROOT}/ostree/repo --mode=bare
ostree config --repo=${OSTREE_SYS_ROOT}/ostree/repo set sysroot.bootprefix 'true'
ostree config --repo=${OSTREE_SYS_ROOT}/ostree/repo set sysroot.bootprefix "true"
}

# [OSTREE]: CONTAINER
Expand All @@ -85,7 +85,7 @@ function OSTREE_CREATE_IMAGE {
if [[ $(df --output=fstype / | tail -n 1) = "overlay" ]]; then
ENV_CREATE_DEPS fuse-overlayfs
export TMPDIR="/tmp/podman"
PODMAN_ARGS=(
export PODMAN_ARGS=(
--root ${TMPDIR}/storage
--tmpdir ${TMPDIR}/tmp
)
Expand All @@ -107,7 +107,7 @@ function OSTREE_CREATE_IMAGE {

# [OSTREE]: COMMIT
function OSTREE_DEPLOY_IMAGE {
# Update repository and boot entries in GRUB
# Update repository and boot entries in GRUB2
#ostree commit --repo=${OSTREE_SYS_ROOT}/ostree/repo --branch=archlinux/latest --tree=tar=${OSTREE_SYS_BUILD}.tar --tar-autocreate-parents
ostree commit --repo=${OSTREE_SYS_ROOT}/ostree/repo --branch=archlinux/latest --tree=dir=${OSTREE_SYS_BUILD}
ostree admin deploy --sysroot=${OSTREE_SYS_ROOT} --karg="root=LABEL=SYS_ROOT" --karg="rw" --os=archlinux --no-merge --retain archlinux/latest
Expand Down

0 comments on commit 5cd5644

Please sign in to comment.