Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
81 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import $ from "daxex/mod.ts"; | ||
import { deployCli } from "../../apt/helper.ts"; | ||
import { keepOriginalBin } from "../../src/deploy.ts"; | ||
|
||
export async function postInstall() { | ||
const aptGetPath = await $.which("apt-get"); | ||
if (!aptGetPath) return; | ||
await keepOriginalBin(aptGetPath); | ||
await deployCli("apt-get", aptGetPath); | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,40 @@ | ||
#!/bin/bash -eu | ||
#!/bin/bash | ||
|
||
set -eux | ||
|
||
HOST_ARCH=$(cat /mimic-cross/mimic-cross/host_arch) | ||
# echo PATH=\"/mimic-cross/deploy/bin:"$PATH"\" >/etc/environment | ||
|
||
#shellcheck disable=SC2046,SC2226 | ||
function create_ld_linux_symlink() { | ||
local host_ld_linux="$1" | ||
local target="$2" | ||
mkdir -p "$(dirname "${target}")" | ||
if [[ $(realpath "${host_ld_linux}") != $(realpath "${target}") ]]; then | ||
ln -s "$host_ld_linux" "$target" | ||
fi | ||
} | ||
|
||
ln -s $(realpath /mimic-cross/usr/lib/"$HOST_ARCH"-linux-gnu /usr/lib/) | ||
if [[ $(realpath /lib) != /usr/lib ]]; then | ||
ln -s /mimic-cross/lib/"$HOST_ARCH"-linux-gnu /lib | ||
fi | ||
|
||
# TODO support another arch | ||
mkdir -p /lib64 | ||
ln -s /mimic-cross/lib64/ld-linux-x86-64.* /lib64/ | ||
ln -s /mimic-cross/usr/aarch64-linux-gnu /usr | ||
|
||
# random devices used in apt-key script | ||
/mimic-cross/mimic-cross/internal/bin/chroot /mimic-cross mknod /dev/random c 1 8 | ||
/mimic-cross/mimic-cross/internal/bin/chroot /mimic-cross mknod /dev/urandom c 1 9 | ||
/mimic-cross/mimic-cross/internal/bin/chroot /mimic-cross mknod /dev/null c 1 3 | ||
/mimic-cross/mimic-cross/internal/bin/chroot /mimic-cross mknod /dev/zero c 1 5 | ||
/mimic-cross/mimic-cross/internal/bin/chroot /mimic-cross chmod 666 /dev/random /dev/urandom /dev/null /dev/zero | ||
|
||
|
||
# mkdir -p /var/log/mimic-cross | ||
# mkdir -p /mimic-cross/deploy/host | ||
# mkdir -p /mimic-cross/deploy/target | ||
# mkdir -p /mimic-cross/deploy/bin | ||
# | ||
# cp /mimic-cross/bin/apt-get /usr/local/bin/ | ||
# cp /mimic-cross/bin/mimic-deploy /usr/local/bin/ | ||
# cp /mimic-cross/bin/mimic-host-run /usr/local/bin/ | ||
# cp /mimic-cross/bin/mimic-dual-run /usr/local/bin/ | ||
# | ||
# cp /host/usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static | ||
# | ||
# [[ "$(ls -A /etc/apt/sources.list.d/)" ]] && cp /etc/apt/sources.list.d/* /host/etc/apt/sources.list.d/ | ||
# cp /etc/apt/trusted.gpg.d/* /host/etc/apt/trusted.gpg.d/ | ||
# | ||
# cp /etc/resolv.conf /host/etc/resolv.conf | ||
# dpkg -l | awk '/gnupg/ {print $2}' | xargs -r /host/"$(command -v chroot)" /host apt-get install | ||
# cp /host/etc/resolv.conf.orig /host/etc/resolv.conf | ||
# #shellcheck disable=SC1091 | ||
# /mimic-cross/hostize_installed_packages.sh | ||
find /mimic-cross -name "ld-linux-*" | while read -r host_ld_linux; do | ||
target="${host_ld_linux#/mimic-cross}" | ||
create_ld_linux_symlink "$host_ld_linux" "$target" | ||
if [[ "${target}" == /usr/* ]]; then | ||
create_ld_linux_symlink "$host_ld_linux" "${target#/usr}" | ||
fi | ||
done | ||
|
||
/mimic-cross/mimic-cross/bin/mimic-deno compile \ | ||
-A -c /mimic-cross/mimic-cross.deno/deno.json \ | ||
/mimic-cross/mimic-cross.deno/src/mimicx.ts | ||
mv ./mimicx /usr/local/bin | ||
|
||
# 追加した行 | ||
echo '#!/bin/bash | ||
/mimic-cross/mimic-cross/bin/mimic-deno run -A /mimic-cross/mimic-cross.deno/src/mimicx.ts $@' \ | ||
> /usr/local/bin/mimicx | ||
chmod +x /usr/local/bin/mimicx | ||
|
||
mimicx setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import $ from "daxex/mod.ts"; | ||
import { config } from "../config/config.ts"; | ||
import { runOnHost } from "./chroot.ts"; | ||
import { deployInstalledPackages } from "../apt/apt.ts"; | ||
|
||
export async function setup() { | ||
await Promise.all([ | ||
runOnHost("mknod /dev/random c 1 8"), | ||
runOnHost("mknod /dev/urandom c 1 9"), | ||
runOnHost("mknod /dev/null c 1 3"), | ||
runOnHost("mknod /dev/zero c 1 5"), | ||
]); | ||
await runOnHost("chmod 666 /dev/random /dev/urandom /dev/null /dev/zero"); | ||
await $.path(`${config.logFile}`).parent()?.mkdir({ recursive: true }); | ||
await $.path(`${config.keepBin}`).mkdir({ recursive: true }); | ||
await deployInstalledPackages(); | ||
} |