Skip to content

Commit c5fd64d

Browse files
committed
Support TrueNAS Scale (Linux) distro. (#3069 #3137)
1 parent 32fac72 commit c5fd64d

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/ventoy/busybox/sh
2+
#************************************************************************************
3+
# Copyright (c) 2020, longpanda <admin@ventoy.net>
4+
#
5+
# This program is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU General Public License as
7+
# published by the Free Software Foundation; either version 3 of the
8+
# License, or (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with this program; if not, see <http://www.gnu.org/licenses/>.
17+
#
18+
#************************************************************************************
19+
20+
. /ventoy/hook/ventoy-hook-lib.sh
21+
22+
vtlog "####### $0 $* ########"
23+
24+
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
25+
26+
27+
ventoy_run_fuse() {
28+
vtlog "ventoy_run_fuse $*"
29+
30+
mkdir -p $VTOY_PATH/mnt/fuse
31+
32+
vtoydm -p -f $VTOY_PATH/ventoy_image_map -d $1 > $VTOY_PATH/ventoy_dm_table
33+
vtoy_fuse_iso -f $VTOY_PATH/ventoy_dm_table -m $VTOY_PATH/mnt/fuse
34+
35+
mount -t iso9660 $VTOY_PATH/mnt/fuse/ventoy.iso $VTOY_PATH/mnt/iso
36+
}
37+
38+
39+
wait_for_usb_disk_ready
40+
41+
vtdiskname=$(get_ventoy_disk_name)
42+
if [ "$vtdiskname" = "unknown" ]; then
43+
vtlog "ventoy disk not found"
44+
PATH=$VTPATH_OLD
45+
exit 0
46+
fi
47+
48+
ventoy_run_fuse $vtdiskname
49+
50+
if [ -f /ventoy/autoinstall ]; then
51+
sh /ventoy/hook/default/auto_install_varexp.sh /ventoy/autoinstall
52+
fi
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/ventoy/busybox/sh
2+
#************************************************************************************
3+
# Copyright (c) 2020, longpanda <admin@ventoy.net>
4+
#
5+
# This program is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU General Public License as
7+
# published by the Free Software Foundation; either version 3 of the
8+
# License, or (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with this program; if not, see <http://www.gnu.org/licenses/>.
17+
#
18+
#************************************************************************************
19+
20+
if [ -e /init ] && $GREP -q '^mountroot$' /init; then
21+
echo "Here before mountroot ..." >> $VTLOG
22+
$SED "/^mountroot$/i\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/truenas-disk.sh" -i /init
23+
$SED "/^mountroot$/i\\export LIVEMEDIA=/dev/mapper/ventoy" -i /init
24+
$SED "/^mountroot$/i\\export LIVE_MEDIA=/dev/mapper/ventoy" -i /init
25+
$SED "/^mountroot$/i\\export FROMISO=$VTOY_PATH/mnt/fuse/ventoy.iso" -i /init
26+
fi

IMG/cpio/ventoy/hook/debian/ventoy-hook.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ ventoy_get_debian_distro() {
114114
echo 'devuan'; return
115115
fi
116116

117+
if $GREP -q 'truenas' /proc/version; then
118+
echo 'truenas'; return
119+
fi
120+
117121
echo 'default'
118122
}
119123

0 commit comments

Comments
 (0)