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