start adding offline iso

This commit is contained in:
Tobias Powalowski 2022-03-18 12:32:00 +01:00
parent 242bf74024
commit 1fe6d9c2a3
7 changed files with 72 additions and 6 deletions

View file

@ -0,0 +1,8 @@
# vim:set ft=sh:
# Created by Tobias Powalowski <tpowa@archlinux.org>
# mkinitcpio config file, defaulted to stock config file
MKINITCPIO_CONFIG="/etc/archboot/x86_64-offline.conf"
# kernel version, defaulted to build for runtime kernel
ALL_kver="/boot/vmlinuz-linux"

View file

@ -0,0 +1,31 @@
# vim:set ft=sh:
# Created by Tobias Powalowski <tpowa@archlinux.org>
# For more information on how using mkinitcpio please refer to the main config file
# or check the wiki.
MODULES=()
BINARIES=()
FILES=()
# SETUP
#
# Please change the hooks only if you know what you are doing.
HOOKS=(udev keyboard archboot_base_common archboot_base_latest \
archboot_installer_common archboot_installer_latest archboot_kexec \
archboot_licenses)
# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
# is used. Use 'cat' to create an uncompressed image.
COMPRESSION="zstd"
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"
# COMPRESSION_OPTIONS
# Additional options for the compressor
COMPRESSION_OPTIONS=(-19)
MODULES_DECOMPRESS="no"

View file

@ -11,8 +11,8 @@ _INSTALLER_SOURCE="https://gitlab.archlinux.org/tpowa/archboot/-/raw/master"
kver() {
# get kernel version from installed kernel
[[ "${_RUNNING_ARCH}" == "x86_64" ]] && VMLINUZ="${_W_DIR}/boot/vmlinuz-linux"
[[ "${_RUNNING_ARCH}" == "aarch64" ]] && VMLINUZ="${_W_DIR}/boot/Image"
[[ "${_RUNNING_ARCH}" == "x86_64" ]] && VMLINUZ="/vmlinuz-linux"
[[ "${_RUNNING_ARCH}" == "aarch64" ]] && VMLINUZ="/Image"
if [[ -f "${VMLINUZ}" ]]; then
offset=$(hexdump -s 526 -n 2 -e '"%0d"' "${VMLINUZ}")
read -r _HWKVER _ < <(dd if="${VMLINUZ}" bs=1 count=127 skip=$(( offset + 0x200 )) 2>/dev/null)
@ -103,8 +103,13 @@ if [[ "${_L_COMPLETE}" == "1" || "${_L_INSTALL_COMPLETE}" == "1" ]]; then
echo " This will need some time ..."
# create container without package cache
[[ "${_L_COMPLETE}" == "1" ]] && ("archboot-${_RUNNING_ARCH}-create-container.sh" "${_W_DIR}" -cc -cp >/dev/tty7 2>&1 || exit 1)
# Switch offline mode
# create container with package cache
if [[ -e /var/cache/pacman/pkg/archboot.db ]]; then
[[ "${_L_INSTALL_COMPLETE}" == "1" ]] && ("archboot-${_RUNNING_ARCH}-create-container.sh" "${_W_DIR}" -cc --install-source=file:///var/cache/pacman/pkg >/dev/tty7 2>&1 || exit 1)
else
[[ "${_L_INSTALL_COMPLETE}" == "1" ]] && ("archboot-${_RUNNING_ARCH}-create-container.sh" "${_W_DIR}" -cc >/dev/tty7 2>&1 || exit 1)
fi
# generate initrd in container, remove archboot packages from cache, not needed in normal install, umount tmp before generating initrd
echo "Step 3/8: Moving kernel from ${_W_DIR} to / ..."
if [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then

View file

@ -118,7 +118,7 @@ _change_pacman_conf() {
# umount special filesystems
_umount_special() {
echo "Umount special filesystems in to ${1} ..."
echo "Umount special filesystems in ${1} ..."
umount -R "${1}/proc"
umount -R "${1}/sys"
umount -R "${1}/dev"

View file

@ -6,7 +6,7 @@ build ()
map add_binary getent head id cksum tail test tr uptime w who which whoami xargs \
swapon uniq cut seq snarf fdisk sfdisk cfdisk parted free less \
chgrp chown df dialog dmesg egrep fgrep stty sync tar bsdcpio hdparm \
mktemp chroot dirname expr bzip2 su cpio gzip top sdparm tput \
chroot dirname expr bzip2 su cpio gzip top sdparm tput \
ifconfig ln losetup mkfifo mknod readlink lzmadec lzop xz last wall mesg utmpdump \
xzdec switch_root pivot_root chcpu ctrlaltdel gdisk sgdisk cgdisk fixparts findmnt \
lsblk swaplabel cal chrt col colcrt colrm column fallocate flock getopt \

View file

@ -16,7 +16,7 @@ build ()
map add_binary init agetty basename mount umount clear env printf gawk tty bash partprobe cp dir du ls mv rm sed grep \
kill killall more ps pwd rmdir true cat mkdir echo false sleep kmod pidof touch chmod \
find wc wget uname bsdtar yes awk halt shutdown reboot poweroff insmod modprobe sh dd hexdump \
sort zstd nano date tee
sort zstd nano date tee mktemp
### add nano files
add_full_dir /usr/share/nano

View file

@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
{
source /etc/archboot/defaults
# only include cachedir on booted archboot or container
for i in "${_ISO_HOME_SOURCE}"/"${_DIR}"/*;do
[[ ! -L "${i}" ]] && add_file "$i" "/var/cache/pacman/pkg/$(basename $i)"
done
# fix symlinks
add_symlink "/var/cache/pacman/pkg/archboot.db" "/var/cache/pacman/pkg/archboot.db.tar.gz"
add_symlink "/var/cache/pacman/pkg/archboot.files" "/var/cache/pacman/pkg/archboot.files.tar.gz"
}
help ()
{
cat<<HELPEOF
This hook includes the archboot sources to
/var/cache/pacman/pkg
HELPEOF
}