arch/build-archiso.sh

54 lines
1.7 KiB
Bash
Raw Normal View History

2021-04-28 17:21:39 +02:00
#!/bin/bash
#
# https://wiki.archlinux.org/index.php/Archiso#Prepare_a_custom_profile
#
2021-04-28 17:37:04 +02:00
# Arch installer with some additional packages:
2021-05-03 17:38:10 +02:00
# -> TODO: set custom welcome message in /etc/motd
# -> de-p1st-installer
# -> [de-p1st] repository enabled in pacman.conf
2021-04-28 17:37:04 +02:00
# -> german keyboard
2021-04-29 20:25:30 +02:00
# -> nano with syntax highlighting
2021-04-28 17:37:04 +02:00
# -> git
2021-05-14 15:25:25 +02:00
# -> screen with long scrollback history configured
2021-04-28 17:21:39 +02:00
#
BUILD_DIR=./archlive
2021-05-14 15:25:25 +02:00
PKGS=('git' 'de-p1st-keyboard' 'de-p1st-nano' 'de-p1st-screen' 'de-p1st-pacman' 'de-p1st-systemd' 'de-p1st-installer')
2021-04-28 17:37:04 +02:00
PACMAN_CFG_ADDITION='pkg/de-p1st-pacman/pacman.d/de-p1st' # will be used to extend the builder's pacman.conf
2021-04-28 17:21:39 +02:00
################################
2021-04-29 12:09:36 +02:00
if [ "$1" = "clean" ] ; then
2021-05-24 15:09:45 +02:00
sudo rm -r "${BUILD_DIR}" || exit $?
2021-04-29 12:09:36 +02:00
elif [ -d "${BUILD_DIR}" ] ; then
2021-04-28 17:21:39 +02:00
echo "Build dir does already exist and may not be empty!"
2021-04-29 12:09:36 +02:00
echo "Run '$0 clean' to start a clean ISO build."
2021-04-28 17:21:39 +02:00
exit 1
fi
2021-05-24 15:09:45 +02:00
mkdir "$BUILD_DIR" || exit $?
2021-04-29 12:09:36 +02:00
2021-04-28 17:21:39 +02:00
# The releng profile is used to create the official monthly installation ISO
PROFILE=/usr/share/archiso/configs/releng/
if [ ! -d "${PROFILE}" ] ; then
echo "Installing dependency 'archiso' with sudo ..."
2021-05-24 15:09:45 +02:00
sudo pacman -S --needed archiso || exit $?
2021-04-28 17:21:39 +02:00
fi
2021-05-24 15:09:45 +02:00
cp -r "$PROFILE" "$BUILD_DIR"/profile || exit $?
2021-04-28 17:21:39 +02:00
2021-04-29 20:25:30 +02:00
# extend the builder's pacman.conf (add de-p1st mirrors)
2021-04-28 17:21:39 +02:00
# https://wiki.archlinux.org/index.php/Archiso#Custom_local_repository
2021-05-24 15:09:45 +02:00
cat "${PACMAN_CFG_ADDITION}" >> "$BUILD_DIR"/profile/pacman.conf || exit $?
2021-04-28 17:21:39 +02:00
for PKG in "${PKGS[@]}"; do
echo "${PKG}" >> "${BUILD_DIR}"/profile/packages.x86_64
done
###
2021-05-24 15:09:45 +02:00
mkdir "${BUILD_DIR}/work_dir" && mkdir "${BUILD_DIR}/out_dir" || exit $?
2021-04-28 17:21:39 +02:00
echo "running 'sudo mkarchiso' ..."
2021-05-24 15:09:45 +02:00
sudo mkarchiso -v -w "${BUILD_DIR}/work_dir" -o "${BUILD_DIR}/out_dir" "${BUILD_DIR}/profile" || exit $?