Skip to content

Commit

Permalink
Cleanup variables
Browse files Browse the repository at this point in the history
  • Loading branch information
0rax committed Jul 4, 2024
1 parent 3d20d63 commit 7a79072
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ RUN apt-get update -y -qq \
make debootstrap qemu-user-static binfmt-support file \
parted kpartx dosfstools zerofree xxd \
rsync wget ca-certificates gpg \
bc xz-utils git
bc xz-utils
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ OS_NAME ?= BerryOS
OS_VERSION ?= $(shell date "+%Y.%m.%d")
OS_REPO ?= https://github.com/0rax/BerryOS
GIT_HASH ?= $(shell git rev-parse HEAD)
DEBIAN_VERSION ?= 12
DEBIAN_RELEASE ?= bookworm

.DEFAULT: armhf
Expand All @@ -19,6 +20,9 @@ armhf: builder
docker compose run builder make rootfs image \
OS_NAME="$(OS_NAME)" \
OS_VERSION="$(OS_VERSION)" \
OS_REPO="$(OS_REPO)" \
GIT_HASH="$(GIT_HASH)" \
DEBIAN_VERSION="$(DEBIAN_VERSION)" \
DEBIAN_RELEASE="$(DEBIAN_RELEASE)" \
BUILD_ARCH=armhf

Expand All @@ -27,6 +31,9 @@ arm64: builder
docker compose run builder make rootfs image \
OS_NAME="$(OS_NAME)" \
OS_VERSION="$(OS_VERSION)" \
OS_REPO="$(OS_REPO)" \
GIT_HASH="$(GIT_HASH)" \
DEBIAN_VERSION="$(DEBIAN_VERSION)" \
DEBIAN_RELEASE="$(DEBIAN_RELEASE)" \
BUILD_ARCH=arm64

Expand All @@ -41,6 +48,7 @@ rootfs:
OS_VERSION="$(OS_VERSION)" \
OS_REPO="$(OS_REPO)" \
GIT_HASH="$(GIT_HASH)" \
DEBIAN_VERSION="$(DEBIAN_VERSION)" \
DEBIAN_RELEASE="$(DEBIAN_RELEASE)" \
BUILD_ARCH="$(BUILD_ARCH)" \
./scripts/00-bootstrap.sh
Expand Down
9 changes: 3 additions & 6 deletions scripts/00-bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ BUILD_ARCH="${BUILD_ARCH:-armhf}"
GIT_HASH="${GIT_HASH:-"main"}"

## Debian base
DEBIAN_VARIANT="Debian GNU/Linux"
DEBIAN_VERSION="${DEBIAN_VERSION:-"12"}"
DEBIAN_RELEASE="${DEBIAN_RELEASE:-"bookworm"}"

Expand Down Expand Up @@ -93,14 +92,12 @@ configure_rootfs () {
# Finish bootstrapping & configuring in chroot
chroot "${ROOTFS_DIR}" \
/usr/bin/env \
BUILD_ARCH="${BUILD_ARCH}" \
DEBIAN_RELEASE="${DEBIAN_RELEASE}" \
DEBIAN_VARIANT="${DEBIAN_VARIANT}" \
DEBIAN_VERSION="${DEBIAN_VERSION}" \
OS_NAME="${OS_NAME}" \
OS_VERSION="${OS_VERSION}" \
OS_REPO="${OS_REPO}" \
OS_REPO="${OS_REPO}" \
GIT_HASH="${GIT_HASH}" \
BUILD_ARCH="${BUILD_ARCH}" \
DEBIAN_RELEASE="${DEBIAN_RELEASE}" \
DEBOOTSTRAP_URL="${DEBOOTSTRAP_URL}" \
/bin/bash < "${BUILD_DIR}/scripts/01-chroot.sh"
chroot "${ROOTFS_DIR}" dpkg --get-selections | awk '{ print $1 }' > "${ROOTFS_PKGS}"
Expand Down
8 changes: 3 additions & 5 deletions scripts/01-chroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ fi
## Build config
OS_NAME="${OS_NAME?}"
OS_VERSION="${OS_VERSION?}"
OS_PREFIX="${OS_PREFIX:-${OS_NAME^^}}"
BUILD_ARCH="${BUILD_ARCH:-$(dpkg --print-architecture)}"

## Debian base
DEBIAN_VARIANT="${DEBIAN_VARIANT?}"
DEBIAN_RELEASE="${DEBIAN_RELEASE?}"
DEBIAN_VERSION="${DEBIAN_VERSION?}"
DEBOOTSTRAP_URL="${DEBOOTSTRAP_URL?}"

## System config
Expand Down Expand Up @@ -67,7 +64,7 @@ case "${BUILD_ARCH}" in
KERNEL_IMAGES="linux-image-rpi-v6 linux-image-rpi-v7 linux-image-rpi-v7l"
;;
arm64)
KERNEL_IMAGES="linux-image-rpi-v8"
KERNEL_IMAGES="linux-image-rpi-v8 linux-image-rpi-2712"
;;
esac

Expand Down Expand Up @@ -106,9 +103,10 @@ if ! [ -L /boot/issue.txt ]; then
fi

# Setup MOTD
DEBIAN_ISSUE=$(cat /etc/issue.net)
tee /etc/motd << EOF
${OS_NAME}/${BUILD_ARCH} ${OS_VERSION} (${DEBIAN_VARIANT} ${DEBIAN_VERSION})
${OS_NAME}/${BUILD_ARCH} ${OS_VERSION} (${DEBIAN_ISSUE})
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
Expand Down

0 comments on commit 7a79072

Please sign in to comment.