windvn/make-os
2022-07-21 09:24:42 +02:00

54 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
if
if [ "$1" = "" ]; then
echo "Define i386/amd64 as the first argument."
exit 1
fi
cd "$(dirname "$(realpath -s "$BASH_SOURCE")")"
source shell
source "env-$1"
#export OPUS_IMAGEDIR="/media/zram/$1"
export OPUS_IMAGEDIR="$OPUS_OUTPUT/$1"
make-base "$OPUS_IMAGEDIR" # Base image
export OPUS_PACKAGES=""
export OPUS_PACKAGES_DL=""
export OPUS_PACKAGES_REMOVE=""
# Base
source apply-mod "$OPUS_HOME/input/sources" "$OPUS_IMAGEDIR"
source apply-mod "$OPUS_HOME/input/oobe" "$OPUS_IMAGEDIR"
# Base - Hardware
source apply-mod "$OPUS_HOME/input/kernel" "$OPUS_IMAGEDIR"
source apply-mod "$OPUS_HOME/input/firmware-free" "$OPUS_IMAGEDIR"
source apply-mod "$OPUS_HOME/input/grub" "$OPUS_IMAGEDIR"
# Graphical
source apply-mod "$OPUS_HOME/input/packages-graphical" "$OPUS_IMAGEDIR"
# Overrides
source apply-mod "$OPUS_HOME/input/hostname" "$OPUS_IMAGEDIR"
source apply-mod "$OPUS_HOME/input/user-config" "$OPUS_IMAGEDIR"
# Raw image
source apply-mod "$OPUS_HOME/input/image-raw" "$OPUS_IMAGEDIR"
# Packages
source apply-mod "$OPUS_HOME/input/fast-dpkg" "$OPUS_IMAGEDIR"
source apply-mod "$OPUS_HOME/input/packages-apply" "$OPUS_IMAGEDIR"
# Extra
source apply-mod "$OPUS_HOME/input/clean-logs" "$OPUS_IMAGEDIR"
make-image "$OPUS_IMAGEDIR" "$OPUS_OUTPUT/${OPUS_NAME}-${OPUS_DIST}-${OPUS_ARCH}_$(date "+%Y.%m.%d-%H.%M.%S").img" # Disk image
then
set +e
else
set +e
echo
echo Script execution ended due to error. Cleaning up...
fchroot-end "$OPUS_IMAGEDIR"
rm -r "$OPUS_IMAGEDIR"
echo Script execution ended due to error.
fi