mirror of
https://codeberg.org/privacy1st/arch
synced 2024-12-23 01:16:04 +01:00
76 lines
2.1 KiB
Bash
Executable File
76 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# https://wiki.archlinux.org/index.php/Archiso#Prepare_a_custom_profile
|
|
#
|
|
# TODO: set custom welcome message in /etc/motd
|
|
#
|
|
BUILD_DIR=/out
|
|
|
|
PKGS=()
|
|
PKGS+=('de-p1st-keyboard') # german keyboard
|
|
PKGS+=('de-p1st-nano') # syntax hilighting in nano
|
|
PKGS+=('de-p1st-screen') # longer scrollback history in screen
|
|
PKGS+=('de-p1st-pacman') # [de-p1st] mirror enabled
|
|
PKGS+=('de-p1st-installer') # de-p1st-installer script
|
|
|
|
################################
|
|
|
|
# Write-permission for user "build"
|
|
sudo chown "build:wheel" /out
|
|
|
|
function isEmptyDir() {
|
|
# arg $1: directory to check
|
|
|
|
if [ -z "$(find "${1}" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then
|
|
# echo "Not empty or NOT a directory"
|
|
return 1
|
|
else
|
|
# "Empty directory"
|
|
return 0
|
|
fi
|
|
}
|
|
|
|
|
|
if [ -d "${BUILD_DIR}" ]; then
|
|
if ! isEmptyDir "${BUILD_DIR}"; then
|
|
if [ "$1" = "clean" ]; then
|
|
sudo rm -r "${BUILD_DIR}"/* || exit $?
|
|
else
|
|
echo "BUILD_DIR not empty: ${BUILD_DIR}";
|
|
echo "Run with argument 'clean' to clean up BUILD_DIR and then continue building the ISO."
|
|
exit 1;
|
|
fi
|
|
fi # else: BUILD_DIR exists and is empty :)
|
|
elif ! mkdir -p "${BUILD_DIR}"; then
|
|
echo "Could not create BUILD_DIR: ${BUILD_DIR}";
|
|
exit 1;
|
|
fi
|
|
|
|
|
|
# The releng profile is used to create the official monthly installation ISO
|
|
PROFILE=/usr/share/archiso/configs/releng/
|
|
if [ ! -d "${PROFILE}" ]; then
|
|
echo "Dependency 'archiso' is missing. Please install this first!"
|
|
exit 1
|
|
fi
|
|
|
|
cp -r "$PROFILE" "$BUILD_DIR"/profile || exit $?
|
|
|
|
# extend the builder's pacman.conf (add de-p1st mirrors)
|
|
# 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 $?
|
|
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
|
|
echo "${PKG}" >>"${BUILD_DIR}"/profile/packages.x86_64
|
|
done
|
|
|
|
###
|
|
|
|
mkdir "${BUILD_DIR}/work_dir" && mkdir "${BUILD_DIR}/out_dir" || exit $?
|
|
|
|
echo "running 'sudo mkarchiso' ..."
|
|
sudo mkarchiso -v -w "${BUILD_DIR}/work_dir" -o "${BUILD_DIR}/out_dir" "${BUILD_DIR}/profile" || exit $?
|