Marc e676793328
Update Modules for 2.6.0+ (Wave 1) (#71)
* Misc: Ignore JetBrains IDE files

* Modules: Update Modules for 2.6.0 (1)

* SiteSurvey: Actually install mdk3 dependency.

* Modules: Bump version numbers for updated modules
2019-08-21 21:15:53 +01:00

34 lines
843 B
Bash
Executable File

#!/bin/sh
#2015 - Whistle Master
[[ -f /tmp/KeyManager.progress ]] && {
exit 0
}
LOG=/tmp/keymanager.log
HOST=`uci get keymanager.settings.host`
PORT=`uci get keymanager.settings.port`
USER=`uci get keymanager.settings.user`
PASSWORD=$1
touch /tmp/KeyManager.progress
rm -rf ${LOG}
if ! grep -q ${HOST} /root/.ssh/known_hosts; then
echo -e "Cannot find ${HOST} in known_hosts. Adding it now." > ${LOG}
ssh-keyscan -p ${PORT} ${HOST} > /tmp/tmp_hosts
cat /tmp/tmp_hosts >> /root/.ssh/known_hosts
echo -e "Added the following to /root/.ssh/known_hosts:" >> ${LOG}
cat /tmp/tmp_hosts >> ${LOG}
fi
sshpass -p ${PASSWORD} /pineapple/modules/KeyManager/scripts/ssh-copy-id.sh -i /root/.ssh/id_rsa.pub -p ${PORT} ${USER}@${HOST}
echo -e "Copied local public key to remote host." >> ${LOG}
rm /tmp/KeyManager.progress