[gnome-build-meta/valentindavid/eos-installer: 7/13] Add installer ISO image




commit 93e0cec925b52e4247fd7fa2a420b0f5cc4bb81c
Author: Valentin David <valentin david codethink co uk>
Date:   Wed Feb 26 13:11:50 2020 +0100

    Add installer ISO image

 elements/iso/deps.bst                           |  24 +++++
 elements/iso/eos-installer-extra.bst            |   8 ++
 elements/iso/filesystem.bst                     |   9 ++
 elements/iso/image.bst                          | 121 ++++++++++++++++++++++++
 elements/iso/initial-scripts.bst                |   7 ++
 elements/iso/initramfs.bst                      |  73 ++++++++++++++
 elements/iso/initramfs/deps.bst                 |  19 ++++
 elements/iso/initramfs/initial-scripts.bst      |   7 ++
 elements/iso/installer-dirs.bst                 |  12 +++
 elements/iso/iso-build-deps.bst                 |  10 ++
 files/eos-installer-extra/eos-installer.service |   2 +-
 files/eos-installer-extra/session.conf          |  19 ++++
 12 files changed, 310 insertions(+), 1 deletion(-)
---
diff --git a/elements/iso/deps.bst b/elements/iso/deps.bst
new file mode 100644
index 00000000..0257150d
--- /dev/null
+++ b/elements/iso/deps.bst
@@ -0,0 +1,24 @@
+kind: stack
+
+runtime-depends:
+- iso/eos-installer-extra.bst
+- iso/installer-dirs.bst
+- iso/public-key.bst
+
+- core-deps/plymouth.bst
+- vm/plymouth-gnome-theme.bst
+
+- freedesktop-sdk.bst:components/wayland.bst
+- freedesktop-sdk.bst:components/systemd.bst
+- freedesktop-sdk.bst:components/linux.bst
+- freedesktop-sdk.bst:components/linux-firmware.bst
+- freedesktop-sdk.bst:components/shadow.bst
+- freedesktop-sdk.bst:vm/mesa-default.bst
+- freedesktop-sdk.bst:vm/config/journald.bst
+
+- vm/spice-vdagent.bst
+
+- sdk/os-release.bst
+
+#FIXME: components/linux-pam.bst should runtime depend on:
+- freedesktop-sdk.bst:components/pwquality.bst
diff --git a/elements/iso/eos-installer-extra.bst b/elements/iso/eos-installer-extra.bst
index 16661e13..5e4d4182 100644
--- a/elements/iso/eos-installer-extra.bst
+++ b/elements/iso/eos-installer-extra.bst
@@ -35,6 +35,9 @@ sources:
   path: files/eos-installer-extra/eos-installer-session.pam
 - kind: local
   path: files/eos-installer-extra/eos-installer.json
+- kind: local
+  path: files/eos-installer-extra/session.conf
+
 config:
   install-commands:
   - |
@@ -48,6 +51,11 @@ config:
     dir="$(pkg-config --variable=systemduserunitdir systemd)"
     install -Dm644 -t "%{install-root}${dir}" \
       eos-installer.service
+  - |
+    dir="$(pkg-config --variable=systemduserunitdir systemd)"
+    install -Dm644 -t "%{install-root}${dir}/gnome-session@eos-installer.target.d" \
+      session.conf
+
   - |
     dir="$(pkg-config --variable=systemdsystempresetdir systemd)"
     install -Dm644 -t "%{install-root}${dir}" \
diff --git a/elements/iso/filesystem.bst b/elements/iso/filesystem.bst
new file mode 100644
index 00000000..b1b2ba93
--- /dev/null
+++ b/elements/iso/filesystem.bst
@@ -0,0 +1,9 @@
+kind: compose
+
+build-depends:
+- iso/deps.bst
+
+config:
+  exclude:
+  - devel
+  - debug
diff --git a/elements/iso/image.bst b/elements/iso/image.bst
new file mode 100644
index 00000000..6ceaa8ce
--- /dev/null
+++ b/elements/iso/image.bst
@@ -0,0 +1,121 @@
+kind: script
+
+build-depends:
+- iso/iso-build-deps.bst
+- iso/signed-image-only.bst
+- iso/filesystem.bst
+- iso/initial-scripts.bst
+- iso/initramfs.bst
+
+variables:
+  uuidnamespace: aea54278-2587-4075-ae67-8688ace4ce3d
+
+config:
+  layout:
+  - element: ''
+    destination: /tmp
+  - element: ''
+    destination: /images
+  - element: ''
+    destination: /stage-1
+  - element: ''
+    destination: /stage-2
+  - element: ''
+    destination: /sysroot-stage-2
+  - element: iso/iso-build-deps.bst
+    destination: /
+  - element: iso/filesystem.bst
+    destination: /sysroot
+  - element: iso/initramfs.bst
+    destination: /sysroot/efi
+  - element: iso/initial-scripts.bst
+    destination: /
+  - element: iso/signed-image-only.bst
+    destination: /sysroot/eosimages
+
+  commands:
+  - |
+    prepare-image.sh \
+       --sysroot /sysroot \
+       --seed "%{uuidnamespace}" \
+       --rootsource LABEL=GNOME-OS-INSTALLER \
+       --rootfstype iso9660 \
+       --noboot >/dev/null
+
+  - |
+    get_size() {
+      size=$(($(du --apparent-size -B 512 -s "${1}" | cut -f1)/2))
+      echo $((${size}+(${size}/10)))k
+    }
+    cat >/stage-1/genimage.cfg <<EOF
+    image eosimages.img {
+        mountpoint = "/eosimages"
+        vfat {
+            extraargs = "-F32 -n eosimages"
+        }
+        size = $(get_size /sysroot/eosimages)
+    }
+    image eosimages.gpt.img {
+        hdimage {
+            gpt = true
+        }
+        partition eosimages {
+            image = "eosimages.img"
+            partition-type-uuid = "F"
+        }
+    }
+    image efi.img {
+        mountpoint = "/efi"
+        vfat {
+            extraargs = "-F32 -n EFI"
+        }
+        size = $(get_size /sysroot/efi)
+    }
+    image squashfs.img {
+        mountpoint = "/"
+        squashfs  {
+        }
+    }
+    config {
+        rootpath = "/sysroot"
+        inputpath = "/images"
+        outputpath = "/images"
+    }
+    EOF
+
+  - |
+    cat >/stage-2/genimage.cfg <<EOF
+    image installer.iso {
+        iso {
+            extraargs = "-e /efi.img -no-emul-boot -boot-load-size 4 -efi-boot-part --efi-boot-image"
+            volume-id = "GNOME-OS-INSTALLER"
+        }
+    }
+    config {
+        rootpath = "/sysroot-stage-2"
+        inputpath = "/images"
+        outputpath = "/images"
+        genisoimage = "xorrisofs"
+    }
+    EOF
+
+  - |
+    cd /stage-1
+    genimage
+
+  - |
+    mkdir -p "/sysroot-stage-2/LiveOS"
+    cp "/images/squashfs.img" \
+       "/sysroot-stage-2/LiveOS/"
+    cp "/images/efi.img" \
+       "/sysroot-stage-2/"
+    cp "/images/eosimages.gpt.img" \
+       "/sysroot-stage-2/"
+
+  - |
+    cd /stage-2
+    genimage
+
+  - install -Dm644 -t "%{install-root}" /images/installer.iso
+
+  - implantisomd5 "%{install-root}/installer.iso"
diff --git a/elements/iso/initial-scripts.bst b/elements/iso/initial-scripts.bst
new file mode 100644
index 00000000..6a0d022d
--- /dev/null
+++ b/elements/iso/initial-scripts.bst
@@ -0,0 +1,7 @@
+kind: collect_initial_scripts
+
+build-depends:
+- iso/deps.bst
+
+config:
+  path: /etc/fdsdk/initial_scripts
diff --git a/elements/iso/initramfs.bst b/elements/iso/initramfs.bst
new file mode 100644
index 00000000..72be2aad
--- /dev/null
+++ b/elements/iso/initramfs.bst
@@ -0,0 +1,73 @@
+kind: script
+
+build-depends:
+- iso/initramfs/deps.bst
+- iso/initramfs/initial-scripts.bst
+- freedesktop-sdk.bst:vm/prepare-image.bst
+
+variables:
+  uuidnamespace: aea54278-2587-4075-ae67-8688ace4ce3d
+  install-root: /boot
+
+  efi-arch: "%{arch}"
+  (?):
+  - arch == "x86_64":
+      efi-arch: x64
+  - arch == "i686":
+      efi-arch: ia32
+
+config:
+  layout:
+  - element: ''
+    destination: '/tmp'
+  - element: ''
+    destination: '/var/tmp'
+  - element: ''
+    destination: '/boot'
+  - element: iso/initramfs/deps.bst
+    destination: '/'
+  - element: iso/initramfs/initial-scripts.bst
+    destination: '/'
+  - element: vm/prepare-image.bst
+    destination: '/'
+
+  commands:
+  - |
+    prepare-image.sh \
+       --seed "%{uuidnamespace}" \
+       --rootsource LABEL=GNOME-OS-INSTALLER \
+       --rootfstype iso9660 \
+       --noboot >/dev/null
+
+  - |
+    dracut -v --uefi \
+           --uefi-stub /usr/lib/systemd/boot/efi/linux%{efi-arch}.efi.stub \
+           --kernel-image "/boot/vmlinuz" \
+           --no-machineid \
+           --kver "$(ls -1 /usr/lib/modules | head -n1)" \
+           --kernel-cmdline "rw quiet splash root=live:LABEL=GNOME-OS-INSTALLER" \
+           --add dmsquash-live \
+           --add plymouth \
+           --install grep \
+           --install head \
+           --install tail \
+           --install less \
+           --install lsof
+
+
+  - dbus-uuidgen >/etc/machine-id
+  - SYSTEMD_RELAX_ESP_CHECKS=1 bootctl --path='/boot' --no-variables install
+  - rm /etc/machine-id
+
+  - |
+    cat <<EOF >/boot/loader/loader.conf
+    timeout 3
+    editor yes
+    console-mode keep
+    default *
+    EOF
+
+  - |
+    rm -f /boot/vmlinuz
+    rm -f /boot/System.map
+
diff --git a/elements/iso/initramfs/deps.bst b/elements/iso/initramfs/deps.bst
new file mode 100644
index 00000000..e5b64d56
--- /dev/null
+++ b/elements/iso/initramfs/deps.bst
@@ -0,0 +1,19 @@
+kind: stack
+
+runtime-depends:
+- core-deps/plymouth.bst
+- iso/isomd5sum.bst
+- sdk/os-release.bst
+- vm/plymouth-gnome-theme.bst
+- freedesktop-sdk.bst:components/dbus.bst
+- freedesktop-sdk.bst:components/dracut.bst
+- freedesktop-sdk.bst:components/gzip.bst
+- freedesktop-sdk.bst:components/linux-firmware.bst
+- freedesktop-sdk.bst:components/linux.bst
+- freedesktop-sdk.bst:components/lvm2.bst
+- freedesktop-sdk.bst:components/pkg-config.bst
+- freedesktop-sdk.bst:components/shadow.bst
+- freedesktop-sdk.bst:components/systemd.bst
+- freedesktop-sdk.bst:components/tzdata.bst
+- freedesktop-sdk.bst:components/util-linux.bst
+- freedesktop-sdk.bst:bootstrap-import.bst
diff --git a/elements/iso/initramfs/initial-scripts.bst b/elements/iso/initramfs/initial-scripts.bst
new file mode 100644
index 00000000..e9dcd601
--- /dev/null
+++ b/elements/iso/initramfs/initial-scripts.bst
@@ -0,0 +1,7 @@
+kind: collect_initial_scripts
+
+build-depends:
+- iso/initramfs/deps.bst
+
+config:
+  path: /etc/fdsdk/initial_scripts
diff --git a/elements/iso/installer-dirs.bst b/elements/iso/installer-dirs.bst
new file mode 100644
index 00000000..5cd81914
--- /dev/null
+++ b/elements/iso/installer-dirs.bst
@@ -0,0 +1,12 @@
+kind: manual
+
+build-depends:
+- freedesktop-sdk.bst:bootstrap-import.bst
+
+config:
+  install-commands:
+  - |
+    mkdir %{install-root}/sys
+    mkdir %{install-root}/dev
+    mkdir %{install-root}/proc
+    mkdir %{install-root}/tmp
diff --git a/elements/iso/iso-build-deps.bst b/elements/iso/iso-build-deps.bst
new file mode 100644
index 00000000..a0672ad3
--- /dev/null
+++ b/elements/iso/iso-build-deps.bst
@@ -0,0 +1,10 @@
+kind: stack
+
+runtime-depends:
+- core-deps/libostree.bst
+- iso/libisoburn.bst
+- iso/isomd5sum.bst
+- freedesktop-sdk.bst:integration/mtab.bst
+- freedesktop-sdk.bst:components/genimage.bst
+- freedesktop-sdk.bst:vm/prepare-image.bst
+- freedesktop-sdk.bst:snap-images/squashfs-tools.bst
diff --git a/files/eos-installer-extra/eos-installer.service b/files/eos-installer-extra/eos-installer.service
index 9ed92626..5d19a756 100644
--- a/files/eos-installer-extra/eos-installer.service
+++ b/files/eos-installer-extra/eos-installer.service
@@ -8,5 +8,5 @@ After=gnome-session.target
 
 [Service]
 Type=simple
-ExecStart=/usr/bin/eos-installer
+ExecStart=/usr/libexec/gnome-image-installer
 Restart=no
diff --git a/files/eos-installer-extra/session.conf b/files/eos-installer-extra/session.conf
new file mode 100644
index 00000000..711e0312
--- /dev/null
+++ b/files/eos-installer-extra/session.conf
@@ -0,0 +1,19 @@
+[Unit]
+Wants=org.gnome.SettingsDaemon.A11ySettings.target
+Wants=org.gnome.SettingsDaemon.Color.target
+Wants=org.gnome.SettingsDaemon.Datetime.target
+Wants=org.gnome.SettingsDaemon.Housekeeping.target
+Wants=org.gnome.SettingsDaemon.Keyboard.target
+Wants=org.gnome.SettingsDaemon.MediaKeys.target
+Wants=org.gnome.SettingsDaemon.Power.target
+Wants=org.gnome.SettingsDaemon.PrintNotifications.target
+Wants=org.gnome.SettingsDaemon.Rfkill.target
+Wants=org.gnome.SettingsDaemon.ScreensaverProxy.target
+Wants=org.gnome.SettingsDaemon.Sharing.target
+Wants=org.gnome.SettingsDaemon.Smartcard.target
+Wants=org.gnome.SettingsDaemon.Sound.target
+Wants=org.gnome.SettingsDaemon.Wacom.target
+Wants=org.gnome.SettingsDaemon.XSettings.target
+
+Requires=org.gnome.Shell.target
+Requires=eos-installer.service


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]