This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
doc:howto:tce [2019/09/18 19:34] stefanbaur [Starting the Build] added some double quotes (stylefix) |
doc:howto:tce [2022/12/27 14:47] gratuxri |
||
---|---|---|---|
Line 54: | Line 54: | ||
export LB_APT_HTTP_PROXY=http:// | export LB_APT_HTTP_PROXY=http:// | ||
fi | fi | ||
+ | |||
+ | # set these to true to save source files | ||
+ | #export LB_SOURCE=" | ||
+ | #export LBX2GO_GETSRC=" | ||
# Select ONE of the following git reposities | # Select ONE of the following git reposities | ||
# this one loosely corresponds to " | # this one loosely corresponds to " | ||
- | # export LBX2GO_CONFIG=' | + | #export LBX2GO_CONFIG=' |
+ | #export LBX2GO_CONFIG=' | ||
+ | export LBX2GO_CONFIG=' | ||
+ | #export LBX2GO_CONFIG=' | ||
# this one loosely corresponds to " | # this one loosely corresponds to " | ||
- | export LBX2GO_CONFIG=' | + | # NOTE: Add " |
- | # NOTE: Add " | + | # |
- | # NOTE: As of 2019-08-27, buster builds are only available via the github repo and for the feature/ | + | # add "-bullseye" |
# Select ONE of the following LBX2GO_ARCH lines and comment out the others | # Select ONE of the following LBX2GO_ARCH lines and comment out the others | ||
Line 68: | Line 75: | ||
export LBX2GO_ARCH=' | export LBX2GO_ARCH=' | ||
# 32-Bit, larger memory footprint, but faster performance on i686 and newer | # 32-Bit, larger memory footprint, but faster performance on i686 and newer | ||
- | # export LBX2GO_ARCH=' | + | #export LBX2GO_ARCH=' |
# 32-Bit, smallest memory footprint - not available on buster | # 32-Bit, smallest memory footprint - not available on buster | ||
# export LBX2GO_ARCH=' | # export LBX2GO_ARCH=' | ||
- | # EXPERIMENTAL: | + | # For ARM (Raspberry Pi): |
- | # export LBX2GO_ARCH=' | + | #export LBX2GO_ARCH=' |
- | # Note that ARM builds are currently | + | #export LBX2GO_ARCH_MODEL=' |
# If you want to use the stock ISO image as created by this script, add your boot parameters here | # If you want to use the stock ISO image as created by this script, add your boot parameters here | ||
# export LBX2GO_BOOTAPPEND_LIVE=" | # export LBX2GO_BOOTAPPEND_LIVE=" | ||
+ | export LBX2GO_BOOTAPPEND_LIVE=" | ||
+ | |||
+ | if echo -e " | ||
+ | LBX2GO_BOOTAPPEND_LIVE+=" | ||
+ | export LBX2GO_BOOTAPPEND_LIVE | ||
+ | elif echo -e " | ||
+ | LBX2GO_BOOTAPPEND_LIVE+=' | ||
+ | export LBX2GO_BOOTAPPEND_LIVE | ||
+ | fi | ||
# detect if the selected git repo is meant to build a buster, stretch or jessie image | # detect if the selected git repo is meant to build a buster, stretch or jessie image | ||
if [ -z " | if [ -z " | ||
export LBX2GO_DEBVERSION=" | export LBX2GO_DEBVERSION=" | ||
+ | export LBX2GO_BOOTAPPEND_LIVE+=" | ||
+ | elif [ -z " | ||
+ | export LBX2GO_DEBVERSION=" | ||
+ | export LBX2GO_BOOTAPPEND_LIVE+=" | ||
+ | elif [ -z " | ||
+ | export LBX2GO_DEBVERSION=" | ||
export LBX2GO_BOOTAPPEND_LIVE+=" | export LBX2GO_BOOTAPPEND_LIVE+=" | ||
elif [ -z " | elif [ -z " | ||
export LBX2GO_DEBVERSION=" | export LBX2GO_DEBVERSION=" | ||
+ | export LBX2GO_BOOTAPPEND_LIVE+=" | ||
+ | elif [ -z " | ||
+ | export LBX2GO_DEBVERSION=" | ||
export LBX2GO_BOOTAPPEND_LIVE+=" | export LBX2GO_BOOTAPPEND_LIVE+=" | ||
else | else | ||
Line 107: | Line 132: | ||
# These options are meant to reduce the image size. | # These options are meant to reduce the image size. | ||
# Feel free to adapt them after consulting "man lb_config" | # Feel free to adapt them after consulting "man lb_config" | ||
- | export LBX2GO_SPACE=' | + | # FIXME export LBX2GO_SPACE=' |
+ | export LBX2GO_SPACE=' | ||
| | ||
| | ||
Line 138: | Line 164: | ||
# This is part of our experimental ARM support | # This is part of our experimental ARM support | ||
- | if echo "$LB_X2GO_ARCH" | + | if echo $LBX2GO_ARCH | grep -q ' |
export LBX2GO_DEFAULTS+=" | export LBX2GO_DEFAULTS+=" | ||
- | --bootstrap-qemu-static / | + | --bootstrap-qemu-static / |
+ | --apt-options \" | ||
+ | fi | ||
+ | |||
+ | # This is part of our experimental ARM support | ||
+ | # This makes sure the resulting disk image is at least 1GB in size, even though our build currently requires way less. | ||
+ | # It's unlikely that anyone will need to boot from a smaller partition; but if we let live-build pick the minimum size automatically, | ||
+ | # we will not have enough space left to copy the firmware blobs into the right location. | ||
+ | if echo $LBX2GO_ARCH | grep -q ' | ||
+ | export LBX2GO_DEFAULTS+=" | ||
+ | --hdd-size 1024" | ||
fi | fi | ||
Line 150: | Line 186: | ||
# This is to optimize squashfs size, based on a suggestion by intrigeri from the TAILS team | # This is to optimize squashfs size, based on a suggestion by intrigeri from the TAILS team | ||
# note that this will permanently change / | # note that this will permanently change / | ||
- | sed -i -e 's#MKSQUASHFS_OPTIONS=" | + | # |
+ | # | ||
+ | if dpkg --print-architecture | grep -q 'arm'; then | ||
+ | # on arm, these parameters must not be used; if they' | ||
+ | if grep -q -- '-Xbcj x86 -b 1024K -Xdict-size 1024K' / | ||
+ | apt install --reinstall live-build | ||
+ | fi | ||
+ | # feel free to experiment with these options, but be prepared for subtle breakage | ||
+ | #export MKSQUASHFS_OPTIONS=' | ||
+ | #export MKSQUASHFS_OPTIONS=' | ||
+ | #export MKSQUASHFS_OPTIONS=' | ||
+ | export MKSQUASHFS_OPTIONS='' | ||
+ | else | ||
+ | export MKSQUASHFS_OPTIONS=' | ||
+ | fi | ||
# This removes documentation, | # This removes documentation, | ||
Line 163: | Line 213: | ||
# When using iPXE, you can use http instead of TFTP. | # When using iPXE, you can use http instead of TFTP. | ||
# This is especially helpful if you want to netboot via http and cannot use the server' | # This is especially helpful if you want to netboot via http and cannot use the server' | ||
- | export LBX2GO_NOSQUASHFS=" | + | #export LBX2GO_NOSQUASHFS=" |
# Select ONE of the following LBX2GO_IMAGETYPE lines and comment out the others | # Select ONE of the following LBX2GO_IMAGETYPE lines and comment out the others | ||
# to create an iso image: | # to create an iso image: | ||
- | # export LBX2GO_IMAGETYPE=' | + | #export LBX2GO_IMAGETYPE=' |
# to create an iso image that can also be dd'ed to USB media: | # to create an iso image that can also be dd'ed to USB media: | ||
- | # export LBX2GO_IMAGETYPE=' | + | export LBX2GO_IMAGETYPE=' |
# to create a netboot-image: | # to create a netboot-image: | ||
- | export LBX2GO_IMAGETYPE=' | + | #export LBX2GO_IMAGETYPE=' |
# /!\ the options below are NOT RECOMMENDED unless you use live-build from Debian Buster /!\ | # /!\ the options below are NOT RECOMMENDED unless you use live-build from Debian Buster /!\ | ||
- | # to create an image that can be written to a hard disk (for older live-build versions, this | + | # (Debian 10) or newer to create an image that can be written to a hard disk (for older |
- | # always results in a "build failed" | + | # live-build versions, this always results in a "build failed" |
- | # live-build from Buster and things will work): | + | # might have worked - use live-build from Buster |
- | # export LBX2GO_IMAGETYPE=' | + | #export LBX2GO_IMAGETYPE=' |
+ | ## This might be required for hdd builds, especially for (u)efi | ||
+ | #export LBX2GO_BOOTLOADER=" | ||
# to create a tar file only (seems to be broken in older live-build versions - Buster works): | # to create a tar file only (seems to be broken in older live-build versions - Buster works): | ||
- | # export LBX2GO_IMAGETYPE=' | + | #export LBX2GO_IMAGETYPE=' |
+ | |||
+ | # This is part of our experimental ARM support | ||
+ | if echo " | ||
+ | # enforce hdd image for arm at the moment (might need to support netboot later on too) | ||
+ | if ! [ " | ||
+ | echo " | ||
+ | export LBX2GO_IMAGETYPE=" | ||
+ | fi | ||
+ | fi | ||
if [ " | if [ " | ||
- | LBX2GO_DEFAULTS+=" | + | |
fi | fi | ||
</ | </ | ||
==== Live-Patching the Build ==== | ==== Live-Patching the Build ==== | ||
- | This patch is required if you need USB mount capability on the ThinClient while [[http:// | + | To add patches that aren't part of any package yet, you can use the directory |
- | Save this script in the directory where you want to save your builds | + | |
- | + | ||
- | < | + | |
- | #!/bin/bash | + | |
- | mkdir -p ./patch/ | + | |
- | wget -O ./ | + | |
- | chmod 755 ./ | + | |
- | </ | + | |
+ | You will need to create a directory structure like ./ | ||
==== Starting the Build ==== | ==== Starting the Build ==== | ||
In the directory where you want to save your builds, save the following file as x2go-tce-build, | In the directory where you want to save your builds, save the following file as x2go-tce-build, | ||
Line 206: | Line 260: | ||
# Create Timestamp | # Create Timestamp | ||
LBX2GO_TIMESTAMP=$(date +" | LBX2GO_TIMESTAMP=$(date +" | ||
+ | |||
+ | # Log all output to a logfile in /tmp | ||
+ | exec > >(tee "/ | ||
# Set Directory name | # Set Directory name | ||
- | LBX2GO_TCEDIR=" | + | LBX2GO_TCEDIR=" |
if [ -z " | if [ -z " | ||
+ | ( echo " | ||
[ -z " | [ -z " | ||
[ -z " | [ -z " | ||
Line 222: | Line 280: | ||
echo -e "One or more of the following variables is unset:" | echo -e "One or more of the following variables is unset:" | ||
echo -e " | echo -e " | ||
+ | echo " | ||
echo -e " | echo -e " | ||
echo -e " | echo -e " | ||
Line 238: | Line 297: | ||
cd $LBX2GO_TCEDIR | cd $LBX2GO_TCEDIR | ||
+ | X2GO_LBCONFIG_STRING=$(cat << | ||
lb config $LBX2GO_ARCH $LBX2GO_SPACE $LBX2GO_DEFAULTS \ | lb config $LBX2GO_ARCH $LBX2GO_SPACE $LBX2GO_DEFAULTS \ | ||
| | ||
| | ||
| | ||
+ | X2GOLBCONFIGSTRING | ||
+ | ) | ||
+ | # Our previous way of doing this had issues with newlines and multiple blanks. So we're now doing a bit | ||
+ | # of sanitizing, then we eval the variable. | ||
+ | X2GO_LBCONFIG_STRING=$(echo " | ||
+ | eval " | ||
+ | |||
# This will copy any patches we have prepared | # This will copy any patches we have prepared | ||
if [ -d " | if [ -d " | ||
cp -a ../patch/* config/ | cp -a ../patch/* config/ | ||
fi | fi | ||
+ | |||
# This will copy any patches we have prepared for minidesktop | # This will copy any patches we have prepared for minidesktop | ||
if [ -d " | if [ -d " | ||
cp -a ../ | cp -a ../ | ||
fi | fi | ||
+ | |||
+ | # This checks if a bootloader directory is present (e.g. because of a custom splash.svg) | ||
+ | # and adds all other files that might be missing (live-build won't add them automatically | ||
+ | # if the directory already exists) | ||
+ | if [ -d config/ | ||
+ | rsync -aPH --ignore-existing --exclude=" | ||
+ | fi | ||
+ | # When enabled, this silences the audible beep at syslinux/ | ||
+ | # Note that this is an accessibility feature for blind users, so use with care. | ||
+ | sed -e " | ||
+ | |||
# This enables an i386-only package in the sources.list file when an i386 build is requested | # This enables an i386-only package in the sources.list file when an i386 build is requested | ||
- | if echo "$LBX2GO_ARCH" | + | if echo $LBX2GO_ARCH | grep -q -i " |
sed -i -e 's/# for i386 only #//' config/ | sed -i -e 's/# for i386 only #//' config/ | ||
fi | fi | ||
+ | |||
+ | # This is part of our experimental ARM support | ||
+ | # It adds required arm64-only packages when an arm64 build is requested | ||
+ | if echo $LBX2GO_ARCH | grep -q " | ||
+ | |||
+ | # bullseye and newer do not need this | ||
+ | if [ " | ||
+ | # firmware for wifi | ||
+ | echo " | ||
+ | fi | ||
+ | |||
+ | if [ " | ||
+ | # modules required for Raspberry Pi 3 LAN | ||
+ | echo " | ||
+ | echo " | ||
+ | echo " | ||
+ | echo " | ||
+ | echo " | ||
+ | echo " | ||
+ | echo " | ||
+ | |||
+ | # firmware for basic raspi functions - required for boot on Pi3 | ||
+ | echo " | ||
+ | # standard linux kernel - for Pi3 | ||
+ | echo " | ||
+ | |||
+ | elif [ " | ||
+ | # bullseye and newer do not need this | ||
+ | if [ " | ||
+ | # firmware for basic raspi functions - required for boot on Pi4 | ||
+ | echo " | ||
+ | echo " | ||
+ | |||
+ | # newer linux kernel - required for pi4/pi400 | ||
+ | echo " | ||
+ | fi | ||
+ | else | ||
+ | echo " | ||
+ | fi | ||
+ | fi | ||
+ | |||
+ | |||
# This is for minidesktop builds only | # This is for minidesktop builds only | ||
if [ -f config/ | if [ -f config/ | ||
Line 288: | Line 409: | ||
fi | fi | ||
- | # This is a crude hack to detect crossbuilds | + | # This is part of our experimental ARM support |
- | # It makes some necessary changes, and also tries to speed up squashfs creation. | + | # It is used when building |
- | | + | # It makes some necessary changes, and also tries to speed up squashfs creation |
- | | + | |
+ | | ||
- | # This command removes all references to fuseext and x2gothinclient from the | + | # This command removes all references to fuseext, freerdp-nightly, |
- | # package list files. | + | # package list files. |
- | echo " | + | echo " |
- | sed -e ' | + | sed -e ' |
# This command removes the X2Go repository from the directory where additional | # This command removes the X2Go repository from the directory where additional | ||
Line 304: | Line 426: | ||
rm ./ | rm ./ | ||
- | # The following is a hack to reduce squashfs creation time. We're replacing mksquashfs | + | # The following is a hack to reduce squashfs creation time in a crossbuild environment. |
- | # in the changeroot | + | # We're replacing mksquashfs in the changeroot with a wrapper script that drops the |
- | # mksquashfs call into a file. | + | # original |
- | | + | if (uname -r | grep -q ' |
- | # appear in the changeroot; as the changeroot will only be created later on, once | + | # We need to do this as a background task, waiting for the mksquashfs executable to |
- | # lb build is called. | + | # appear in the changeroot; as the changeroot will only be created later on, once |
- | + | # lb build is called. | |
- | # The other background task waits until the command file has been created, then | + | |
- | # it applies some necessary patches to it, and starts the mksquashfs command natively | + | # The other background task waits until the command file has been created, then |
- | # on the build host, rather than in the changeroot environment. | + | # it applies some necessary patches to it, and starts the mksquashfs command natively |
- | # This is because in the changeroot, we'd be running the ARM mksquashfs in a qemu | + | # on the build host, rather than in the changeroot environment. |
- | # software emulation of the ARM architecture, | + | # This is because in the changeroot, we'd be running the ARM mksquashfs in a qemu |
- | # native, raw CPU power and cores available to us. | + | # software emulation of the ARM architecture, |
+ | # native, raw CPU power and cores available to us. | ||
- | | + | # To make sure we don't have any lingering processes in the background, we're passing |
- | # our own PID along to the background tasks, and tell them to terminate if our PID | + | # our own PID along to the background tasks, and tell them to terminate if our PID |
- | # disappears while they' | + | # disappears while they' |
- | | + | MASTERPID=$$ |
- | | + | # Replace mksquashfs in chroot with script |
- | # (script will undo this upon completion) | + | # (script will undo this upon completion) |
- | ( | + | ( |
- | # wait until the chroot has been populated or until our parent process dies | + | |
- | while ! [ -x ./ | + | |
- | ps $MASTERPID >/ | + | ps $MASTERPID >/ |
- | sleep 1 | + | sleep 1 |
- | done | + | |
- | # make sure we don't overwrite the real executable if it has already been | + | |
- | # moved out of the way | + | |
- | if ! [ -x ./ | + | |
- | cp ./ | + | cp ./ |
- | fi | + | |
- | | + | echo '# |
- | | + | # log the name we've been called with and all parameters into this file |
- | | + | echo 'echo "$0 $@" >/ |
- | | + | # once the native mksquashfs is complete, we will remove this file |
- | | + | echo 'while [ -f / |
- | | + | echo ' |
- | | + | echo ' |
- | | + | # so let's wait until it has been removed before deleting ourselves ... |
- | | + | echo 'rm / |
- | | + | # ... and moving the real executable back into its place |
- | | + | echo 'mv / |
- | | + | chmod 755 ./ |
- | ) & | + | ) & |
- | | + | # start the native mksquashfs after patching the parameters |
- | ( | + | ( |
- | # wait until the trigger file has been created or until our parent process dies | + | |
- | while ! [ -f ./ | + | |
- | ps $MASTERPID >/ | + | ps $MASTERPID >/ |
- | sleep 1 | + | sleep 1 |
- | done | + | |
- | # using any of the available filters (x86, arm, armthumb) for the | + | |
- | # -Xbcj command results in an unusable squashfs on arm, so we drop the | + | |
- | # parameter completely if it's there. | + | |
- | # also, all absolute paths (detected by beginning with " /") need to be | + | |
- | # prefixed with " | + | |
- | # to look for the corresponding paths/ | + | |
- | sed -e 's/ -Xbcj x86/ /g' -e 's# /# ./ | + | |
- | ./ | + | ./ |
- | # now let's make this executable | + | #needs switch from e.g. / |
- | chmod 755 ./ | + | sed -e " |
+ | ./ | ||
+ | | ||
+ | | ||
- | | + | |
- | # in the squashfs - no idea why we don't need them while inside the chroot ... | + | |
- | echo ' | + | |
- | echo ' | + | |
- | echo ' | + | |
- | # now let's execute the script and, if it terminates without an error, | + | |
- | # we'll move the newly created squashfs into the chroot where the chrooted | + | |
- | # mksquashfs command would have created it; if that worked as well, we' | + | |
- | # remove the script file so our dummy mksquashfs inside the chroot knows | + | |
- | # it's time to terminate itself. | + | |
- | ./ | + | |
- | mv ./ | + | |
- | rm ./ | + | |
- | ) & | + | ) & |
+ | fi | ||
fi | fi | ||
Line 393: | Line 520: | ||
if [ " | if [ " | ||
- | ln ./ | + | ln ./ |
- | | + | |
fi | fi | ||
+ | |||
+ | # This is part of our experimental ARM support | ||
+ | if [ " | ||
+ | # after the build, let's determine the name of our image file ... | ||
+ | IMAGEFILE=" | ||
+ | |||
+ | # ... and change the partition type to reflect the file system actually in use for partition 1 | ||
+ | # (" | ||
+ | sfdisk --part-type $IMAGEFILE 1 b | ||
+ | |||
+ | # next, we need to patch two things inside the image, so we need to set up a loop device for it. | ||
+ | FREELOOP=$(losetup -f) # note that this could become a TOCTOU issue if more than 1 process tries to use loop devices | ||
+ | |||
+ | # as the image is a full disk image containing a partition, we need to jump to the position where the first partition starts | ||
+ | losetup -o 1048576 $FREELOOP $IMAGEFILE | ||
+ | |||
+ | # now let's mount it | ||
+ | mkdir -p ./tempmount | ||
+ | mount $FREELOOP ./tempmount | ||
+ | |||
+ | # purge this dir, so we have enough space; we'll return to fill it later | ||
+ | rm ./ | ||
+ | |||
+ | # first, we copy the contents of the boot/ | ||
+ | # see if inplace helps against out of space errors | ||
+ | rsync -aP --inplace ./ | ||
+ | |||
+ | mkdir -p ./ | ||
+ | rsync -aP ./ | ||
+ | |||
+ | # next, we replace the " | ||
+ | sed -e ' | ||
+ | |||
+ | # here comes the cleanup part | ||
+ | sync | ||
+ | umount $FREELOOP | ||
+ | losetup -d $FREELOOP | ||
+ | rmdir ./tempmount | ||
+ | fi | ||
+ | |||
if [ " | if [ " | ||
if [ " | if [ " | ||
Line 407: | Line 574: | ||
if [ " | if [ " | ||
genisoimage -o ./ | genisoimage -o ./ | ||
- | if [ -e ./ | + | if [ -e ./ |
- | ln ./ | + | ln ./ |
- | | + | |
- | elif [ -e ./ | + | elif [ -e ./ |
- | ln ./ | + | ln ./ |
- | | + | |
fi | fi | ||
mv ./ | mv ./ | ||
Line 443: | Line 610: | ||
cd .. | cd .. | ||
fi | fi | ||
+ | |||
</ | </ | ||
Line 516: | Line 684: | ||
=== Required unless using the X2Go Session Broker: Adding the x2go-tce.sessions session configuration file to your HTTP or FTP Server === | === Required unless using the X2Go Session Broker: Adding the x2go-tce.sessions session configuration file to your HTTP or FTP Server === | ||
Again, this is assuming you already have an existing, working HTTP or FTP server setup. | Again, this is assuming you already have an existing, working HTTP or FTP server setup. | ||
- | * run X2GoClient on any computer you like, and configure a session the same way it should appear on the ThinClient <note tip>when using a Windows client, run x2goclient.exe --portable, or it will store the session information in the registry, rather than in a " | + | * run X2GoClient on any computer you like, and configure a session the same way it should appear on the ThinClient |
+ | <note tip>when using a Windows client, run x2goclient.exe --portable, or it will store the session information in the registry, rather than in a " | ||
* locate the " | * locate the " | ||
* copy it to x2go-tce.sessions | * copy it to x2go-tce.sessions | ||
Line 793: | Line 963: | ||
* '' | * '' | ||
* '' | * '' | ||
- | * '' | + | * '' |
* '' | * '' | ||
* '' | * '' | ||
Line 1155: | Line 1325: | ||
FIXME Scripts triggered by if-up should check if a new download is really necessary. | FIXME Scripts triggered by if-up should check if a new download is really necessary. | ||
- | FIXME Feature request: In TCE (not MMD), use < | + | ===== List of closed ToDos/ |
+ | * Feature request: In TCE (not MMD), use < | ||
while ! (grep " | while ! (grep " | ||
echo s >/ | echo s >/ | ||
Line 1162: | Line 1333: | ||
echo o >/ | echo o >/ | ||
</ | </ | ||
- | ===== List of closed ToDos/ | + | |
* '' | * '' | ||
* It would be nice to have a boot parameter '' | * It would be nice to have a boot parameter '' |