Skip to content

Commit d3cf6ce

Browse files
committed
ADD: support for Ventoy
1 parent 300d619 commit d3cf6ce

File tree

1 file changed

+24
-7
lines changed
  • bin/make_images/linux_install_files

1 file changed

+24
-7
lines changed

bin/make_images/linux_install_files/init

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
#!/bin/busybox ash
1+
#!/bin/sh
22
# shellcheck shell=dash
33

44
# Edited to boot squashfs
55
# Taken most parts from original init
6-
VERSION=0.1.3 #based on alpine init 3.5.0-r0
6+
VERSION=0.1.4 #based on alpine init 3.5.0-r0
77
sysroot=/sysroot
88
repofile=/tmp/repositories
99

@@ -41,6 +41,16 @@ eend() {
4141
fi
4242
}
4343

44+
# find the dirs under ALPINE_MNT that are boot repositories
45+
find_boot_repositories() {
46+
if [ -n "$ALPINE_REPO" ]; then
47+
echo "$ALPINE_REPO"
48+
else
49+
find /media/* -name .boot_repository -type f -maxdepth 3 \
50+
| sed 's:/.boot_repository$::'
51+
fi
52+
}
53+
4454
# determine the default interface to use if ip=dhcp is set
4555
# uses the first "eth" interface with operstate 'up'.
4656
ip_choose_if() {
@@ -110,7 +120,7 @@ is_url() {
110120
esac
111121
}
112122

113-
/bin/busybox mkdir -p /usr/bin /usr/sbin /proc /sys /dev $sysroot
123+
/bin/busybox mkdir -p /usr/bin /usr/sbin /proc /sys /dev /tmp $sysroot
114124
/bin/busybox --install -s
115125
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
116126
[ -c /dev/null ] || mknod -m 666 /dev/null c 1 3
@@ -133,23 +143,30 @@ eend 0
133143

134144
ln -s /proc/mounts /etc/mtab
135145

146+
ebegin "Mounting boot media"
147+
if ! is_url "$rootfs_net"; then
148+
find_boot_repositories > $repofile
149+
nlplug-findfs -p /sbin/mdev -b $repofile -a /tmp/apkovls
150+
else
151+
nlplug-findfs -p /sbin/mdev -n
152+
echo -n "skip - "
153+
fi
154+
eend $?
155+
136156
overlayfs="/media"
137157
mkdir -p $overlayfs/root-rw
138158
mount -t tmpfs root-tmpfs $overlayfs/root-rw
139159
mkdir -p $overlayfs/root-ro $overlayfs/root-rw/root $overlayfs/root-rw/work
140160

141161
if is_url "$rootfs_net"; then
142-
nlplug-findfs -p /sbin/mdev -n
143162
configure_ip || return_err "Failed to setup network."
144163
wget -O $overlayfs/root-rw/squashfs.img "$rootfs_net"
145164
ebegin "Mounting rootfs"
146165
mount -o loop,ro $overlayfs/root-rw/squashfs.img $overlayfs/root-ro
147166
mount -t overlay -o lowerdir=$overlayfs/root-ro,upperdir=$overlayfs/root-rw/root,workdir=$overlayfs/root-rw/work LIVE_OS $sysroot
148167
eend $?
149168
else
150-
mkdir -p /tmp
151-
ebegin "Finding and mounting rootfs"
152-
nlplug-findfs -p /sbin/mdev -b $repofile -a /tmp/apkovls
169+
ebegin "Mounting rootfs"
153170
repo_dir=$(head -n 1 $repofile)
154171
if [ -f "$repo_dir/$rootfs_net" ]; then
155172
mount -o loop,ro "$repo_dir/$rootfs_net" $overlayfs/root-ro

0 commit comments

Comments
 (0)