File tree Expand file tree Collapse file tree 5 files changed +36
-14
lines changed Expand file tree Collapse file tree 5 files changed +36
-14
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ function cbl_bld_llvm_korg -d "Build (and optionally test) LLVM for kernel.org"
59
59
for tc in (fd -a -d 1 -t d . $tmp_llvm_install )
60
60
for src in $CBL_SRC_C /linux $CBL_SRC_C /linux-stable-$CBL_STABLE_VERSIONS
61
61
if using_nspawn
62
- sd_nspawn -r ' cbl_lkt --linux-folder ' (nspawn_adjust_path $src )' --llvm-prefix ' (nspawn_adjust_path $tc )
62
+ sd_nspawn -r ' cbl_lkt --linux-folder ' (nspawn_path -c $src )' --llvm-prefix ' (nspawn_path -c $tc )
63
63
else if dbx_has_82a69f0
64
64
dbxe -- fish -c " cbl_lkt --linux-folder $src --llvm-prefix $tc "
65
65
else
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ function cbl_test_kvm -d "Test KVM against a Clang built kernel with QEMU"
56
56
mkdir -p $TMP_FOLDER
57
57
cp -v /boot/vmlinuz-linux $TMP_FOLDER /bzImage
58
58
if using_nspawn
59
- sd_nspawn -r ' kboot -a x86_64 -k ' (nspawn_adjust_path $TMP_FOLDER )' /bzImage -t 30s'
59
+ sd_nspawn -r ' kboot -a x86_64 -k ' (nspawn_path -c $TMP_FOLDER )' /bzImage -t 30s'
60
60
else if dbx_has_82a69f0
61
61
dbxe -- fish -c " kboot -a x86_64 -k $TMP_FOLDER /bzImage -t 30s"
62
62
else
Original file line number Diff line number Diff line change @@ -25,5 +25,5 @@ function mchsh -d "Wrapper around 'machinectl shell'"
25
25
# Use fish's --init-commands to drop into the current working directory,
26
26
# instead of $HOME, which is not really useful if working on the host and
27
27
# wanting to drop into the guest to work.
28
- machinectl shell -q $user_host $SHELL -C ' cd ' (nspawn_adjust_path $PWD ) $mchsh_args
28
+ machinectl shell -q $user_host $SHELL -C ' cd ' (nspawn_path -c $PWD ) $mchsh_args
29
29
end
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/env fish
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (C) 2024 Nathan Chancellor
4
+
5
+ function nspawn_path -d " Translate /home paths into systemd-nspawn or host"
6
+ set mode $argv [1]
7
+ set path $argv [2]
8
+ set run_host /run/host
9
+
10
+ # The path only needs to be adjusted when it actually starts with whatever
11
+ # the current $HOME value is, otherwise we assume that it is either already
12
+ # in the appropriate format or it does not need to be converted.
13
+ if string match -qr ^ $HOME $path
14
+ switch $mode
15
+ # In container mode, the /home path should be prefixed with /run/host
16
+ case -c --container
17
+ if not string match -qr ^ $run_host $path
18
+ set prefix $run_host
19
+ end
20
+ printf ' %s%s\ n' $prefix $path
21
+
22
+ # In host mode, /run/host should be stripped from /home
23
+ case -H --host
24
+ if string match -qr ^ /home $path
25
+ echo $path
26
+ else
27
+ string replace -m1 $run_host ' ' $path
28
+ end
29
+ end
30
+ else
31
+ echo $path
32
+ end
33
+ end
You can’t perform that action at this time.
0 commit comments