Compare commits

..

8 Commits

Author SHA1 Message Date
phanes
07939eb9ec re-adding project_config 2023-05-28 05:05:28 -04:00
phanes
832361fd6f reduction of ISO size to 1.9 GB - milestone 2023-05-28 00:29:16 -04:00
phanes
93f40be56e size reduction of iso - 6.4G 2023-05-26 12:34:19 -04:00
phanes
2ce0b4fb7a adding missing livecd files 2023-05-25 22:38:19 -04:00
phanes
8b7e0cc32f major improvements to iso boot 2023-04-08 08:54:32 -04:00
phanes
6b852ee8f0 2023-04-07 snapshot 2023-04-07 00:37:06 -04:00
phanes
7428c41ce9 fixed bug introduced in download_sources target 2023-04-02 18:49:57 -04:00
phanes
f276e5e3e7 fix typo in makefile 2023-04-02 02:47:56 -04:00
65 changed files with 783 additions and 64 deletions

View File

@@ -99,6 +99,7 @@ master:
livecd:
set -e
make disarm_chroot
sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/livecd.sh"
# example:
@@ -127,7 +128,7 @@ all:
make build_stage3 && \
make build_stage4 && \
make build_stage5 && \
make backup &&
make backup
# Remember, before you make clean or make purge_artifacts you MUST run

View File

@@ -1,9 +1,15 @@
set timeout=5
set default=0
set gfxmode=1024x768x32
set gfxpayload=keep
serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
terminal_input console serial
terminal_output console serial
menuentry "Dark Horse Linux (Pre-Alpha)" {
set root=(cd)
linux /boot/vmlinuz-6.0.12-dark_horse-pyrois boot=live root=/dev/sr0 rw
linux /boot/vmlinuz-6.0.12-dark_horse-pyrois boot=live root=LABEL=livecd rootflags=ro rootfstype=auto toram tmpfs_size=50% rd.shell systemd.log_target=kmsg log_buf_len=1M console=tty1 console=ttyS0,115200 init=/boot/init-overlay
initrd /boot/initramfs-6.0.12.img
}

24
configs/init-overlay Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/sh
mkdir /run/overlay
# Set up the overlay filesystem
mount -t tmpfs tmpfs /run/overlay
mkdir -p /run/overlay/upper
mkdir -p /run/overlay/work
mkdir -p /run/overlay/root
mount -t overlay overlay -o lowerdir=/,upperdir=/run/overlay/upper,workdir=/run/overlay/work /run/overlay/root
# Pivot the root filesystem to the overlay filesystem
pivot_root /run/overlay/root /run/overlay/root/mnt
# Move the original mount points to their new locations
for i in dev proc sys run; do
mount --move /mnt/$i /$i
done
# Clean up and switch to the new init
umount /mnt
exec chroot . /sbin/init <dev/console >dev/console 2>&1

View File

@@ -1,15 +1,15 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 6.0.12-100.fc35.x86_64 Kernel Configuration
# Linux/x86 6.0.12 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.3.1 20220421 (Red Hat 11.3.1-3)"
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=110301
CONFIG_GCC_VERSION=120200
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=23700
CONFIG_AS_VERSION=24000
CONFIG_LD_IS_BFD=y
CONFIG_LD_VERSION=23700
CONFIG_LD_VERSION=24000
CONFIG_LLD_VERSION=0
CONFIG_CC_CAN_LINK=y
CONFIG_CC_CAN_LINK_STATIC=y
@@ -17,7 +17,7 @@ CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y
CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT=y
CONFIG_CC_HAS_ASM_INLINE=y
CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y
CONFIG_PAHOLE_VERSION=122
CONFIG_PAHOLE_VERSION=0
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_TABLE_SORT=y
CONFIG_THREAD_INFO_IN_TASK=y
@@ -31,7 +31,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_UAPI_HEADER_TEST=y
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_BUILD_SALT="6.0.12-100.fc35.x86_64"
CONFIG_BUILD_SALT="6.0.12.darkhorse.x86_64"
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
@@ -194,6 +194,7 @@ CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y
CONFIG_CC_HAS_INT128=y
CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
CONFIG_GCC12_NO_ARRAY_BOUNDS=y
CONFIG_CC_NO_ARRAY_BOUNDS=y
CONFIG_ARCH_SUPPORTS_INT128=y
CONFIG_NUMA_BALANCING=y
CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y
@@ -9150,10 +9151,14 @@ CONFIG_INTEL_QEP=m
CONFIG_DCACHE_WORD_ACCESS=y
CONFIG_VALIDATE_FS_PARSER=y
CONFIG_FS_IOMAP=y
# CONFIG_EXT2_FS is not set
# CONFIG_EXT3_FS is not set
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_POSIX_ACL=y
CONFIG_EXT2_FS_SECURITY=y
CONFIG_EXT3_FS=y
CONFIG_EXT3_FS_POSIX_ACL=y
CONFIG_EXT3_FS_SECURITY=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT2=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
# CONFIG_EXT4_DEBUG is not set
@@ -9161,17 +9166,8 @@ CONFIG_EXT4_KUNIT_TESTS=m
CONFIG_JBD2=y
# CONFIG_JBD2_DEBUG is not set
CONFIG_FS_MBCACHE=y
CONFIG_REISERFS_FS=m
# CONFIG_REISERFS_CHECK is not set
CONFIG_REISERFS_PROC_INFO=y
CONFIG_REISERFS_FS_XATTR=y
CONFIG_REISERFS_FS_POSIX_ACL=y
CONFIG_REISERFS_FS_SECURITY=y
CONFIG_JFS_FS=m
CONFIG_JFS_POSIX_ACL=y
CONFIG_JFS_SECURITY=y
# CONFIG_JFS_DEBUG is not set
# CONFIG_JFS_STATISTICS is not set
# CONFIG_REISERFS_FS is not set
# CONFIG_JFS_FS is not set
CONFIG_XFS_FS=m
CONFIG_XFS_SUPPORT_V4=y
CONFIG_XFS_QUOTA=y
@@ -9244,12 +9240,12 @@ CONFIG_FUSE_FS=m
CONFIG_CUSE=m
CONFIG_VIRTIO_FS=m
CONFIG_FUSE_DAX=y
CONFIG_OVERLAY_FS=m
# CONFIG_OVERLAY_FS_REDIRECT_DIR is not set
CONFIG_OVERLAY_FS=y
CONFIG_OVERLAY_FS_REDIRECT_DIR=y
CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y
# CONFIG_OVERLAY_FS_INDEX is not set
# CONFIG_OVERLAY_FS_XINO_AUTO is not set
# CONFIG_OVERLAY_FS_METACOPY is not set
CONFIG_OVERLAY_FS_INDEX=y
CONFIG_OVERLAY_FS_XINO_AUTO=y
CONFIG_OVERLAY_FS_METACOPY=y
#
# Caches
@@ -9355,7 +9351,7 @@ CONFIG_UBIFS_FS_XATTR=y
CONFIG_UBIFS_FS_SECURITY=y
CONFIG_UBIFS_FS_AUTHENTICATION=y
# CONFIG_CRAMFS is not set
CONFIG_SQUASHFS=m
CONFIG_SQUASHFS=y
# CONFIG_SQUASHFS_FILE_CACHE is not set
CONFIG_SQUASHFS_FILE_DIRECT=y
# CONFIG_SQUASHFS_DECOMP_SINGLE is not set
@@ -9587,7 +9583,6 @@ CONFIG_SECURITY_YAMA=y
# CONFIG_SECURITY_SAFESETID is not set
CONFIG_SECURITY_LOCKDOWN_LSM=y
CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y
CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT=y
CONFIG_LOCK_DOWN_KERNEL_FORCE_NONE=y
# CONFIG_LOCK_DOWN_KERNEL_FORCE_INTEGRITY is not set
# CONFIG_LOCK_DOWN_KERNEL_FORCE_CONFIDENTIALITY is not set
@@ -9639,12 +9634,12 @@ CONFIG_LSM="lockdown,yama,integrity,selinux,bpf,landlock"
#
# Memory initialization
#
CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y
CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_BARE=y
CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y
CONFIG_INIT_STACK_NONE=y
CONFIG_INIT_STACK_ALL_PATTERN=n
CONFIG_INIT_STACK_ALL_ZERO=n
# CONFIG_GCC_PLUGIN_STRUCTLEAK_USER is not set
# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF is not set
# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL is not set
# CONFIG_INIT_STACK_ALL_PATTERN is not set
# CONFIG_INIT_STACK_ALL_ZERO is not set
# CONFIG_GCC_PLUGIN_STACKLEAK is not set
# CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set
# CONFIG_INIT_ON_FREE_DEFAULT_ON is not set
@@ -9961,7 +9956,7 @@ CONFIG_CRC_CCITT=y
CONFIG_CRC16=y
CONFIG_CRC_T10DIF=y
CONFIG_CRC64_ROCKSOFT=y
CONFIG_CRC_ITU_T=m
CONFIG_CRC_ITU_T=y
CONFIG_CRC32=y
# CONFIG_CRC32_SELFTEST is not set
CONFIG_CRC32_SLICEBY8=y
@@ -10104,7 +10099,7 @@ CONFIG_DEBUG_KERNEL=y
#
# Compile-time checks and compiler options
#
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_INFO=n
CONFIG_AS_HAS_NON_CONST_LEB128=y
# CONFIG_DEBUG_INFO_NONE is not set
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
@@ -10113,10 +10108,7 @@ CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
# CONFIG_DEBUG_INFO_REDUCED is not set
# CONFIG_DEBUG_INFO_COMPRESSED is not set
# CONFIG_DEBUG_INFO_SPLIT is not set
CONFIG_DEBUG_INFO_BTF=n
CONFIG_PAHOLE_HAS_SPLIT_BTF=y
CONFIG_DEBUG_INFO_BTF_MODULES=y
# CONFIG_MODULE_ALLOW_BTF_MISMATCH is not set
# CONFIG_DEBUG_INFO_BTF is not set
# CONFIG_GDB_SCRIPTS is not set
CONFIG_FRAME_WARN=2048
CONFIG_STRIP_ASM_SYMS=y

View File

@@ -1,4 +1,6 @@
#!/bin/bash
set -u
APPNAME="CHROOT VFS SETUP"
T_SYSROOT=${dir_sysroot}
set -a

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -u
# fix an issue with open files limit on some hosts
ulimit -l unlimited

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -u
# fix an issue with open files limit on some hosts
ulimit -l unlimited

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -u
# closely aligns with LFS Ch 5, 6

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -u
# closely aligns with LFS Ch 5, 6
# fix an issue with open files limit on some hosts

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -u
# fix an issue with open files limit on some hosts
ulimit -l unlimited

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -u
# fix an issue with open files limit on some hosts
ulimit -l unlimited

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -u
# fix an issue with open files limit on some hosts
ulimit -l unlimited

View File

@@ -1,4 +1,6 @@
# clean the slate
set -u
echo
echo "Deleting ${dir_stage}"
rm -Rf ${dir_stage}

View File

@@ -1,3 +1,7 @@
#!/usr/bin/env bash
set -u
function echofail() {
echo $1
exit 1

View File

@@ -1,4 +1,6 @@
#!/bin/bash
set -u
APPNAME="CHROOT VKFS SETUP"
# ISO 8601 variation

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -u
function echofail() {
echo "FAILED: $1"

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -u
function echofail() {
echo "FAILED: $1"
@@ -19,7 +20,6 @@ wget \
https://storage.darkhorselinux.org/sources/upstream_sources/ \
|| echofail "Downloading sources..."
echo "Validating source downloads..."
pushd ${dir_sources} 1>/dev/null 2>/dev/null

View File

@@ -1,4 +1,7 @@
#!/bin/bash
set -u
APPNAME="CHROOT VFS SETUP"
T_SYSROOT=${dir_sysroot}

View File

@@ -1,3 +1,6 @@
#!/usr/bin/env bash
set -u
function echofail() {
echo "Failed: $1"

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -u
# fix an issue with open files limit on some hosts
ulimit -l unlimited

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -u
# fix an issue with open files limit on some hosts
ulimit -l unlimited

View File

@@ -1,3 +1,7 @@
#!/usr/bin/env bash
set -u
echo
echo "Recreating ${dir_artifacts}"
rm -Rf ${dir_artifacts}

View File

@@ -37,7 +37,7 @@ dir_artifacts=${dir_stage}/artifacts
# path for the logs
dir_logs=${project_root}/logs
LOGS_ROOT="$dir_logs"
# config directory - general path for configuration files on the target
# system before they're placed, as well as various values for configure
# of the build
@@ -69,3 +69,4 @@ if [ -n "$1" ]; then
fi
# EOF
COLORTERM="truecolor"

View File

@@ -66,8 +66,6 @@ function perform_backup() {
logprint "Re-arming chroot..."
make arm_chroot
echo
logprint "You may now proceed to run 'make build_stage4'."
echo
}

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:
@@ -136,7 +137,10 @@ mode_build() {
autoreconf -i
assert_zero $?
./configure
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--docdir=/usr/share/doc/${APPNAME}-${VERSION}
assert_zero $?
logprint "Compiling docs..."

View File

@@ -4,7 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:
@@ -138,7 +139,7 @@ mode_build() {
--sysconfdir=/etc \
--disable-static \
--with-history \
--docdir=/usr/share/doc/${APPNAME}-${VERSION}
--docdir=/usr/share/doc/${APPNAME}-${VERSION} \
PYTHON=/usr/bin/python3
assert_zero $?

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -4,10 +4,10 @@
# make variables persist in subprocesses for logging function
set -a
set -u
APPNAME="livecd"
# the file to log to
LOGFILE="${APPNAME}.log"
@@ -33,14 +33,24 @@ logprint "Creating grub boot directory..."
mkdir -p ${T_SYSROOT}/boot/grub
assert_zero $?
logprint "Installing livecd grub config"
cp -vf ${CONFIGS_DIR}/boot_grub_grub.cfg ${T_SYSROOT}/boot/grub/grub.cfg
assert_zero $?
logprint "Staging OverlayFS Init Script"
cp ${CONFIGS_DIR}/init-overlay ${T_SYSROOT}/boot/init-overlay
assert_zero $?
pushd ${dir_artifacts}
assert_zero $?
logprint "Emptying source stage..."
rm -Rf ${TEMP_STAGE_DIR}
assert_zero $?
rm -Rf ${T_SYSROOT}/${rex_dir}
assert_zero $?
logprint "Generating initramfs..."
# TODO chroot ignores this, and it breaks binutils pass 3
ulimit -n 3000000
@@ -49,11 +59,11 @@ ulimit -n 3000000
TERM="xterm-256color" \
PS1='\n(dark horse linux) [ \u @ \H ] << \w >>\n\n[- ' \
PATH=/usr/bin:/usr/sbin \
dracut --force '' 6.0.12
dracut -c /usr/etc/dracut.conf --force '' 6.0.12
assert_zero $?
logprint "Generating bootable ISO"
grub2-mkrescue -o DHLP.iso ${T_SYSROOT}
grub2-mkrescue -A livecd -o DHLP.iso -V "livecd" ${T_SYSROOT}
assert_zero $?
logprint "Thanks for using Dark Horse Linux. Your experimental build is at '${dir_artifacts}/DHLP.iso'."

View File

@@ -44,5 +44,5 @@ echo -e "\e[31m$HORSE\e[0m"
echo
echo "Welcome to Pyrois, the build system for Dark Horse Linux."
echo
echo "LIVD CD GENERATOR"
echo "LIVE CD GENERATOR"
echo

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:
@@ -326,6 +327,9 @@ mode_install_pass2() {
rm -v ${T_SYSROOT}/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes}.{a,la}
assert_zero $?
rm -v rm -fv /usr/share/man/man1/{gprofng,gp-*}.1
assert_zero $?
logprint "Install operation complete."
}

View File

@@ -1,5 +1,7 @@
#!/bin/bash
# Simple script to list version numbers of critical development tools
set -u
export LC_ALL=C
echo

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -u
mkdir -pv ${dir_sysroot}/{etc,var} ${dir_sysroot}/usr/{bin,lib,sbin} || echofail "Creating sysroot directories..."

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:
@@ -488,7 +489,7 @@ if \
[ "$MODE_BUILD_GCC_PASS1" != "true" ] && \
[ "$MODE_INSTALL_GCC_PASS1" != "true" ] && \
[ "$MODE_BUILD_GCC_PASS2" != "true" ] && \
[ "$MODE_INSTALL_PASS2" != "true" ] && \
[ "$MODE_INSTALL_GCC_PASS2" != "true" ] && \
[ "$MODE_BUILD_LIBSTDCXX_PASS1" != "true" ] && \
[ "$MODE_INSTALL_LIBSTDCXX_PASS1" != "true" ] && \
[ "$MODE_BUILD_LIBSTDCXX_PASS2" != "true" ] && \

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -3,6 +3,7 @@
# print to stdout, print to log
# the path where logs are written to
# note: LOGS_ROOT is sourced from environment
set -u
APPNAME="FIX_CHROOT_PERMS"

View File

@@ -4,7 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -3,6 +3,7 @@
# print to stdout, print to log
# the path where logs are written to
# note: LOGS_ROOT is sourced from environment
set -u
APPNAME="CHROOT PASSWD GROUPS"

View File

@@ -3,6 +3,7 @@
# print to stdout, print to log
# the path where logs are written to
# note: LOGS_ROOT is sourced from environment
set -u
APPNAME="CHROOT VFS SETUP"

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -4,6 +4,7 @@
# make variables persist in subprocesses for logging function
set -a
set -u
# ----------------------------------------------------------------------
# Configuration:

View File

@@ -3,6 +3,7 @@
# print to stdout, print to log
# the path where logs are written to
# note: LOGS_ROOT is sourced from environment
set -u
APPNAME="Cleaning up the Temporary System"

View File

@@ -41,6 +41,88 @@ logprint "Deleting temporary toolchain..."
find /usr -depth -name ${T_TRIPLET}\* | xargs rm -vrf
assert_zero $?
# almost directly lifted from LFS
logprint "Stripping Debuginfo..."
save_usrlib="$(cd /usr/lib; ls ld-linux*[^g])
libc.so.6
libthread_db.so.1
libquadmath.so.0.0.0
libstdc++.so.6.0.30
libitm.so.1.0.0
libatomic.so.1.2.0"
pushd /usr/lib
for LIB in $save_usrlib; do
logprint "Stripping LIB:\t$LIB"
objcopy --only-keep-debug $LIB $LIB.dbg
cp $LIB /tmp/$LIB
assert_zero $?
strip --strip-unneeded /tmp/$LIB
assert_zero $?
objcopy --add-gnu-debuglink=$LIB.dbg /tmp/$LIB
assert_zero $?
install -vm755 /tmp/$LIB /usr/lib
assert_zero $?
done
online_usrbin="bash find strip"
online_usrlib="libbfd-2.40.so
libsframe.so.0.0.0
libhistory.so.8.2
libncursesw.so.6.4
libm.so.6
libreadline.so.8.2
libz.so.1.2.13
$(cd /usr/lib; find libnss*.so* -type f)"
for BIN in $online_usrbin; do
logprint "Stripping BIN:\t$BIN"
cp /usr/bin/$BIN /tmp/$BIN
assert_zero $?
strip --strip-unneeded /tmp/$BIN
assert_zero $?
install -vm755 /tmp/$BIN /usr/bin
assert_zero $?
done
LIB=""
for LIB in $online_usrlib; do
logprint "Stripping LIB:\t$LIB"
cp /usr/lib/$LIB /tmp/$LIB
assert_zero $?
strip --strip-unneeded /tmp/$LIB
assert_zero $?
install -vm755 /tmp/$LIB /usr/lib
assert_zero $?
done
for i in $(find /usr/lib -type f -name \*.so* ! -name \*dbg) \
$(find /usr/lib -type f -name \*.a) \
$(find /usr/{bin,sbin,libexec} -type f); do
case "$online_usrbin $online_usrlib $save_usrlib" in
*$(basename $i)* )
;;
* ) strip --strip-unneeded $i
;;
esac
done
echo; echo; echo
logprint "Cleaning /tmp/"
rm -Rf /tmp/*
assert_zero $?
logprint "Cleanup .la files..."
find /usr/lib /usr/libexec -name \*.la -delete
assert_zero $?
logprint "Removing temporary tools..."
find /usr -depth -name "${T_TRIPLET}*" -exec rm -rf {} \;
assert_zero $?
# TODO better integrate test user lifecycle
logprint "Execution of ${APPNAME} completed."

View File

@@ -198,7 +198,6 @@ mode_install() {
useradd -D --gid 999
assert_zero $?
logprint "Install operation complete."
}

View File

@@ -139,7 +139,7 @@ mode_build() {
logprint "Configuring kernel..."
cp -vf ${CONFIGS_DIR}/kernel_config ./.config
assert_zero $?
logprint "Compiling kernel"
make
assert_zero $?
@@ -154,7 +154,7 @@ mode_install() {
assert_zero $?
logprint "Installing modules..."
make modules_install
make INSTALL_MOD_STRIP=1 modules_install
assert_zero $?
logprint "Installing kernel"

View File

@@ -0,0 +1,219 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="squashfs"
# the version of this application
VERSION="4.6.1"
# ----------------------------------------------------------------------
# Variables and functions sourced from Environment:
# ----------------------------------------------------------------------
# assert_zero()
# Checks if $1 is 0. If non-0 value, halts the execution of the script.
#
# LOGS_ROOT
# The parent directory where logs from this project will go.
#
# TEMP_STAGE_DIR
# The parent directory of where source archives are extracted to.
# register mode selections
ARGUMENT_LIST=(
"stage"
"build"
"install"
"all"
"help"
)
# modes to associate with switches
# assumes you want nothing done unless you ask for it.
MODE_STAGE=false
MODE_BUILD=false
MODE_INSTALL=false
MODE_ALL=false
MODE_HELP=false
# the file to log to
LOGFILE="${APPNAME}.log"
# ISO 8601 variation
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
# the path where logs are written to
# note: LOGS_ROOT is sourced from environment
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
mkdir -p ${TEMP_STAGE_DIR}
# the path where the source will be located when complete
# note: TEMP_STAGE_DIR is sourced from environment
T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}"
# read defined arguments
opts=$(getopt \
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
--name "$APPNAME" \
--options "" \
-- "$@"
)
# process supplied arguments into flags that enable execution modes
eval set --$opts
while [[ $# -gt 0 ]]; do
case "$1" in
--stage)
MODE_STAGE=true
shift 1
;;
--build)
MODE_BUILD=true
shift 1
;;
--install)
MODE_INSTALL=true
shift 1
;;
--all)
MODE_ALL=true
shift 1
;;
--help)
MODE_HELP=true
shift 1
;;
*)
break
;;
esac
done
# print to stdout, print to log
logprint() {
mkdir -p "${LOG_DIR}"
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
| tee -a "${LOG_DIR}/${LOGFILE}"
}
# Tell the user we're alive...
logprint "Initializing the ${APPNAME} utility..."
# when the stage mode is enabled, this will execute
mode_stage() {
logprint "Starting stage of ${APPNAME}..."
logprint "Removing any pre-existing staging for ${APPNAME}."
rm -Rf "${T_SOURCE_DIR}"*
logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}"
echo "${SOURCES_DIR}/${APPNAME}${VERSION}.tar."* -C "${TEMP_STAGE_DIR}"
tar xf "${SOURCES_DIR}/${APPNAME}${VERSION}.tar."* -C "${TEMP_STAGE_DIR}"
assert_zero $?
# conditionally rename if it needs it
stat "${T_SOURCE_DIR}"* && mv "${T_SOURCE_DIR}"* "${T_SOURCE_DIR}"
logprint "Staging operation complete."
}
# when the build_pass1 mode is enabled, this will execute
mode_build() {
# patch, configure and build
logprint "Starting build of ${APPNAME}..."
logprint "Entering build dir."
pushd "${T_SOURCE_DIR}"
assert_zero $?
pushd squashfs-tools
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Build operation complete."
}
mode_install() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
pushd squashfs-tools
assert_zero $?
# fixing nonsense
#sed -i 's/ECHO=$(which echo)/ECHO="echo"/' ../generate-manpages/functions.sh
#assert_zero $?
#sed -i '4,8s/^/#/' ../generate-manpages/functions.sh
#assert_zero $?
sed -i 's|INSTALL_DIR = $(INSTALL_PREFIX)/bin|INSTALL_DIR = /usr/sbin|' Makefile
assert_zero $?
logprint "Installing..."
make install
assert_zero $?
logprint "Install operation complete."
}
mode_help() {
echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]"
exit 1
}
if [ "$MODE_ALL" = "true" ]; then
MODE_STAGE=true
MODE_BUILD=true
MODE_INSTALL=true
fi
# if no options were selected, then show help and exit
if \
[ "$MODE_HELP" != "true" ] && \
[ "$MODE_STAGE" != "true" ] && \
[ "$MODE_BUILD" != "true" ] && \
[ "$MODE_INSTALL" != "true" ]
then
logprint "No option selected during execution."
mode_help
fi
# if help was supplied at all, show help and exit
if [ "$MODE_HELP" = "true" ]; then
logprint "Help option selected. Printing options and exiting."
mode_help
fi
if [ "$MODE_STAGE" = "true" ]; then
logprint "Staging option selected."
mode_stage
assert_zero $?
fi
if [ "$MODE_BUILD" = "true" ]; then
logprint "Build of ${APPNAME} selected."
mode_build
assert_zero $?
fi
if [ "$MODE_INSTALL" = "true" ]; then
logprint "Install of ${APPNAME} selected."
mode_install
assert_zero $?
fi
logprint "Execution of ${APPNAME} completed."

View File

@@ -0,0 +1,205 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="which"
# the version of this application
VERSION="2.21"
# ----------------------------------------------------------------------
# Variables and functions sourced from Environment:
# ----------------------------------------------------------------------
# assert_zero()
# Checks if $1 is 0. If non-0 value, halts the execution of the script.
#
# LOGS_ROOT
# The parent directory where logs from this project will go.
#
# TEMP_STAGE_DIR
# The parent directory of where source archives are extracted to.
# register mode selections
ARGUMENT_LIST=(
"stage"
"build"
"install"
"all"
"help"
)
# modes to associate with switches
# assumes you want nothing done unless you ask for it.
MODE_STAGE=false
MODE_BUILD=false
MODE_INSTALL=false
MODE_ALL=false
MODE_HELP=false
# the file to log to
LOGFILE="${APPNAME}.log"
# ISO 8601 variation
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
# the path where logs are written to
# note: LOGS_ROOT is sourced from environment
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
# the path where the source will be located when complete
# note: TEMP_STAGE_DIR is sourced from environment
T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}"
# read defined arguments
opts=$(getopt \
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
--name "$APPNAME" \
--options "" \
-- "$@"
)
# process supplied arguments into flags that enable execution modes
eval set --$opts
while [[ $# -gt 0 ]]; do
case "$1" in
--stage)
MODE_STAGE=true
shift 1
;;
--build)
MODE_BUILD=true
shift 1
;;
--install)
MODE_INSTALL=true
shift 1
;;
--all)
MODE_ALL=true
shift 1
;;
--help)
MODE_HELP=true
shift 1
;;
*)
break
;;
esac
done
# print to stdout, print to log
logprint() {
mkdir -p "${LOG_DIR}"
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
| tee -a "${LOG_DIR}/${LOGFILE}"
}
# Tell the user we're alive...
logprint "Initializing the ${APPNAME} utility..."
# when the stage mode is enabled, this will execute
mode_stage() {
logprint "Starting stage of ${APPNAME}..."
logprint "Removing any pre-existing staging for ${APPNAME}."
rm -Rf "${T_SOURCE_DIR}"*
logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}"
tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}"
assert_zero $?
# conditionally rename if it needs it
stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}"
logprint "Staging operation complete."
}
# when the build_pass1 mode is enabled, this will execute
mode_build() {
# patch, configure and build
logprint "Starting build of ${APPNAME}..."
logprint "Entering build dir."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Configuring ${APPNAME}..."
./configure --prefix=/usr
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Build operation complete."
}
mode_install() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make install
assert_zero $?
logprint "Install operation complete."
}
mode_help() {
echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]"
exit 1
}
if [ "$MODE_ALL" = "true" ]; then
MODE_STAGE=true
MODE_BUILD=true
MODE_INSTALL=true
fi
# if no options were selected, then show help and exit
if \
[ "$MODE_HELP" != "true" ] && \
[ "$MODE_STAGE" != "true" ] && \
[ "$MODE_BUILD" != "true" ] && \
[ "$MODE_INSTALL" != "true" ]
then
logprint "No option selected during execution."
mode_help
fi
# if help was supplied at all, show help and exit
if [ "$MODE_HELP" = "true" ]; then
logprint "Help option selected. Printing options and exiting."
mode_help
fi
if [ "$MODE_STAGE" = "true" ]; then
logprint "Staging option selected."
mode_stage
assert_zero $?
fi
if [ "$MODE_BUILD" = "true" ]; then
logprint "Build of ${APPNAME} selected."
mode_build
assert_zero $?
fi
if [ "$MODE_INSTALL" = "true" ]; then
logprint "Install of ${APPNAME} selected."
mode_install
assert_zero $?
fi
logprint "Execution of ${APPNAME} completed."

View File

@@ -0,0 +1,75 @@
set -a
source ./project_config.sh
TERM=xterm-256color
COLORTERM=truecolor
LC_ALL=C
function echofail() {
echo
echo "FAILED: $1"
echo
exit 1
}
# keeps talking about T_SYSROOT as $LFS
# wants $LFS path to be a mount
# needs to be set for any user including root
#2.6
# sourced from project_config
T_SYSROOT=${dir_sysroot}
LFS=${T_SYSROOT}
rex_dir="/rex_embedded"
# 4.3 we skip user and group creation, it's expected to be done before
# you start if you want a different user than you're running as
# == after that, configure the rex unit for dir creation to use that user
if [ "$(id -u)" -ne 0 ]; then
echo "Not running as root."
fi
# 4.4
# The set +h command turns off bash's hash function, which affects caching of paths for executables
set +h
# ensures newly created files and directories are only writable by their owner, but are readable and executable by anyone
umask 022
# sets a comptabile machine name description for use when building crosstools that isn't going to be what the host system is using
# $LFS_TGT is what LFS uses for this
T_TRIPLET=x86_64-dhl-linux-gnu
# prevents some configure scripts from looking in the wrong place for config.site
CONFIG_SITE=${T_SYSROOT}/usr/share/config.site
# 4.5
MAKEFLAGS="-j$(nproc)"
# where the cross-compiler gets installed ($LFS/tools)
CROSSTOOLS_DIR=${T_SYSROOT}/xtools
TEMP_STAGE_DIR=${T_SYSROOT}/source_stage
# from project_config
SOURCES_DIR=${dir_sources}
PATCHES_DIR=${dir_patches}
LOGS_ROOT=${dir_logs}/apps/stage2
CONFIGS_DIR=${dir_configs}
# fail the unit in the event of a non-zero value passed
# used primarily to check exit codes on previous commands
# also a great convenient place to add in a "press any key to continue"
assert_zero() {
if [[ "$1" -eq 0 ]]; then
return
else
exit $1
fi
}
ARCHLIB_DIR=${T_SYSROOT}/lib64
PATH=${CROSSTOOLS_DIR}/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin

View File

@@ -5,6 +5,16 @@
"name": "welcome master",
"dependencies": [ null ],
"comment": "greet the user"
},
{
"name": "which",
"dependencies": [ null ],
"comment": "greet the user"
},
{
"name": "squashfs-tools",
"dependencies": [ null ],
"comment": "greet the user"
}
]
}

View File

@@ -34,7 +34,7 @@
"user": "root",
"group": "root",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
"environment": "environments/livecd.env.bash"
}
]
}

View File

@@ -17,6 +17,42 @@
"group": "root",
"supply_environment": true,
"environment": "environments/stage4.env.bash"
},
{
"name": "which",
"target": "components/stage5/which.bash --all",
"is_shell_command": true,
"shell_definition": "bash",
"force_pty": true,
"set_working_directory": false,
"working_directory": "",
"rectify": false,
"rectifier": "",
"active": true,
"required": true,
"set_user_context": true,
"user": "root",
"group": "root",
"supply_environment": true,
"environment": "environments/stage4.env.bash"
},
{
"name": "squashfs-tools",
"target": "components/stage5/squashfs-tools.bash --all",
"is_shell_command": true,
"shell_definition": "bash",
"force_pty": true,
"set_working_directory": false,
"working_directory": "",
"rectify": false,
"rectifier": "",
"active": true,
"required": true,
"set_user_context": true,
"user": "root",
"group": "root",
"supply_environment": true,
"environment": "environments/stage4.env.bash"
}
]
}