Skip to content

install --ondev: add --cp and --no-rootfs

Oliver Smith requested to merge install-ondev-cp-no-rootfs into master

New help output

$ pmbootstrap install -h
...
optional on-device installer arguments:
  Wrap the resulting image in a postmarketOS based installation OS, so it
  can be encrypted and customized on first boot. Related:
  https://postmarketos.org/on-device-installer

  --on-device-installer, --ondev
                        enable on-device installer
  --no-local-pkgs       do not install locally compiled packages and package
                        signing keys
  --cp HOST_SRC:CHROOT_DEST [HOST_SRC:CHROOT_DEST ...]
                        copy one or more files from the host system path
                        HOST_SRC to the target path CHROOT_DEST
  --no-rootfs           do not generate a pmOS rootfs as /var/lib/rootfs.img
                        (install chroot). The file must either exist from a
                        previous 'pmbootstrap install' run or by providing it
                        as CHROOT_DEST with --cp

Commit messages

pmbootstrap install: add --ondev --cp

Allow to copy one or more files to the install chroot. It will be
possible to use this to put a non-pmOS image into the generated
installer OS.

and

pmbootstrap install: add --ondev --no-rootfs

Skip building the postmarketOS rootfs, and allow either installing a
pre-built pmOS rootfs, or even another operating system.

How to test / example output

$ pmbootstrap -y zap
$ pmbootstrap config device qemu-amd64
$ pmbootstrap config ui none
$ pmbootstrap install --no-rootfs
[12:46:41] ERROR: --no-rootfs can only be combined with --ondev. Do you mean --no-image?
$ pmbootstrap install --ondev --no-rootfs
[12:47:06] ERROR: --no-rootfs set, but rootfs.img not found in install chroot. Either run 'pmbootstrap install' without --no-rootfs first to let it generate the postmarketOS rootfs once, or supply a rootfs file with: --cp os.img:/var/lib/rootfs.img
$ pmbootstrap install --ondev --no-rootfs --cp /etc/issue:/var/lib/rootfs.img
(runs through)
$ pmbootstrap -y zap
$ pmbootstrap install --ondev
(runs through, creates new pmOS rootfs)
$ pmbootstrap install --ondev --no-rootfs
(does not complain, will attempt to use previous rootfs. right now not running through,
 the postmarketos-ondev script needs to be fixed to allow it to run multiple times without
 zap, I haven't pushed that fix yet.)
$ pmbootstrap -y zap
$ pmbootstrap install --ondev --cp invalidfile:/tmp/test
usage: pmbootstrap install [-h]
                           [--no-split | --split | --sdcard BLOCKDEV | --android-recovery-zip | --no-image]
                           [--rsync] [--flavor FLAVOR]
                           [--recovery-install-partition RECOVERY_INSTALL_PARTITION]
                           [--recovery-no-kernel] [--fde] [--cipher CIPHER]
                           [--iter-time ITER_TIME] [--add PACKAGES]
                           [--no-base] [--no-recommends]
                           [--sparse | --no-sparse] [--on-device-installer]
                           [--no-local-pkgs]
                           [--cp HOST_SRC:CHROOT_DEST [HOST_SRC:CHROOT_DEST ...]]
                           [--no-rootfs]
pmbootstrap install: error: argument --cp: HOST_SRC not found: invalidfile

CC: @z3ntu, @minlexx: follow-up to !1978 (merged) (includes both commits of that MR)

Closes #1966 (closed), #1977 (closed)

Edited by Oliver Smith

Merge request reports