Initial upload

This commit is contained in:
Sunderland93 2022-04-10 19:49:29 +04:00
parent 0bd3bf7708
commit 72663d46d0
38 changed files with 498 additions and 0 deletions

31
README.md Normal file
View file

@ -0,0 +1,31 @@
## ISO Builder
This ISO builder is fork of the good work from the elementary crew. Many thanks to the devs there https://github.com/elementary/os
## Building Locally
As Ubuntu Sway is built with the Debian version of live-build, not the Ubuntu patched version, it's easiest to build an Ubuntu Sway .iso in a Debian VM or container. This prevents messing up your host system too.
The following example uses Docker and assumes you have Docker correctly installed and set up:
Clone this project & cd into it:
git clone https://github.com/UbuntuDDE/iso-builder && cd iso-builder
Configure the channel in the etc/terraform.conf (unstable, stable).
Run the build:
docker run --privileged -i -v /proc:/proc \
-v ${PWD}:/working_dir \
-w /working_dir \
debian:latest \
/bin/bash -s etc/terraform.conf < build.sh
When done, your image will be in the builds folder.
## Further Information
More information about the concepts behind `live-build` and the technical decisions made to arrive at this set of tools to build an .iso can be found [on the wiki](https://github.com/elementary/os/wiki/Building-iso-Images).

89
build.sh Executable file
View file

@ -0,0 +1,89 @@
#!/bin/bash
set -e
# check for root permissions
if [[ "$(id -u)" != 0 ]]; then
echo "E: Requires root permissions" > /dev/stderr
exit 1
fi
# get config
if [ -n "$1" ]; then
CONFIG_FILE="$1"
else
CONFIG_FILE="etc/terraform.conf"
fi
BASE_DIR="$PWD"
source "$BASE_DIR"/"$CONFIG_FILE"
echo -e "
#----------------------#
# INSTALL DEPENDENCIES #
#----------------------#
"
apt-get update
apt-get install -y live-build patch binutils zstd
dpkg -i ./debs/*.deb
patch /usr/lib/live/build/binary_grub-efi < live-build-fix-shim-remove.patch
ln -sfn /usr/share/debootstrap/scripts/gutsy /usr/share/debootstrap/scripts/impish
build () {
BUILD_ARCH="$1"
mkdir -p "$BASE_DIR/tmp/$BUILD_ARCH"
cd "$BASE_DIR/tmp/$BUILD_ARCH" || exit
# remove old configs and copy over new
rm -rf config auto
cp -r "$BASE_DIR"/etc/* .
# Make sure conffile specified as arg has correct name
cp -f "$BASE_DIR"/"$CONFIG_FILE" terraform.conf
# Symlink chosen package lists to where live-build will find them
ln -s "package-lists.$PACKAGE_LISTS_SUFFIX" "config/package-lists"
echo -e "
#------------------#
# LIVE-BUILD CLEAN #
#------------------#
"
lb clean
echo -e "
#-------------------#
# LIVE-BUILD CONFIG #
#-------------------#
"
lb config
echo -e "
#------------------#
# LIVE-BUILD BUILD #
#------------------#
"
lb build
echo -e "
#---------------------------#
# MOVE OUTPUT TO BUILDS DIR #
#---------------------------#
"
YYYYMMDD="$(date +%Y%m%d%H%M)"
OUTPUT_DIR="$BASE_DIR/builds/$BUILD_ARCH"
mkdir -p "$OUTPUT_DIR"
FNAME="ubuntudde-$VERSION-$BUILD_ARCH-$YYYYMMDD-$OUTPUT_SUFFIX"
mv "$BASE_DIR/tmp/$BUILD_ARCH/live-image-$BUILD_ARCH.hybrid.iso" "$OUTPUT_DIR/${FNAME}.iso"
md5sum "$OUTPUT_DIR/${FNAME}.iso" > "$OUTPUT_DIR/${FNAME}.md5.txt"
sha256sum "$OUTPUT_DIR/${FNAME}.iso" > "$OUTPUT_DIR/${FNAME}.sha256.txt"
}
# remove old builds before creating new ones
rm -rf "$BASE_DIR"/builds
build "$ARCH"

Binary file not shown.

Binary file not shown.

62
etc/auto/config Executable file
View file

@ -0,0 +1,62 @@
#!/bin/sh
set -e
. ./terraform.conf
# HWE starts with y, Y or 1?
if [ "$HWE" = "yes" ]; then
KERNEL_FLAVORS="generic-hwe-${BASEVERSION}"
else
KERNEL_FLAVORS="generic"
fi
lb config noauto \
--architectures "$ARCH" \
--mode ubuntu \
--initramfs none \
--distribution "$BASECODENAME" \
--parent-distribution "$BASECODENAME" \
--archive-areas "main restricted universe multiverse" \
--parent-archive-areas "main restricted universe multiverse" \
--linux-packages linux-image \
--linux-flavours "$KERNEL_FLAVORS" \
--bootappend-live "boot=casper quiet splash" \
--mirror-bootstrap "$MIRROR_URL" \
--parent-mirror-bootstrap "$MIRROR_URL" \
--mirror-chroot-security "http://security.ubuntu.com/ubuntu/" \
--parent-mirror-chroot-security "http://security.ubuntu.com/ubuntu/" \
--mirror-binary-security "http://security.ubuntu.com/ubuntu/" \
--parent-mirror-binary-security "http://security.ubuntu.com/ubuntu/" \
--apt-source-archives false \
--mirror-binary "mirror://mirrors.ubuntu.com/mirrors.txt" \
--parent-mirror-binary "mirror://mirrors.ubuntu.com/mirrors.txt" \
--keyring-packages ubuntu-keyring \
--apt-options "--yes --option Acquire::Retries=5 --option Acquire::http::Timeout=100" \
--cache-packages false \
--cache-stages false \
--uefi-secure-boot enable \
--binary-images iso-hybrid \
--iso-application "$NAME" \
--iso-volume "$NAME" \
--firmware-binary false \
--firmware-chroot false \
--zsync false \
--security true \
--updates true \
--debootstrap-options "--exclude=pinephone-tweaks,mobile-tweaks-common,librem5-tweaks,pinetab-tweaks" \
"${@}"
# replace channel and suite
sed -i "s/@CHANNEL/$CHANNEL/" config/archives/*.list*
sed -i "s/@BASECODENAME/$BASECODENAME/" config/archives/*.list*
DATE=$(date +%Y%m%d)
sed -i "s/@CHANNEL/$CHANNEL/" config/includes.binary/.disk/info
sed -i "s/@CODENAME/$CODENAME/" config/includes.binary/.disk/info
sed -i "s/@ARCH/$ARCH/" config/includes.binary/.disk/info
sed -i "s/@DISTRO_NAME/$NAME/" config/includes.binary/.disk/info
sed -i "s/@VERSION/$VERSION/" config/includes.binary/.disk/info
sed -i "s/@DATE/$DATE/" config/includes.binary/.disk/info
sed -i "s/@XORG_HWE/$XORG_HWE/" config/package-lists/desktop.list.chroot_install

View file

@ -0,0 +1 @@

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,63 @@
load function_video {
if [ x$feature_all_video_module = xy ]
then
insmod all_video
else
insmod video_bochs
insmod video_cirrus
if test "${grub_platform}" == "efi"
then
insmod efi_gop
insmod efi_uga
elif test "${grub_platform}" == "pc"
then
insmod vbe
insmod vga
fi
fi
}
if loadfont /boot/grub/dejavu-bold-14.pf2
then
set gfxmode=auto
export gfxmode
load_video
insmod gfxterm
terminal_output gfxterm
insmod gfxmenu
insmod png
export theme
fi
set color_normal=white/black
set color_highlight=black/light-gray
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
set timeout=10
set timeout_style=menu
menuentry "Start Ubuntu Sway" --class ubuntudde {
set gfxpayload=keep
linux /casper/vmlinuz boot=casper quiet splash ---
initrd /casper/initrd.lz
}
menuentry "Start Ubuntu Sway (Safe Graphics)" --class recovery {
set gfxpayload=keep
linux /casper/vmlinuz boot=casper nomodeset quiet splash ---
initrd /casper/initrd.lz
}
menuentry "Check for Disk Defects" --class memtest {
set gfxpayload=keep
linux /casper/vmlinuz boot=casper integrity-check quiet splash ---
initrd /casper/initrd.lz
}
menuentry "EFI Firmware Settings" --class efi {
fwsetup
}
menuentry "Power Off" --class shutdown {
halt
}

View file

@ -0,0 +1 @@
/usr/lib/syslinux/modules/bios/hdt.c32

View file

@ -0,0 +1 @@
/usr/lib/ISOLINUX/isolinux.bin

View file

@ -0,0 +1,3 @@
default vesamenu.c32
include stdmenu.cfg
include live.cfg

View file

@ -0,0 +1 @@
/usr/lib/syslinux/modules/bios/ldlinux.c32

View file

@ -0,0 +1 @@
/usr/lib/syslinux/modules/bios/libcom32.c32

View file

@ -0,0 +1 @@
/usr/lib/syslinux/modules/bios/libgpl.c32

View file

@ -0,0 +1 @@
/usr/lib/syslinux/modules/bios/libmenu.c32

View file

@ -0,0 +1 @@
/usr/lib/syslinux/modules/bios/libutil.c32

View file

@ -0,0 +1,38 @@
prompt 0
MENU HIDDEN
MENU AUTOBOOT Booting ubuntu sway live disk in # seconds
timeout 50
label live-@FLAVOUR@
menu label ^Start Ubuntu Sway
menu default
linux /casper/vmlinuz
initrd /casper/initrd.lz
append @APPEND_LIVE@
MENU SEPARATOR
label live-failsafe
menu label Start Ubuntu Sway (Safe Graphics)
set gfxpayload=keep
linux /casper/vmlinuz
initrd /casper/initrd.lz
append @APPEND_LIVE@ nomodeset
MENU SEPARATOR
label check
menu label ^Check disk for Defects
linux /casper/vmlinuz
append boot=casper integrity-check initrd=/casper/initrd.lz quiet --
MENU SEPARATOR
label hd
menu label ^Boot from first hard disk
localboot 0x80
MENU SEPARATOR
LABEL power
MENU LABEL ^Power Off
COM32 poweroff.c32

View file

@ -0,0 +1 @@
/usr/lib/syslinux/modules/bios/menu.c32

Binary file not shown.

View file

@ -0,0 +1,42 @@
menu hshift 13
menu width 49
menu margin 8
# Override the default radial gradient background with black
menu background #ff000000
# Title bar
menu color title 0 #ffffffff #00000000 *
# Border Area
menu color border * #00000000 #00000000 none
# Unselected menu item
menu color unsel 0 #999999 #00000000 *
# Unselected hotkey
menu color hotkey 0 #999999 #00000000 none
# Selection bar
menu color sel 0 #ffffff #00000000 none
# Selected hotkey
menu color hotsel 0 #ffffffff #00000000 none
# Press [Tab] message
menu color tabmsg 0 #f6f6f6 #00000000 none
# Timeout message
menu color timeout_msg 0 #f6f6f6 #00000000 none
# Timeout counter
menu color timeout * #ffffffff #00000000 none
# Command line
menu color cmdline 0 #ffffffff #00000000 none
# Command line marker
menu color cmdmark 0 #00000000 #00000000 none
# Helptest
menu color help 0 #ffffffff #00000000 none

View file

@ -0,0 +1 @@
/usr/lib/syslinux/modules/bios/vesamenu.c32

View file

@ -0,0 +1,28 @@
#!/bin/sh
# Description: Checkout seed branches and remove blacklisted packages
echo "P: Begin executing remove-blacklisted-packages chroot hook..."
#dist="$(lsb_release -c -s -u 2>&1)"||dist="$(lsb_release -c -s)"
#apt-get install --no-install-recommends -f -q -y bzr
#bzr export --quiet ubuntu-seeds "lp:~ubuntu-core-dev/ubuntu-seeds/ubuntu.$dist"
#bzr export --quiet platform "lp:~ubuntu-core-dev/ubuntu-seeds/platform.$dist"
#for package in $(cat 'platform/blacklist' 'ubuntu-seeds/blacklist' | grep -v '#'); do
# apt-get autoremove --purge -f -q -y "$package"
#done
#apt-get autoremove --purge -f -q -y bzr
apt-get autoremove --purge -f -q -y metacity unity-greeter unity-settings-daemon unity-control-center
apt-get autoremove --purge -f -q -y gdm3 gnome-shell ubuntu-desktop mutter mpv xiterm+thai gnome-control-center language-selector-gnome yelp gnome-font-viewer gnome-software gnome-software-common gnome-software-plugin-snap
rm -R ../ubuntu-seeds ../platform
rm -rf /etc/xdg/autostart/nm-applet.desktop
cp /etc/rc.local /etc/rc.local.orig
sed -i "s/exit 0/rm -fR \/var\/lib\/apt\/lists\/*/" /etc/rc.local
sed -i 's/OnlyShowIn=GNOME;Unity;/#OnlyShowIn=GNOME;Unity;/g' /usr/share/applications/gnome-session-properties.desktop
echo "mv /etc/rc.local.orig /etc/rc.local" >> /etc/rc.local
echo "exit 0" >> /etc/rc.local

View file

@ -0,0 +1,7 @@
#!/bin/sh
# Description: Cleanup apt cache files that add ~100MB to the .iso and aren't needed
rm -f /var/lib/apt/lists/*_Packages
rm -f /var/lib/apt/lists/*_Sources
rm -f /var/lib/apt/lists/*_Translation-*

View file

@ -0,0 +1,15 @@
#!/bin/sh
apt-ftparchive \
-o "APT::FTPArchive::Release::Acquire-By-Hash=yes" \
-o "APT::FTPArchive::Release::Architectures=amd64" \
-o "APT::FTPArchive::Release::Codename=$CODENAME" \
-o "APT::FTPArchive::Release::Components=main restricted non-free" \
-o "APT::FTPArchive::Release::Description=Ubuntu $CODENAME $VERSION" \
-o "APT::FTPArchive::Release::Label=Ubuntu" \
-o "APT::FTPArchive::Release::Origin=Ubuntu" \
-o "APT::FTPArchive::Release::Suite=$CODENAME" \
-o "APT::FTPArchive::Release::Version=$VERSION" release "dists/$CODENAME" \
> dists/$CODENAME/Release
# gpg --batch --yes --digest-algo sha512 --sign --detach-sign -u 0x65A0FEF800E0F671DA40A0AD0CCCDBF527989837 --armor -o "dists/$CODENAME/Release.gpg" "dists/$CODENAME/Release"

View file

@ -0,0 +1,5 @@
#!/bin/sh
echo "P: Begin executing set-disk-info binary hook in ${PWD}"
cp -rf ../config/includes.binary/.disk .

View file

@ -0,0 +1,12 @@
#!/bin/sh
mkdir casper || true
mv boot/filesystem.squashfs casper/filesystem.squashfs
mv boot/filesystem.size casper/filesystem.size
mv boot/initrd.img-* casper/initrd.lz
mv boot/vmlinuz-* casper/vmlinuz
mv boot/filesystem.packages-remove casper/filesystem.manifest-remove
mv boot/filesystem.packages casper/filesystem.manifest
mkdir live || true
cp casper/vmlinuz live/vmlinuz

View file

@ -0,0 +1 @@
full_cd/single

View file

@ -0,0 +1 @@
@DISTRO_NAME @VERSION "@CODENAME" - @CHANNEL @ARCH (@DATE)

View file

@ -0,0 +1 @@
APT::Authentication::TrustCDROM "true";

View file

@ -0,0 +1,4 @@
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager

View file

@ -0,0 +1,2 @@
[keyfile]
unmanaged-devices=none

View file

@ -0,0 +1 @@
ubuntu-sway-desktop

View file

@ -0,0 +1,24 @@
casper
expect
gparted
calamares-settings-ubuntu-sway
cifs-utils
lupin-casper
language-pack-en
language-pack-gnome-en
xfsprogs
jfsutils
reiserfsprogs
ntfs-3g
lvm2
dmraid
wamerican
fwupdate
mokutil
qml-module-qtquick-dialogs
qml-module-qtquick-controls
qml-module-qtquick-layouts
qml-module-qtquick-window2
zram-config
shim-signed
shim

View file

@ -0,0 +1,16 @@
b43-fwcutter
bcmwl-kernel-source
dkms
intel-microcode
iucode-tool
lupin-support
setserial
user-setup
efibootmgr
grub-efi
secureboot-db
grub-efi-amd64
grub-efi-amd64-bin
grub-efi-amd64-signed
shim
shim-signed

33
etc/terraform.conf Normal file
View file

@ -0,0 +1,33 @@
# target architecture - i386, amd64 or all
ARCH="amd64"
# base codename
BASECODENAME="jammy"
# base version
BASEVERSION="22.04"
# distribution codename
CODENAME="jammy"
# distribution version
VERSION="22.04"
# distribution channel
#CHANNEL="unstable"
CHANNEL="stable"
# distribution name
NAME="Ubuntu Sway"
# mirror to fetch packages from
MIRROR_URL="http://archive.ubuntu.com/ubuntu/"
# use HWE kernel and packages?
HWE="no"
# suffix for generated .iso files
OUTPUT_SUFFIX="desktop"
# folder suffix for the package lists to use
PACKAGE_LISTS_SUFFIX="calamares"

View file

@ -0,0 +1,10 @@
283,284c283,288
< # Removing depends
< Remove_packages
---
> # Removing depends, some bootloader packages are marked as Protected/Important
> # in Ubuntu, so temporarily add an apt flag to allow them to be removed
> PRE_APT_OPTIONS="${APT_OPTIONS}"
> APT_OPTIONS="${APT_OPTIONS} --allow-remove-essential"
> Remove_packages
> APT_OPTIONS="${PRE_APT_OPTIONS}"