Commit Graph

224 Commits

Author SHA1 Message Date
Clayton Craft
d3829af9e4 main: use a temporary work dir for writing archives into
post-processing/installation will be handled by an external app, so
use a temp work dir for the external app to work out of when it is
invoked
2021-08-17 23:05:16 -07:00
Clayton Craft
0643ae37b2 main: tweak some log messages to user 2021-08-17 23:04:15 -07:00
Clayton Craft
77b2455b91 archive: replace extract test with call to gzip -t
A custom extract test includes reading AND writing the extracted archive
contents to /tmp (which is probably a slow disk), so this uses busybox's
gzip -t ("test file integrity") and seems to take about half the time
(~10s vs ~6s measured loosely on pinephone)
2021-08-17 15:31:40 -07:00
Clayton Craft
1b9f0744b3 main: return 0 if deviceinfo is missing
It might be missing if the device package is installed after mkinitfs is
being called, so don't cause apk triggers to error out by returning
failure.
2021-08-16 22:32:32 -07:00
Clayton Craft
217360b400 DeviceInfo: don't kill app when deviceinfo is not found
Sometimes this is fine, e.g. when mkinitfs is run before the device
package is installed in a chroot. So it shouldn't kill the app.
2021-08-16 22:20:14 -07:00
Clayton Craft
66b86cc363 archive:write: simplify verification steps
The free space check, checksumming, and moving to the final location
will be outsourced to "boot-deploy", so the verification done here is
just to extract the archive to make sure it is valid.
2021-08-16 17:54:58 -07:00
Clayton Craft
321cebff76 main: drop generating init.sh
This file is no longer a template since pmOS is only supporting 1
installed kernel at a time
2021-08-12 15:05:22 -07:00
Clayton Craft
d77de3b91a main: remove support for generating initfs with kernel 'flavor' in name
pmOS will only support 1 kernel:
https://gitlab.com/postmarketOS/pmaports/-/issues/660
2021-08-12 14:50:04 -07:00
Clayton Craft
58a7575848 pkgs/misc: fix linting 2021-08-10 19:13:53 -07:00
Clayton Craft
93333dbb25 pkgs/archive: fix linting 2021-08-10 19:13:32 -07:00
Clayton Craft
49cf99f4d9 ci: add initial config for gitlab CI
Just checks linting, and build/test.
2021-08-10 19:10:41 -07:00
Clayton Craft
206020c3f1 main: drop ununsed functions 2021-08-10 18:10:16 -07:00
Clayton Craft
40ae9e83dd main: remove checksumFile
This was left over from when I was trying to use the 'crc' cpio format,
that allows checksumming files in the cpio for checking integrity.

The 'crc' format isn't actually supported by the kernel... See:
https://lore.kernel.org/linux-doc/20210721115153.28620-2-ddiss@suse.de/
2021-08-10 18:10:16 -07:00
Clayton Craft
fda793fdb4 main/generateInitfs: create init.sh in a temp dir 2021-08-10 17:34:17 -07:00
Clayton Craft
a928314ffb include go.sum
https://github.com/golang/go/wiki/Modules#should-i-commit-my-gosum-file-as-well-as-my-gomod-file

`go mod tidy` was also run on the go.mod file
2021-08-10 14:05:58 -07:00
Clayton Craft
a381516e53 rename project to postmarketos-mkinitfs
To help prevent any confusion about which distro this 'mkinitfs' is
intended for
2021-08-10 14:03:34 -07:00
Clayton Craft
f0bf13c9f2 pkg/archive/Write: implement writing of archive with verification
This adds several steps to the "write" action, by writing it to a temp
location, extracting it, checksumming it, copying to destination,
verifying checksum, and using Rename to atomically replace any existing
file in the destination.
2021-08-10 13:23:56 -07:00
Clayton Craft
1716445e9d pkg/archive: drop renameio dependency
renameio basically just does: Sync(), Close(), Rename(). This will be
done here instead of using an external dependency
2021-08-10 13:22:22 -07:00
Clayton Craft
2633f0bde9 pkg/archive: add function to extract archive
This will be used to test archive integrity by extracting it
2021-08-10 13:21:42 -07:00
Clayton Craft
766da6a0dc pkg/archive: add function for checksumming a file
This uses sha256 which, after benchmarking, doesn't seem to be any
faster or slower than sha1. md5 was surprisingly slower (on aarch64),
maybe because there are some CPU accelerated things in sha* ?
2021-08-10 13:19:26 -07:00
Clayton Craft
896d4fa0d0 pkg/misc: add function to return free space for given path 2021-08-10 13:02:44 -07:00
Clayton Craft
7a92fb1608 main: add log msgs for writing initfs archives 2021-08-10 13:02:01 -07:00
Clayton Craft
64195a5f83 initial commit 2021-08-09 15:23:39 -07:00
Clayton Craft
d6a85fd8a0 add gitignore 2021-08-09 12:49:57 -07:00