[Git][venenux/venenux-teaiso][venenux-teaiso] 14 commits: Update Makefile

5 views
Skip to first unread message

Герхард PICCORO Lenz McKAY (@mckaygerhard)

unread,
Apr 15, 2025, 11:29:12 AMApr 15
to venenux...@googlegroups.com

Герхард PICCORO Lenz McKAY pushed to branch venenux-teaiso at venenux / venenux-teaiso

Commits:

16 changed files:

Changes:

  • .gitignore
    ... ... @@ -2,7 +2,9 @@
    2 2
     /work
    
    3 3
     /output
    
    4 4
     lib/libteaiso.so
    
    5
    +lib/libmakeiso.so
    
    5 6
     lib/a.out
    
    6 7
     __pycache__/
    
    7 8
     *.pyc
    
    8 9
     *.iso
    
    10
    +build
    \ No newline at end of file

  • Makefile
    1 1
     build:
    
    2 2
     	make -C lib build
    
    3
    -test:
    
    3
    +	touch build
    
    4
    +
    
    5
    +test: build
    
    4 6
     	make -C lib test
    
    7
    +
    
    5 8
     install: build
    
    6 9
     	mkdir -p $(DESTDIR)/usr/lib/makeiso || true
    
    7 10
     	mkdir -p $(DESTDIR)/usr/bin || true
    
    ... ... @@ -9,12 +12,14 @@ install: build
    9 12
     	cp -prfv src/* $(DESTDIR)/usr/lib/makeiso/
    
    10 13
     	cp -prfv profiles $(DESTDIR)/usr/lib/makeiso/
    
    11 14
     	chmod +x -R $(DESTDIR)/usr/lib/makeiso/
    
    12
    -	sed -i 's#teaiso=".*#teaiso="$(DESTDIR)/usr/lib/makeiso"#g'  makeiso
    
    13 15
     	install makeiso $(DESTDIR)/usr/bin/makeiso
    
    16
    +	sed -i 's#teaiso=".*#teaiso="$(DESTDIR)/usr/lib/makeiso"#g' $(DESTDIR)/usr/bin/makeiso
    
    14 17
     	install logrotate $(DESTDIR)/etc/logrotate.d/makeiso
    
    15 18
     
    
    16 19
     clean:
    
    17 20
     	make -C lib clean
    
    18
    -uninstall:
    
    19
    -	rm -rfv $(DESTDIR)/usr/bin/makeiso
    
    20
    -	rm -rfv $(DESTDIR)/usr/lib/makeiso/
    21
    +	rm -f build
    
    22
    +
    
    23
    +uninstall: clean
    
    24
    +	rm -rfv $(DESTDIR)/usr/bin/mkteaiso
    
    25
    +	rm -rfv $(DESTDIR)/usr/lib/teaiso/

  • doc/FAQ-and-notes.md
    ... ... @@ -90,6 +90,12 @@ we previously pointed, may not have networking untill you install
    90 90
     and setup property the network, so the grub boot loader necesary files 
    
    91 91
     must be present to property install the iso, at least for alpine flavours.
    
    92 92
     
    
    93
    +#### AMD64 machine can produce an AMR target?
    
    94
    +
    
    95
    +Arch is taken from hosts `uname -m` output. Teaiso is not cross platform iso builder (yet). 
    
    96
    +If you want to build for other architecture you can use chrooted with qemu-user-static tool!
    
    97
    +The profile configuration of arch is now deprecated due that!
    
    98
    +
    
    93 99
     ## See also:
    
    94 100
     
    
    95 101
     * [Teaiso-technology.md](Teaiso-technology.md)

  • doc/Teaiso-technology.md
    ... ... @@ -7,7 +7,10 @@ VenenuX Teaiso
    7 7
     
    
    8 8
     Our project is made with `c`, `bash` and `python`, the work of the Teaiso is using chroot by the moment.
    
    9 9
     
    
    10
    -The live system used the `squashfs-tools` to produce the rootfs of the live disk.
    
    10
    +The live system used the `squashfs-tools` or `erofs-tool` to produce the rootfs (airootfs) of the live disk.
    
    11
    +
    
    12
    +Is not cross platform, you only can produce native targets, if you are in a AMD64 host, only can produce AMD64 hosts!, 
    
    13
    +for cross-platform targets you can use qemu-user-static targets!
    
    11 14
     
    
    12 15
     The project uses the concept of "[profiles](#profiles-definitions)" as VenenuX flavour 
    
    13 16
     to build the ISO, can be either Alpine or Debian, but always unstable.
    

  • doc/creating-profile.rst
    ... ... @@ -41,7 +41,8 @@ This file is distribution configuration file. Example file here:
    41 41
     	application_id: Debian Linux Live/Rescue Media
    
    42 42
     	airootfs_directory: airootfs
    
    43 43
     	iso_merge: iso_merge
    
    44
    -	arch: x86_64
    
    44
    +	arch: native
    
    45
    +	compression: squashfs||comp -gzip
    
    45 46
     	grub_cfg: grub.cfg
    
    46 47
     	linux_args: quiet splash
    
    47 48
     	keyring_package: debian-archive-keyring
    
    ... ... @@ -58,6 +59,8 @@ This file is distribution configuration file. Example file here:
    58 59
     	 customize_airootfs_pre:
    
    59 60
     	 - customize-airootfs-pre.sh
    
    60 61
     
    
    62
    +* **arch** DEPRECATED, teaiso is not cross-platform, autoset to native arch of host!
    
    63
    +* **compression** can be squashfs or erofs, last need kernel 5.10+ for both target and host!
    
    61 64
     * **customize_airootfs_pre** execute in chroot before installing packages.
    
    62 65
     * **customize_airootfs** execute in chroot after installing packages.
    
    63 66
     * **customize_isowork_pre** execute in workdir before creating squashfs
    

  • src/common/isowork.py
    ... ... @@ -50,15 +50,15 @@ def create_iso(settings):
    50 50
             settings.workdir), vital=False)
    
    51 51
     
    
    52 52
         # Generate efi.img
    
    53
    -    run("dd if=/dev/zero of=\"{}/isowork/efi.img\" bs=4M count=1 oflag=sync".format(settings.workdir))
    
    54
    -    run("mkfs.vfat -n VENENUX_EFI {}/isowork/efi.img &>/dev/null".format(settings.workdir))
    
    53
    +    run("dd if=/dev/zero of=\"{}/isowork/efi.img\" bs=1M count=4 oflag=sync".format(settings.workdir))
    
    54
    +    run("mkfs.vfat -S 1024 -n VENENUX_EFI {}/isowork/efi.img &>/dev/null".format(settings.workdir))
    
    55 55
         os.sync() # Call sync for efi image.
    
    56 56
         run("mmd -i {}/isowork/efi.img ::/EFI".format(settings.workdir))
    
    57 57
         run("mmd -i {}/isowork/efi.img ::/EFI/boot".format(settings.workdir))
    
    58 58
         run("mcopy -i {0}/isowork/efi.img {0}/isowork/EFI/boot/* ::/EFI/boot".format(settings.workdir))
    
    59 59
     
    
    60 60
         # Generate writable
    
    61
    -    run("dd if=/dev/zero of=\"{}/writable.img\" bs=4M count=1 oflag=sync".format(settings.workdir))
    
    61
    +    run("dd if=/dev/zero of=\"{}/writable.img\" bs=1M count=4 oflag=sync".format(settings.workdir))
    
    62 62
         run("mkfs.ext4 -b 1024 -L writable \"{}/writable.img\"".format(settings.workdir))
    
    63 63
         
    
    64 64
         # Miscellaneous
    
    ... ... @@ -117,7 +117,7 @@ def create_squashfs(settings):
    117 117
                 os.unlink("{}/filesystem.erofs".format(settings.workdir))
    
    118 118
             uuid = subprocess.check_output(
    
    119 119
                 "uuidgen --sha1 --namespace 93a870ff-8565-4cf3-a67b-f47299271a96 --name $(date +%s)", shell=True).decode("UTF-8").strip()
    
    120
    -        run("mkfs.erofs -U {} {} -- {}/filesystem.erofs \"{}\"".format(uuid,
    
    120
    +        run("mkfs.erofs -b 1024 -U {} {} -- {}/filesystem.erofs \"{}\"".format(uuid,
    
    121 121
                 settings.compression[1], settings.workdir, settings.rootfs))
    
    122 122
         else:
    
    123 123
             err("Valid compression tool not found! Please, check your profile.")

  • src/common/profile.py
    1 1
     import yaml
    
    2
    -import os
    
    2
    +import os, platform
    
    3 3
     from datetime import date
    
    4 4
     from utils import err, warn, versiontuple
    
    5 5
     profile = None
    
    ... ... @@ -34,7 +34,7 @@ def parse_profile(profile_dir="/usr/lib/makeiso/profile/alpine", teaiso="/usr/li
    34 34
         contents["grub_cfg"] = os.path.realpath(
    
    35 35
             profile_dir + "/" + contents["grub_cfg"])
    
    36 36
         contents["iso_name"] = contents["name"] + "-" + \
    
    37
    -        date.today().strftime("%d-%m-%Y") + "-" + contents["arch"] + ".iso"
    
    37
    +        date.today().strftime("%d-%m-%Y") + "-" + platform.uname().machine + ".iso"
    
    38 38
     
    
    39 39
         profile = contents
    
    40 40
         validation = validate_profile(profile)
    
    ... ... @@ -47,7 +47,7 @@ def parse_profile(profile_dir="/usr/lib/makeiso/profile/alpine", teaiso="/usr/li
    47 47
     
    
    48 48
     def validate_profile(profile):
    
    49 49
         required_keys = ['name', 'publisher', 'label',
    
    50
    -                     'application_id', 'arch', 'grub_cfg', 'packages', 'distro']
    
    50
    +                     'application_id', 'grub_cfg', 'packages', 'distro']
    
    51 51
     
    
    52 52
         for key in required_keys:
    
    53 53
             if key not in profile:
    

  • src/distro/alpine.sh
    ... ... @@ -36,7 +36,8 @@ create_rootfs(){
    36 36
     
    
    37 37
     populate_rootfs(){
    
    38 38
         cat /etc/resolv.conf > "$rootfs"/etc/resolv.conf
    
    39
    -    run_in_chroot apk add bash ca-certificates eudev mkinitfs
    
    39
    +    run_in_chroot apk update
    
    40
    +    run_in_chroot apk add bash ca-certificates eudev mkinitfs --allow-untrusted
    
    40 41
         chroot "$rootfs" setup-udev || true
    
    41 42
         cp "${teaiso}"/misc/alpine-init.sh "$rootfs"/usr/share/mkinitfs/initramfs-init-live
    
    42 43
         echo 'features="ata base cdrom ext4 keymap kms lvm mmc nvme raid scsi squashfs usb virtio"' > "$rootfs"/etc/mkinitfs/mkinitfs-live.conf
    
    ... ... @@ -48,11 +49,16 @@ customize_airootfs(){
    48 49
                     echo "Kernel missing!"
    
    49 50
             exit 1
    
    50 51
         fi
    
    52
    +    # does not include firmware in live initrd
    
    53
    +    mv "$rootfs"/lib/firmware "$rootfs"/lib/firmware.bak || true
    
    51 54
         run_in_chroot mkinitfs -i /usr/share/mkinitfs/initramfs-init-live -c /etc/mkinitfs/mkinitfs-live.conf -o /boot/initramfs-live "$kernel"
    
    55
    +    mv "$rootfs"/lib/firmware.bak "$rootfs"/lib/firmware || true
    
    52 56
     }
    
    53 57
     
    
    54 58
     clear_rootfs(){
    
    55 59
         rm -rf $rootfs/var/cache/apk/* || true
    
    60
    +    rm -rf $rootfs/etc/machine-id || true
    
    61
    +    rm -rf $rootfs/boot/initramfs-* || true
    
    56 62
         find "$rootfs/var/log/" -type f | xargs rm -f  || true
    
    57 63
     }
    
    58 64
     
    
    ... ... @@ -82,9 +88,11 @@ generate_isowork(){
    82 88
     }
    
    83 89
     
    
    84 90
     install_packages(){
    
    85
    -    run_in_chroot apk add ${packages[@]}
    
    91
    +    run_in_chroot apk add --allow-untrusted ${packages[@]}
    
    92
    +    if [[ -d "$rootfs"/profile/packages ]] ; then
    
    93
    +        run_in_chroot apk add --allow-untrusted /profile/packages/*
    
    94
    +    fi
    
    86 95
     }
    
    87
    -
    
    88 96
     make_pkglist() {
    
    89 97
         run_in_chroot apk list >  ${workdir}/packages.list
    
    90 98
     }

  • src/distro/debian.sh
    ... ... @@ -7,10 +7,10 @@ get_arch(){
    7 7
     export DEBIAN_FRONTEND=noninteractive
    
    8 8
     export DEBCONF_NONINTERACTIVE_SEEN=true
    
    9 9
     
    
    10
    -# required
    
    10
    +# required TODO dont install if debian, alpine or archshit
    
    11 11
     tools_init(){
    
    12 12
         if ! which debootstrap &>/dev/null ; then
    
    13
    -        echo "Installing debootstrap script: using lasted"
    
    13
    +        echo "Installing debootstrap script: using GIT from debian"
    
    14 14
             wget -c "https://salsa.debian.org/installer-team/debootstrap/-/archive/master/debootstrap-master.zip" -O debootstrap.zip
    
    15 15
             unzip debootstrap.zip
    
    16 16
             cd debootstrap-master
    
    ... ... @@ -19,21 +19,33 @@ tools_init(){
    19 19
     }
    
    20 20
     
    
    21 21
     create_rootfs(){
    
    22
    -    if ! run debootstrap --arch=$(get_arch $arch) --no-check-gpg --no-merged-usr --exclude=usrmerge --extractor=ar ${variant:+--variant=$variant} "$codename" "$rootfs" "$repository" ; then
    
    22
    +    if [[ ! -e /usr/share/debootstrap/scripts/${codename} ]] ; then
    
    23
    +        ln -s sid /usr/share/debootstrap/scripts/${codename}
    
    24
    +    fi
    
    25
    +    if ! run debootstrap --arch=$(get_arch $arch) --no-check-gpg --extractor=ar ${variant:+--variant=$variant} "$codename" "$rootfs" "$repository" ; then
    
    23 26
             cat "$rootfs"/debootstrap/debootstrap.log
    
    24 27
             exit 1
    
    25 28
         fi
    
    26 29
         echo -e "#!/bin/sh\nexit 101" > "$rootfs"/usr/sbin/policy-rc.d
    
    27 30
         chmod +x "$rootfs"/usr/sbin/policy-rc.d
    
    31
    +    run_in_chroot apt install -f -yq
    
    28 32
         if [[ "" != "${keyring_package}" ]] ; then
    
    29
    -        run_in_chroot apt install ${keyring_package} -yq
    
    33
    +        run_in_chroot apt install ${keyring_package} -yq --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages
    
    30 34
         fi
    
    35
    +    ### debian non-usrmerge broken
    
    36
    +    #if [[ -f "$rootfs"/usr/bin/bash ]] ; then
    
    37
    +    #    install "${teaiso}"/misc/usrparse.sh "$rootfs"/tmp/usrparse.sh
    
    38
    +    #    run_in_chroot bash /tmp/usrparse.sh
    
    39
    +    #fi
    
    40
    +    #### Disable recommends by default
    
    41
    +    echo 'APT::Install-Recommends "0";' > "$rootfs"/etc/apt/apt.conf.d/01norecommend
    
    42
    +    echo 'APT::Install-Suggests "0";' >> "$rootfs"/etc/apt/apt.conf.d/01norecommend
    
    31 43
     }
    
    32 44
     
    
    33 45
     populate_rootfs(){
    
    34 46
         run_in_chroot apt update -yq
    
    35 47
         run_in_chroot apt full-upgrade -o Dpkg::Options::="--force-confnew" -yq
    
    36
    -    run_in_chroot apt install live-boot live-config user-setup -o Dpkg::Options::="--force-confnew" -yq
    
    48
    +    run_in_chroot apt install live-boot live-config user-setup -o Dpkg::Options::="--force-confnew" -yq --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages
    
    37 49
         mkdir -p "$rootfs"/etc/fonts/
    
    38 50
         touch "$rootfs"/etc/fonts/fonts.conf
    
    39 51
         mkdir -p "$rootfs"/boot/grub
    
    ... ... @@ -42,7 +54,11 @@ populate_rootfs(){
    42 54
     
    
    43 55
     install_packages(){
    
    44 56
         run_in_chroot apt update -yq
    
    45
    -    run_in_chroot apt install -yq -o Dpkg::Options::="--force-confnew" ${packages[@]}
    
    57
    +    run_in_chroot apt install -yq -o Dpkg::Options::="--force-confnew" ${packages[@]} 
    
    58
    +    if [[ -d "$rootfs"/profile/packages ]] ; then
    
    59
    +        run_in_chroot dpkg -i /profile/packages/*.deb
    
    60
    +        run_in_chroot apt install -f -yq -o Dpkg::Options::="--force-confnew" --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages
    
    61
    +    fi
    
    46 62
     }
    
    47 63
     
    
    48 64
     make_pkglist() {
    
    ... ... @@ -82,7 +98,7 @@ customize_airootfs(){
    82 98
     
    
    83 99
     clear_rootfs(){
    
    84 100
         run_in_chroot apt clean
    
    85
    -    run_in_chroot apt autoremove --purge
    
    86
    -    rm -rf $rootfs/var/lib/apt/lists || true
    
    101
    +    run_in_chroot apt autoremove --purge -y
    
    102
    +    rm -rf "$rootfs"/var/lib/apt/lists || true
    
    87 103
         find "$rootfs/var/log/" -type f | xargs rm -f  || true
    
    88 104
     }

  • src/misc/alpine-init.sh
    ... ... @@ -4,8 +4,11 @@ mount -t devtmpfs devtmpfs /dev
    4 4
     mount -t sysfs sysfs /sys
    
    5 5
     mount -t proc proc /proc
    
    6 6
     mount -t tmpfs tmpfs /run
    
    7
    -find /lib/modules/$(uname -r)/kernel -type f | grep -v debug | sed "s/.*\//modprobe /g;s/\..*//g" | sh 2>/dev/null
    
    7
    +
    
    8
    +depmod -a
    
    9
    +find /lib/modules/$(uname -r) -type f | grep -v debug | sed "s/.*\//modprobe /g;s/\..*//g" | sh 2>/dev/null
    
    8 10
     mdev -s
    
    11
    +
    
    9 12
     live_mount(){
    
    10 13
         mkdir -p /alpine/a # upper
    
    11 14
         mkdir -p /alpine/b # workdir
    
    ... ... @@ -70,4 +73,6 @@ mount --move /run /new_root/run
    70 73
     if [ "$init" == "" ] ; then
    
    71 74
         init=/sbin/init
    
    72 75
     fi
    
    76
    +export PATH=/bin:/usr/bin:/sbin:/usr/sbin
    
    77
    +echo -e "live\nlive\n" | chroot /new_root adduser user || true
    
    73 78
     exec switch_root /new_root $init "$@"

  • src/misc/import_profiledef.sh
    ... ... @@ -6,7 +6,7 @@ echo "publisher: ${iso_publisher}"
    6 6
     echo "label: ${iso_label}"
    
    7 7
     echo "application_id: ${iso_application}"
    
    8 8
     echo "arch: ${arch}"
    
    9
    -echo "pacman: ${pacman_conf}"
    
    9
    +echo "apk: ${apk_conf}"
    
    10 10
     echo "packages:"
    
    11 11
     echo " - packages.x86_64"
    
    12 12
     echo "grub_cfg: grub.cfg"
    

  • src/misc/replace-init-initramfs.sh
    1
    +#!/bin/bash
    
    2
    +extract(){
    
    3
    +    mkdir -p /tmp/initrd/$(basename $1)
    
    4
    +    cat "$1" | gzip -d -f - | cpio -i
    
    5
    +}
    
    6
    +
    
    7
    +compress(){
    
    8
    +    cd /tmp/initrd/$(basename $1)
    
    9
    +    find . | cpio -o -c -R root:root | gzip -9 > /boot/$(basename $1).new
    
    10
    +}
    
    11
    +
    
    12
    +add_modules(){
    
    13
    +    # See: https://gitlab.com/sulinos/devel/initrd/-/blob/master/src/addons/00-modules.sh#L12
    
    14
    +    cp -prf ${MODDIR}/kernel/{crypto,fs,lib,block} ${WORKDIR}/${MODDIR} || true
    
    15
    +	cp -prf ${MODDIR}/kernel/drivers/input/{keyboard,serio} ${WORKDIR}/${MODDIR} || true
    
    16
    +	cp -prf ${MODDIR}/kernel/drivers/{ata,md,mmc,firewire} ${WORKDIR}/${MODDIR} || true
    
    17
    +	cp -prf ${MODDIR}/kernel/drivers/{scsi,pcmcia,virtio} ${WORKDIR}/${MODDIR} || true
    
    18
    +	cp -prf ${MODDIR}/kernel/drivers/usb/ ${WORKDIR}/${MODDIR} || true
    
    19
    +	cp -prf ${MODDIR}/kernel/drivers/acpi/ ${WORKDIR}/${MODDIR} || true
    
    20
    +	cp -prf ${MODDIR}/kernel/drivers/{block,cdrom}/ ${WORKDIR}/${MODDIR} || true
    
    21
    +    find ${WORKDIR}/${MODDIR} -type f | grep "xz$" | xargs xz -d || true
    
    22
    +}
    
    23
    +
    
    24
    +rm -rf /tmp/initrd || true
    
    25
    +mkdir -p /tmp/initrd
    
    26
    +for file in /boot/initramfs-*.img ; do
    
    27
    +    mkdir -p /tmp/initrd/$(basename $file)
    
    28
    +    cd /tmp/initrd/$(basename $file)
    
    29
    +    echo "Extract: $file"
    
    30
    +    extract $file
    
    31
    +    rm -f init
    
    32
    +    cat "$1" > init
    
    33
    +    chmod +x init
    
    34
    +    echo "Add busybox binary"
    
    35
    +    install /lib/ld-musl-x86_64.so.1 ./lib/ld-musl-x86_64.so.1
    
    36
    +    install /usr/sbin/busybox ./bin/busybox
    
    37
    +    # Remove modules and install better one again.
    
    38
    +    echo "Insert kernel modules"
    
    39
    +    export MODDIR=/lib/modules/$(echo $file | sed "s/.*initramfs-//g;s/.img//g")
    
    40
    +    export WORKDIR=$(pwd)
    
    41
    +    rm -rf ${WORKDIR}/${MODDIR} ; mkdir -p ${WORKDIR}/${MODDIR}
    
    42
    +    add_modules
    
    43
    +    echo "Compress: $file"
    
    44
    +    compress $file
    
    45
    +    rm -f "$file"
    
    46
    +    mv "$file.new" "$file"
    
    47
    +done

  • src/misc/usrparse.sh
    1
    +#!/bin/bash
    
    2
    +# This script revoke usrmerge.
    
    3
    +set +e
    
    4
    +apt-get install busybox-static -yq || exit 1
    
    5
    +cp /bin/busybox /busybox
    
    6
    +[[ -d /var/lib/dpkg/info/ ]] || exit 1
    
    7
    +
    
    8
    +for dir in lib bin sbin lib32 lib64 libx32 ; do
    
    9
    +    /busybox rm -f /$dir && /busybox mkdir /$dir
    
    10
    +    /busybox  cat /var/lib/dpkg/info/*.list | /busybox grep "^/$dir" | while read line ; do
    
    11
    +        nd="$(/busybox dirname $line)"
    
    12
    +        [[ ! -d "$nd" ]] && /busybox mkdir -p "$nd"
    
    13
    +        [[ ! -d "/usr/$line" ]] && /busybox mv /usr/$line $line
    
    14
    +    done
    
    15
    +done
    
    16
    +/busybox rm -f  /busybox

  • src/mkteaiso.py
    1 1
     from utils import *
    
    2 2
     import sys
    
    3
    -import os
    
    3
    +import os, platform
    
    4 4
     import settings
    
    5 5
     import common
    
    6 6
     import distro
    
    ... ... @@ -19,7 +19,7 @@ for i in sys.argv[1:]:
    19 19
         elif Args.is_arg(i, "work"):
    
    20 20
             settings.workdir = os.path.realpath(Args().get_value(i))
    
    21 21
         elif Args.is_arg(i, "profile"):
    
    22
    -        settings.profile = Args().get_value(i)
    
    22
    +        settings.profile = os.path.realpath(Args().get_value(i))
    
    23 23
         elif Args.is_arg(i, "shared"):
    
    24 24
             settings.shared = os.path.realpath(Args().get_value(i))
    
    25 25
         elif Args.is_arg(i, "create"):
    
    ... ... @@ -121,7 +121,7 @@ distro.set("interactive", interactive)
    121 121
     gpg_key and distro.set("gpg", gpg_key)
    
    122 122
     
    
    123 123
     distro.set("name", common.get("name"))
    
    124
    -distro.set("arch", common.get("arch"))
    
    124
    +distro.set("arch", platform.uname().machine)
    
    125 125
     distro.set("grub_cfg", common.get("grub_cfg"))
    
    126 126
     
    
    127 127
     distro.set("distro", common.get("distro"))
    
    ... ... @@ -139,12 +139,12 @@ distro.set("cmdline", common.get("linux_args"))
    139 139
     distro.set("workdir", settings.workdir)
    
    140 140
     distro.set("variant", common.get("variant","")) # for debian
    
    141 141
     distro.set("keyring_package", common.get("keyring_package","")) # for debian
    
    142
    -distro.set("codename", common.get("codename", "testing"))  # for debian
    
    142
    +distro.set("codename", str(common.get("codename", "testing")))  # for debian
    
    143 143
     distro.set("repository", common.get("repository"))  # for debian
    
    144 144
     
    
    145 145
     def error_event():
    
    146 146
         if settings.shared and os.path.isdir(settings.shared):
    
    147
    -        run("umount -lf '{}/teaiso'".format(settings.rootfs))
    
    147
    +        run("umount -lf '{}/teaiso'  || true".format(settings.rootfs))
    
    148 148
             os.rmdir("{}/teaiso".format(settings.rootfs))
    
    149 149
         Mount.unmount(settings.rootfs)
    
    150 150
         
    
    ... ... @@ -165,7 +165,12 @@ else:
    165 165
     Mount.mount(settings.rootfs)
    
    166 166
     if settings.shared and os.path.isdir(settings.shared):
    
    167 167
         os.mkdir("{}/teaiso".format(settings.rootfs))
    
    168
    -    run("mount --bind '{}' '{}/teaiso'".format(settings.shared,settings.rootfs))
    
    168
    +    run("mount --bind '{}' '{}/teaiso' || true".format(settings.shared,settings.rootfs))
    
    169
    +
    
    170
    +# Bind mount profile
    
    171
    +if not os.path.isdir("{}/profile".format(settings.rootfs)):
    
    172
    +    os.mkdir("{}/profile".format(settings.rootfs))
    
    173
    +run("mount -o ro --bind '{}' '{}/profile'  || true".format(settings.profile,settings.rootfs))
    
    169 174
     
    
    170 175
     if Stage().get() < 2:
    
    171 176
         distro.populate_rootfs()
    
    ... ... @@ -235,8 +240,13 @@ if Stage().get() < 7:
    235 240
         Stage().set(7)
    
    236 241
     
    
    237 242
     if settings.shared and os.path.isdir(settings.shared):
    
    238
    -    run("umount -lf '{}/teaiso'".format(settings.rootfs))
    
    243
    +    run("umount -lf '{}/teaiso' || true".format(settings.rootfs))
    
    239 244
         os.rmdir("{}/teaiso".format(settings.rootfs))
    
    245
    +
    
    246
    +# remove profile binding
    
    247
    +run("umount -lf '{}/profile'  || true".format(settings.rootfs))
    
    248
    +os.rmdir("{}/profile".format(settings.rootfs))
    
    249
    +
    
    240 250
     Mount.unmount(settings.rootfs)
    
    241 251
     
    
    242 252
     # Set permissions if exists
    
    ... ... @@ -253,19 +263,23 @@ if Stage().get() < 8:
    253 263
     
    
    254 264
         Stage().set(8)
    
    255 265
     
    
    256
    -# Generate ISO
    
    266
    +# Generate IsoWork
    
    257 267
     if Stage().get() < 9:
    
    258
    -    distro.clear_rootfs()
    
    259 268
         os.chdir(settings.workdir)
    
    260 269
         for i in common.get("customize_isowork_pre", []):
    
    261 270
             run(i)
    
    262 271
         os.chdir(settings.teaiso)
    
    263
    -    common.create_squashfs(settings)
    
    264 272
         common.create_isowork(settings)
    
    273
    +    distro.clear_rootfs()
    
    274
    +    common.create_squashfs(settings)
    
    265 275
         os.chdir(settings.workdir)
    
    266 276
         for i in common.get("customize_isowork", []):
    
    267 277
             run(i)
    
    268 278
         os.chdir(settings.teaiso)
    
    269 279
         distro.generate_isowork()
    
    270 280
         Stage().set(9)
    
    271
    -common.create_iso(settings)
    281
    +
    
    282
    +# Generate Iso
    
    283
    +if Stage().get() < 10:
    
    284
    +    common.create_iso(settings)
    
    285
    +    Stage().set(10)

  • src/settings.py
    1
    -import os
    
    1
    +import os, platform
    
    2 2
     import time
    
    3 3
     from utils import out, err, inf, colorize, run
    
    4 4
     from colors import *
    
    ... ... @@ -28,7 +28,7 @@ def show(contents, packages):
    28 28
             contents["application_id"]))
    
    29 29
         inf("\t{}: {}".format(
    
    30 30
             colorize("ISO publisher", bold), contents["publisher"]))
    
    31
    -    inf("\t{}: {}".format(colorize("Architecture", bold), contents["arch"]))
    
    31
    +    inf("\t{}: {}".format(colorize("Architecture", bold), platform.uname().machine))
    
    32 32
         inf("\t{}: {}".format(colorize("Packages", bold), packages))
    
    33 33
         inf("\t{}: {}".format(colorize("Build date", bold), time.time()))
    
    34 34
         inf("\t{}: {}".format(colorize("ISO name", bold), contents["iso_name"]))
    

  • src/utils.py
    ... ... @@ -22,7 +22,7 @@ libteaiso.inf.argtypes = [c_char_p]
    22 22
     libteaiso.is_root.restype = c_int
    
    23 23
     simulation = False
    
    24 24
     
    
    25
    -VERSION = "2.0.1"
    
    25
    +VERSION = "2.2.0"
    
    26 26
     
    
    27 27
     error_event = None
    
    28 28
     
    
    ... ... @@ -129,7 +129,7 @@ class Args:
    129 129
             disable_color()
    
    130 130
             out("""Usage: makeiso -p=PROFILE [OPTION]...
    
    131 131
     ISO generation tool for GNU/Linux, v{}.
    
    132
    -Example: makeiso -p=/usr/lib/makeiso/profiles/archlinux --interactive
    
    132
    +Example: makeiso -p=/usr/lib/makeiso/profiles/alpine --interactive
    
    133 133
     Profile directory should contain profile.yaml.
    
    134 134
     
    
    135 135
     Base Arguments:
    
    ... ... @@ -177,12 +177,12 @@ class Stage:
    177 177
     class Mount:
    
    178 178
         def mount(rootfs):
    
    179 179
             for dir in ["dev", "dev/pts", "sys", "proc", "run"]:
    
    180
    -            run("mount --bind /{1} /{0}/{1} 2>/dev/null".format(rootfs, dir))
    
    180
    +            run("mount --bind /{1} /{0}/{1}  || true".format(rootfs, dir), vital=False)
    
    181 181
             run("ln -s {0}/proc/self/fd {0}/dev/fd 2>/dev/null || true".format(rootfs), vital=False)
    
    182
    -        run("ln -s {0}/proc/self/mounts {0}/etc/mtab || true")
    
    182
    +        run("ln -s {0}/proc/self/mounts {0}/etc/mtab || true".format(rootfs), vital=False)
    
    183 183
             
    
    184 184
     
    
    185 185
         def unmount(rootfs):
    
    186
    -        for dir in ["dev/pts", "dev", "sys", "proc", "run"]:
    
    186
    +        for dir in ["dev/pts", "dev", "sys", "proc", "run", "profile"]:
    
    187 187
                 while 0 == run("umount -lf -R /{}/{}".format(rootfs, dir), vital=False):
    
    188 188
                     True


View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help

Reply all
Reply to author
Forward
0 new messages