mirror of
https://github.com/kairos-io/packages.git
synced 2025-08-16 23:17:53 +00:00
Add retry to cdrom mounting in alpine/initramfs (#268)
This commit is contained in:
parent
42965de3d9
commit
2789fca75f
@ -1,9 +1,9 @@
|
||||
packages:
|
||||
- name: "alpine"
|
||||
category: "distro-kernel"
|
||||
version: "0.1.4"
|
||||
version: "0.1.5"
|
||||
description: "Provides kernel and custom initrd for alpine"
|
||||
- name: "alpine-rpi"
|
||||
category: "distro-kernel"
|
||||
version: "0.1.4"
|
||||
version: "0.1.5"
|
||||
description: "Provides kernel and custom initrd for alpine"
|
@ -131,16 +131,6 @@ rtc_exists() {
|
||||
[ -e "$rtc" ]
|
||||
}
|
||||
|
||||
# This is used to predict if network access will be necessary
|
||||
is_url() {
|
||||
case "$1" in
|
||||
http://*|https://*|ftp://*)
|
||||
return 0;;
|
||||
*)
|
||||
return 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
# support for eudev. see /etc/init.d/udev*
|
||||
eudev_start()
|
||||
{
|
||||
@ -172,6 +162,26 @@ eudev_start()
|
||||
}
|
||||
|
||||
|
||||
# retry function
|
||||
retry() {
|
||||
retries=$1
|
||||
shift
|
||||
|
||||
count=0
|
||||
until "$@"; do
|
||||
exit=$?
|
||||
wait=1
|
||||
count=$((count + 1))
|
||||
if [ "$count" -lt "$retries" ]; then
|
||||
echo "Retry $count/$retries exited $exit, retrying in $wait seconds..."
|
||||
sleep $wait
|
||||
else
|
||||
echo "Retry $count/$retries exited $exit, no more retries left."
|
||||
return $exit
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
/bin/busybox mkdir -p "$ROOT"/usr/bin \
|
||||
"$ROOT"/usr/sbin \
|
||||
"$ROOT"/proc \
|
||||
@ -261,17 +271,17 @@ if grep -q cdroot /proc/cmdline || grep -q netboot /proc/cmdline || grep -q "rd.
|
||||
eend
|
||||
# Mount read-only livecd
|
||||
ebegin "Mount LiveCD RO"
|
||||
$MOCK mount /dev/sr0 /media/root-ro
|
||||
retry 10 "$MOCK mount /dev/sr0 /media/root-ro"
|
||||
eend $?
|
||||
$MOCK sync
|
||||
# Mount squashfs into loop device
|
||||
ebegin "Mount rootfs as squashfs device"
|
||||
losetup /dev/loop0 /media/root-ro/rootfs.squashfs
|
||||
retry 5 "losetup /dev/loop0 /media/root-ro/rootfs.squashfs"
|
||||
eend $?
|
||||
$MOCK sync
|
||||
# Mount loop device into the rootfsbase
|
||||
ebegin "Mount loop device into rootfsbase"
|
||||
$MOCK mount /dev/loop0 /run/rootfsbase
|
||||
retry 5 "$MOCK mount /dev/loop0 /run/rootfsbase"
|
||||
eend $?
|
||||
$MOCK sync
|
||||
# Mount writable overlay tmpfs
|
||||
|
Loading…
Reference in New Issue
Block a user