forked from clan/clan-core
installer: make qrcode compatible with nixos-images
This commit is contained in:
parent
05b510230f
commit
4ae5b24d24
@ -47,7 +47,7 @@
|
|||||||
--arg password "$(cat /var/shared/root-password)" \
|
--arg password "$(cat /var/shared/root-password)" \
|
||||||
--arg onion_address "$(cat /var/shared/onion-hostname)" \
|
--arg onion_address "$(cat /var/shared/onion-hostname)" \
|
||||||
--argjson local_addrs "$local_addrs" \
|
--argjson local_addrs "$local_addrs" \
|
||||||
'{ password: $password, onion_address: $onion_address, local_addresses: $local_addrs }' \
|
'{ pass: $password, onion_address: $onion_address, local_addrs: $local_addrs }' \
|
||||||
> /var/shared/login.json
|
> /var/shared/login.json
|
||||||
cat /var/shared/login.json | qrencode -t utf8 -o /var/shared/qrcode.utf8
|
cat /var/shared/login.json | qrencode -t utf8 -o /var/shared/qrcode.utf8
|
||||||
'';
|
'';
|
||||||
|
@ -85,15 +85,15 @@ def is_reachable(host: str) -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def connect_ssh_from_json(ssh_data: dict[str, str]) -> None:
|
def connect_ssh_from_json(ssh_data: dict[str, str]) -> None:
|
||||||
for address in ssh_data["local_addresses"]:
|
for address in ssh_data["local_addrs"]:
|
||||||
log.debug(f"Trying to reach host on: {address}")
|
log.debug(f"Trying to reach host on: {address}")
|
||||||
if is_reachable(address):
|
if is_reachable(address):
|
||||||
ssh(host=address, password=ssh_data["password"])
|
ssh(host=address, password=ssh_data["pass"])
|
||||||
exit(0)
|
exit(0)
|
||||||
else:
|
else:
|
||||||
log.debug(f"Could not reach host on {address}")
|
log.debug(f"Could not reach host on {address}")
|
||||||
log.debug(f'Trying to reach host via torify on {ssh_data["tor"]}')
|
log.debug(f'Trying to reach host via torify on {ssh_data["tor"]}')
|
||||||
ssh(host=ssh_data["tor"], password=ssh_data["password"], torify=True)
|
ssh(host=ssh_data["tor"], password=ssh_data["pass"], torify=True)
|
||||||
|
|
||||||
|
|
||||||
def main(args: argparse.Namespace) -> None:
|
def main(args: argparse.Namespace) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user