pkgs/openwrt: switch sshScript to installing the image

This commit is contained in:
Astro 2022-06-23 18:08:41 +02:00
parent 1a6e0ec7a3
commit bc764e2526
1 changed files with 13 additions and 18 deletions

View File

@ -11,26 +11,21 @@ let
"kmod-ath10k" "ath10k-firmware-qca988x"
];
};
in
{
sshScript = hostName: ''
#! ${pkgs.runtimeShell} -e
in rec {
sshScript = hostName:
let
address = config.site.net.mgmt.hosts4.${hostName};
in ''
#! ${pkgs.runtimeShell} -e
${if config.site.hosts.${hostName}.firstboot
then ''
ssh-keygen -R 192.168.1.1
ssh root@192.168.1.1 \
"ash -e -x" <<__SSH__
'' else ''
ssh root@${config.site.net.mgmt.hosts4.${hostName}} \
"ash -e -x" <<__SSH__
${uciConfig hostName}
__SSH__
ssh root@${address} "cat > /tmp/openwrt-image" < ${buildImage hostName}/openwrt-*-${hostName}-*-sysupgrade.bin
ssh root@${address} "sysupgrade -n /tmp/openwrt-image"
echo "Base configuration done \\o/"
echo "Later run: ap_install_collectd.sh ${config.site.net.mgmt.hosts4.${hostName}}"
''}
'';
# ssh hostkey will have changed after boot
ssh-keygen -R ${address}
/run/wrappers/bin/ping ${address}
'';
buildImage = hostName:
let