mirror of
https://codeberg.org/privacy1st/arch
synced 2024-12-23 01:16:04 +01:00
refactor to build-archiso and build-pkg; add docker-compose for archiso script
This commit is contained in:
parent
e2160e6434
commit
fbb4169253
4
.gitignore
vendored
4
.gitignore
vendored
@ -8,5 +8,5 @@
|
|||||||
/pkg/*/*-x86_64-build.log
|
/pkg/*/*-x86_64-build.log
|
||||||
/pkg/de-p1st-gnupg/duraconf/
|
/pkg/de-p1st-gnupg/duraconf/
|
||||||
|
|
||||||
/archlive/
|
/build-archiso/out/
|
||||||
/out/
|
/build-pkg/out/
|
||||||
|
3
.idea/arch.iml
generated
3
.idea/arch.iml
generated
@ -3,7 +3,8 @@
|
|||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<excludeFolder url="file://$MODULE_DIR$/archlive" />
|
<excludeFolder url="file://$MODULE_DIR$/build-archiso/out" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build-pkg/out" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
36
build-archiso/Dockerfile
Normal file
36
build-archiso/Dockerfile
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Inspiration:
|
||||||
|
# * https://github.com/ungoogled-software/ungoogled-chromium-archlinux/blob/master/.github/workflows/build/Dockerfile
|
||||||
|
# * https://github.com/WhyNotHugo/docker-makepkg/blob/main/Dockerfile
|
||||||
|
|
||||||
|
FROM archlinux:base-devel
|
||||||
|
|
||||||
|
# Add de-p1st mirror ...
|
||||||
|
RUN printf '\n[de-p1st]\nSigLevel = Optional TrustAll\nServer = https://arch.p1st.de\n' >> /etc/pacman.conf
|
||||||
|
# ... and update mirrors + packages
|
||||||
|
RUN pacman -Syu --noconfirm && \
|
||||||
|
pacman -S --noconfirm archiso
|
||||||
|
|
||||||
|
# Set packager
|
||||||
|
RUN sed --in-place 's|^#PACKAGER=.*$|PACKAGER="Daniel Langbein <daniel@systemli.org>"|' /etc/makepkg.conf
|
||||||
|
# Store built packages in /out/
|
||||||
|
RUN sed --in-place 's|^#PKGDEST=.*$|PKGDEST=/out|' /etc/makepkg.conf
|
||||||
|
|
||||||
|
# Create a normal user to build the ISO
|
||||||
|
RUN useradd --create-home build
|
||||||
|
RUN echo "build ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||||
|
|
||||||
|
# Create output directory
|
||||||
|
RUN mkdir -p /out
|
||||||
|
|
||||||
|
# Continue execution (and CMD) as notroot:
|
||||||
|
USER build
|
||||||
|
WORKDIR /home/build
|
||||||
|
|
||||||
|
# Auto-fetch GPG keys (to check signatures):
|
||||||
|
RUN mkdir .gnupg && \
|
||||||
|
echo "keyserver-options auto-key-retrieve" > .gnupg/gpg.conf
|
||||||
|
|
||||||
|
COPY run.sh /home/build/run.sh
|
||||||
|
ENTRYPOINT [ "/bin/bash", "/home/build/run.sh" ]
|
||||||
|
# Default arguments passed to /run.sh
|
||||||
|
# CMD [ "clean" ]
|
18
build-archiso/docker-compose.yml
Normal file
18
build-archiso/docker-compose.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
version: '3.7'
|
||||||
|
services:
|
||||||
|
|
||||||
|
# usage:
|
||||||
|
# sudo docker-compose run archiso
|
||||||
|
archiso:
|
||||||
|
build: .
|
||||||
|
|
||||||
|
# command: ["clean"]
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- ./out:/out
|
||||||
|
|
||||||
|
## interactive
|
||||||
|
#stdin_open: true # docker run -i
|
||||||
|
#tty: true # docker run -t
|
||||||
|
|
||||||
|
privileged: true
|
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# TODO: set custom welcome message in /etc/motd
|
# TODO: set custom welcome message in /etc/motd
|
||||||
#
|
#
|
||||||
BUILD_DIR=./archlive
|
BUILD_DIR=/out
|
||||||
|
|
||||||
PKGS=()
|
PKGS=()
|
||||||
PKGS+=('de-p1st-keyboard') # german keyboard
|
PKGS+=('de-p1st-keyboard') # german keyboard
|
||||||
@ -15,8 +15,13 @@ PKGS+=('de-p1st-installer') # de-p1st-installer script
|
|||||||
|
|
||||||
################################
|
################################
|
||||||
|
|
||||||
|
# Write-permission for user "build"
|
||||||
|
sudo chown "build:wheel" /out
|
||||||
|
|
||||||
function isEmptyDir() {
|
function isEmptyDir() {
|
||||||
if [ -n "$(find "$DIR_TO_CHECK" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then
|
# arg $1: directory to check
|
||||||
|
|
||||||
|
if [ -z "$(find "${1}" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then
|
||||||
# "Empty directory"
|
# "Empty directory"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
@ -29,16 +34,15 @@ function isEmptyDir() {
|
|||||||
if [ -d "${BUILD_DIR}" ]; then
|
if [ -d "${BUILD_DIR}" ]; then
|
||||||
if ! isEmptyDir "${BUILD_DIR}"; then
|
if ! isEmptyDir "${BUILD_DIR}"; then
|
||||||
if [ "$1" = "clean" ]; then
|
if [ "$1" = "clean" ]; then
|
||||||
sudo rm -r "${BUILD_DIR}" || exit $?
|
sudo rm -r "${BUILD_DIR}"/* || exit $?
|
||||||
mkdir -p "${BUILD_DIR}" || exit $?
|
|
||||||
else
|
else
|
||||||
echo "BUILD_DIR not empty";
|
echo "BUILD_DIR not empty: ${BUILD_DIR}";
|
||||||
echo "Run '$0 clean' to start a clean ISO build."
|
echo "Run with argument 'clean' to clean up BUILD_DIR and then continue building the ISO."
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
fi # else: BUILD_DIR exists and is empty :)
|
fi # else: BUILD_DIR exists and is empty :)
|
||||||
elif ! mkdir -p "${BUILD_DIR}"; then
|
elif ! mkdir -p "${BUILD_DIR}"; then
|
||||||
echo "Could not create BUILD_DIR";
|
echo "Could not create BUILD_DIR: ${BUILD_DIR}";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -46,15 +50,18 @@ fi
|
|||||||
# The releng profile is used to create the official monthly installation ISO
|
# The releng profile is used to create the official monthly installation ISO
|
||||||
PROFILE=/usr/share/archiso/configs/releng/
|
PROFILE=/usr/share/archiso/configs/releng/
|
||||||
if [ ! -d "${PROFILE}" ]; then
|
if [ ! -d "${PROFILE}" ]; then
|
||||||
echo "Installing dependency 'archiso' with sudo ..."
|
echo "Dependency 'archiso' is missing. Please install this first!"
|
||||||
sudo pacman -S --needed archiso || exit $?
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp -r "$PROFILE" "$BUILD_DIR"/profile || exit $?
|
cp -r "$PROFILE" "$BUILD_DIR"/profile || exit $?
|
||||||
|
|
||||||
# extend the builder's pacman.conf (add de-p1st mirrors)
|
# extend the builder's pacman.conf (add de-p1st mirrors)
|
||||||
# https://wiki.archlinux.org/index.php/Archiso#Custom_local_repository
|
# https://wiki.archlinux.org/index.php/Archiso#Custom_local_repository
|
||||||
cat "pkg/de-p1st-pacman/pacman.d/de-p1st" >>"$BUILD_DIR"/profile/pacman.conf || exit $?
|
# cat ../pkg/de-p1st-pacman/pacman.d/de-p1st >>"$BUILD_DIR"/profile/pacman.conf || exit $?
|
||||||
|
echo '[de-p1st]
|
||||||
|
SigLevel = Optional TrustAll
|
||||||
|
Server = https://arch.p1st.de' | sudo tee -a "$BUILD_DIR"/profile/pacman.conf || exit $?
|
||||||
|
|
||||||
for PKG in "${PKGS[@]}"; do
|
for PKG in "${PKGS[@]}"; do
|
||||||
echo "${PKG}" >>"${BUILD_DIR}"/profile/packages.x86_64
|
echo "${PKG}" >>"${BUILD_DIR}"/profile/packages.x86_64
|
@ -29,13 +29,13 @@ function build-pkg() {
|
|||||||
PKG="$1"
|
PKG="$1"
|
||||||
|
|
||||||
# Check if PKGBUILD exists, otherwise skip
|
# Check if PKGBUILD exists, otherwise skip
|
||||||
[ -f "pkg/${PKG}/PKGBUILD" ] || {
|
[ -f "../pkg/${PKG}/PKGBUILD" ] || {
|
||||||
echo "Directory pkg/${PKG} does not contain a PKGBUILD file - skipping it!";
|
echo "Directory ../pkg/${PKG} does not contain a PKGBUILD file - skipping it!";
|
||||||
SKIPPED_PKGS+=("${PKG}");
|
SKIPPED_PKGS+=("${PKG}");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cd "pkg/${PKG}" || return $?
|
cd "../pkg/${PKG}" || return $?
|
||||||
|
|
||||||
# Build and copy to /home/custompkgs
|
# Build and copy to /home/custompkgs
|
||||||
# build-with-makepkg || {
|
# build-with-makepkg || {
|
||||||
@ -44,7 +44,7 @@ function build-pkg() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
cd ../.. || return $?
|
cd ../../build-pkg || return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
function push-pkg() {
|
function push-pkg() {
|
||||||
@ -72,7 +72,7 @@ function main() {
|
|||||||
SKIPPED_PKGS=()
|
SKIPPED_PKGS=()
|
||||||
|
|
||||||
if [ "$1" = "all" ]; then
|
if [ "$1" = "all" ]; then
|
||||||
for PKG in pkg/*; do
|
for PKG in ../pkg/*; do
|
||||||
build-pkg "$(basename "${PKG}")" || return $?
|
build-pkg "$(basename "${PKG}")" || return $?
|
||||||
done
|
done
|
||||||
elif [ "$#" -gt "0" ]; then
|
elif [ "$#" -gt "0" ]; then
|
@ -8,7 +8,7 @@ services:
|
|||||||
command: ["de-p1st-font"]
|
command: ["de-p1st-font"]
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./pkg:/pkg:ro
|
- ../pkg:/pkg:ro
|
||||||
- ./out:/out
|
- ./out:/out
|
||||||
|
|
||||||
# interactive
|
# interactive
|
@ -7,7 +7,7 @@
|
|||||||
1) Build the ISO: Run script found in the base of this git repo:
|
1) Build the ISO: Run script found in the base of this git repo:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
./build-archiso.sh
|
./build-archiso/run.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
2) Boot into the live medium and (optionally) run `screen` (to be able to scroll back in case of any errors)
|
2) Boot into the live medium and (optionally) run `screen` (to be able to scroll back in case of any errors)
|
||||||
@ -20,7 +20,7 @@ de-p1st-installer
|
|||||||
|
|
||||||
### via official livemedium
|
### via official livemedium
|
||||||
|
|
||||||
1) Boot into the live medium from [archlinux.org](archlinux.org)
|
1) Boot into the live medium from [archlinux.org](https://archlinux.org)
|
||||||
2) Add to `/etc/pacman.conf`:
|
2) Add to `/etc/pacman.conf`:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
Loading…
Reference in New Issue
Block a user