alxwolf / ubios-cert

Manage SSL / TLS certificates with acme.sh (Let's Encrypt, ZeroSSL) for Ubiquiti UbiOS firmwares
MIT License
170 stars 20 forks source link

UDM pro upgraded to 2.x uses /data not /mnt/data #29

Closed ausil closed 1 year ago

ausil commented 1 year ago

The logic on what path to use probably need to be adjusted t look at the firmware version not hardware model. I just updated to 2.4.23 and had to tweak the scripts.

mojo333 commented 1 year ago

A good start but this should be re-opened as the scripts in ubios-cert/ubios-cert.sh and ubios-cert/on_boot.d/99-ubios-cert.sh also need to be updated to reflect the use of /data and not /mnt/data which is hardcoded in these scripts.

alxwolf commented 1 year ago

A good start but this should be re-opened as the scripts in ubios-cert/ubios-cert.sh and ubios-cert/on_boot.d/99-ubios-cert.sh also need to be updated to reflect the use of /data and not /mnt/data which is hardcoded in these scripts.

This should be taken care of by the ´sed´command, right?

sed -i 's#/mnt/data#/data#g' "${SCRIPT_DIR}/ubios-cert/ubios-cert.env" "${SCRIPT_DIR}/ubios-cert/ubios-cert.sh" "${SCRIPT_DIR}/ubios-cert/on_boot.d/99-ubios-cert.sh"
mojo333 commented 1 year ago

Thanks. So got the latest version, updated env as needed and ran deploy.sh and got

root@UDMP:/data/letsencrypt/ubios-cert-main# ./deploy.sh
Unsupported model: UniFi Dream Machine Pro

Makes no sense as:

root@UDMP:/data/letsencrypt/ubios-cert-main# export MODEL=$(ubnt-device-info model || true)
root@UDMP:/data/letsencrypt/ubios-cert-main# echo ${MODEL}
UniFi Dream Machine Pro

But, adding an echo just before the case statement shows that ${MODEL} evaluates to just "UniFi" and hence why the case statement fails... so something to do with spaces in the variable.

echo ${MODEL}

case "${MODEL}" in
    "UniFi Dream Machine Pro"|"UniFi Dream Machine"|"UniFi Dream Router"|"UniFi Dream Machine SE")

I'm obviously no bsh expert so not sure how to troubleshoot this further.