52 lines
1.5 KiB
Diff
52 lines
1.5 KiB
Diff
diff --git a/init.sh b/init.sh
|
|
index e599451..ab6e016 100644
|
|
--- a/init.sh
|
|
+++ b/init.sh
|
|
@@ -1,20 +1,17 @@
|
|
#!/bin/sh
|
|
set -eu
|
|
|
|
-log_info() { echo "$0[$$]: $*" >&2; }
|
|
log_error() { echo "$0[$$]: ERROR $*" >&2; }
|
|
|
|
do_mount_fs() {
|
|
- log_info "mounting FS: $*"
|
|
[ -e /proc/filesystems ] && { grep -q "$1" /proc/filesystems || { log_error "Unknown filesystem"; return 1; } }
|
|
[ -d "$2" ] || mkdir -p "$2"
|
|
- [ -e /proc/mounts ] && { grep -q -e "^$1 $2 $1" /proc/mounts && { log_info "$2 ($1) already mounted"; return 0; } }
|
|
+ [ -e /proc/mounts ] && { grep -q -e "^$1 $2 $1" /proc/mounts && { return 0; } }
|
|
mount -t "$1" "$1" "$2"
|
|
}
|
|
|
|
bail_out() {
|
|
log_error "$@"
|
|
- log_info "Rebooting..."
|
|
#exec reboot -f
|
|
exec sh
|
|
}
|
|
@@ -33,8 +30,6 @@ get_ostree_sysroot() {
|
|
|
|
export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/ostree
|
|
|
|
-log_info "Starting OSTree initrd script"
|
|
-
|
|
do_mount_fs proc /proc
|
|
do_mount_fs sysfs /sys
|
|
do_mount_fs devtmpfs /dev
|
|
@@ -57,14 +52,12 @@ ostree_sysroot=$(get_ostree_sysroot)
|
|
mount "$ostree_sysroot" /sysroot || {
|
|
# The SD card in the R-Car M3 takes a bit of time to come up
|
|
# Retry the mount if it fails the first time
|
|
- log_info "Mounting $ostree_sysroot failed, waiting 5s for the device to be available..."
|
|
sleep 5
|
|
mount "$ostree_sysroot" /sysroot || bail_out "Unable to mount $ostree_sysroot as physical sysroot"
|
|
}
|
|
|
|
-ostree-prepare-root /sysroot
|
|
+ostree-prepare-root /sysroot > /dev/null 2>&1
|
|
|
|
-log_info "Switching to rootfs"
|
|
# shellcheck disable=SC2093
|
|
exec switch_root /sysroot /sbin/init
|
|
|