fixed docker related bugs or the testnet

This commit is contained in:
ghe0 2025-03-29 22:56:45 +02:00
parent e4db755b18
commit 53cdf34bb6
Signed by: ghe0
GPG Key ID: 451028EE56A0FBB4
4 changed files with 25 additions and 15 deletions

@ -7,10 +7,13 @@ cd "${scriptdir}/.."
./scripts/install.sh ./scripts/install.sh
mkdir -p "${scriptdir}/tmp/.detee/cli/vms" mkdir -p "${scriptdir}/tmp/.detee/cli/vms"
touch "${scriptdir}/tmp/.detee/cli/vms/uuid_list" touch "${scriptdir}/tmp/.detee/cli/vms/uuid_list"
mkdir -p "${scriptdir}/tmp/.detee/cli/apps"
touch "${scriptdir}/tmp/.detee/cli/apps/uuid_list"
cp -r "${HOME}/.detee/artefacts" "${scriptdir}/tmp/.detee" cp -r "${HOME}/.detee/artefacts" "${scriptdir}/tmp/.detee"
cp -r "${HOME}/.detee/bin" "${scriptdir}/tmp/.detee" cp -r "${HOME}/.detee/bin" "${scriptdir}/tmp/.detee"
cp -r "${HOME}/.detee/deps" "${scriptdir}/tmp/.detee" cp -r "${HOME}/.detee/deps" "${scriptdir}/tmp/.detee"
cp -r "${HOME}/.detee/samples" "${scriptdir}/tmp/.detee" cp -r "${HOME}/.detee/samples" "${scriptdir}/tmp/.detee"
cp -r "${HOME}/.detee/certs" "${scriptdir}/tmp/.detee"
${HOME}/.detee/bin/detee-cli completion fish > "${scriptdir}/tmp/.detee/detee-cli.fish" ${HOME}/.detee/bin/detee-cli completion fish > "${scriptdir}/tmp/.detee/detee-cli.fish"
cd "${scriptdir}" cd "${scriptdir}"

@ -19,10 +19,16 @@ echo_red() {
mkdir -p ${HOME}/.detee/bin mkdir -p ${HOME}/.detee/bin
mkdir -p ${HOME}/.detee/tmp mkdir -p ${HOME}/.detee/tmp
mkdir -p ${HOME}/.detee/deps mkdir -p ${HOME}/.detee/deps
mkdir -p ${HOME}/.detee/ mkdir -p ${HOME}/.detee/certs/
echo_blue "Make sure you add ${HOME}/.detee/bin to your path!" echo_blue "Make sure you add ${HOME}/.detee/bin to your path!"
install_certs() {
[[ -f "${HOME}/.detee/certs/root_ca.pem" ]] || {
wget -O "${HOME}/.detee/certs/root_ca.pem" https://registry.detee.ltd/root_ca.pem
}
}
install_sev-snp-measure() { install_sev-snp-measure() {
[[ -e "${HOME}/.detee/bin/sev-snp-measure.py" ]] && { [[ -e "${HOME}/.detee/bin/sev-snp-measure.py" ]] && {
echo_yellow "${HOME}/.detee/bin/sev-snp-measure.py already found. Delete the file to reinstall." echo_yellow "${HOME}/.detee/bin/sev-snp-measure.py already found. Delete the file to reinstall."
@ -56,9 +62,6 @@ install_detee-cli() {
} }
cargo build --release cargo build --release
cp ./target/release/detee-cli ${HOME}/.detee/bin cp ./target/release/detee-cli ${HOME}/.detee/bin
[[ -f "${HOME}/.detee/cli/root_ca.pem" ]] || {
wget -O "${HOME}/.detee/cli/root_ca.pem" https://registry.detee.ltd/root_ca.pem
}
} }
install_super-detee-cli() { install_super-detee-cli() {
@ -90,6 +93,7 @@ install_fish_completion() {
super-detee-cli completion fish > ${HOME}/.config/fish/completions/super-detee-cli.fish super-detee-cli completion fish > ${HOME}/.config/fish/completions/super-detee-cli.fish
} }
install_certs
install_sev-snp-measure install_sev-snp-measure
install_snpguest install_snpguest
install_detee-cli install_detee-cli

@ -304,13 +304,13 @@ impl Config {
} }
pub fn get_root_ca_path() -> Result<String, Error> { pub fn get_root_ca_path() -> Result<String, Error> {
Ok(Self::cli_dir_path()? + "/root_ca.pem") Ok(Self::home_dir() + "/.detee/certs/root_ca.pem")
} }
pub fn get_brain_info() -> (String, String) { pub fn get_brain_info() -> (String, String) {
match Self::init_config().network.as_str() { match Self::init_config().network.as_str() {
"staging" => ("https://159.65.58.38:31337".to_string(), "staging-brain".to_string()), "staging" => ("https://159.65.58.38:31337".to_string(), "staging-brain".to_string()),
_ => ("https://164.92.249.180:31337".to_string(), "testing-brain".to_string()), _ => ("https://164.92.249.180:31337".to_string(), "testnet-brain".to_string()),
} }
} }

@ -63,21 +63,24 @@ pub fn handle_account(matches: &ArgMatches) {
} }
} }
const FISH_COMPLETION: &str = r#"
complete -c detee-cli -n '__fish_detee_cli_using_subcommand vm; and __fish_seen_subcommand_from delete' -a '(cat ~/.detee/cli/vms/uuid_list)' -f
complete -c detee-cli -n '__fish_detee_cli_using_subcommand vm; and __fish_seen_subcommand_from update' -a '(cat ~/.detee/cli/vms/uuid_list)' -f
complete -c detee-cli -n '__fish_detee_cli_using_subcommand vm; and __fish_seen_subcommand_from inspect' -a '(cat ~/.detee/cli/vms/uuid_list)' -f
complete -c detee-cli -n '__fish_detee_cli_using_subcommand vm; and __fish_seen_subcommand_from ssh' -a '(cat ~/.detee/cli/vms/uuid_list)' -f
complete -c detee-cli -n '__fish_detee_cli_using_subcommand app; and __fish_seen_subcommand_from app config update' -a '(cat ~/.detee/cli/apps/uuid_list)' -f
complete -c detee-cli -n '__fish_detee_cli_using_subcommand app; and __fish_seen_subcommand_from app config get' -a '(cat ~/.detee/cli/apps/uuid_list)' -f
complete -c detee-cli -n '__fish_detee_cli_using_subcommand app; and __fish_seen_subcommand_from app delete' -a '(cat ~/.detee/cli/apps/uuid_list)' -f
complete -c detee-cli -n '__fish_detee_cli_using_subcommand app; and __fish_seen_subcommand_from app inspect' -a '(cat ~/.detee/cli/apps/uuid_list)' -f
"#;
pub fn handle_completion(matches: &ArgMatches, cmd: Command) { pub fn handle_completion(matches: &ArgMatches, cmd: Command) {
let mut cmd = disable_help_for_all_subcommands(cmd); let mut cmd = disable_help_for_all_subcommands(cmd);
if let Some(shell) = matches.get_one::<String>("shell") { if let Some(shell) = matches.get_one::<String>("shell") {
let shell: Shell = shell.parse().expect("Invalid shell type"); let shell: Shell = shell.parse().expect("Invalid shell type");
generate(shell, &mut cmd, "detee-cli", &mut io::stdout()); generate(shell, &mut cmd, "detee-cli", &mut io::stdout());
if shell.to_string() == "fish" { if shell.to_string() == "fish" {
println!("complete -c detee-cli -n '__fish_seen_subcommand_from vm delete' -a '(cat ~/.detee/cli/vms/uuid_list)' -f"); println!("{FISH_COMPLETION}");
println!("complete -c detee-cli -n '__fish_seen_subcommand_from vm update' -a '(cat ~/.detee/cli/vms/uuid_list)' -f");
println!("complete -c detee-cli -n '__fish_seen_subcommand_from vm inspect' -a '(cat ~/.detee/cli/vms/uuid_list)' -f");
println!("complete -c detee-cli -n '__fish_seen_subcommand_from vm ssh' -a '(cat ~/.detee/cli/vms/uuid_list)' -f");
println!("complete -c detee-cli -n '__fish_seen_subcommand_from app config update' -a '(cat ~/.detee/cli/apps/uuid_list)' -f");
println!("complete -c detee-cli -n '__fish_seen_subcommand_from app config get' -a '(cat ~/.detee/cli/apps/uuid_list)' -f");
println!("complete -c detee-cli -n '__fish_seen_subcommand_from app delete' -a '(cat ~/.detee/cli/apps/uuid_list)' -f");
println!("complete -c detee-cli -n '__fish_seen_subcommand_from app inspect' -a '(cat ~/.detee/cli/apps/uuid_list)' -f");
} }
} }
} }