diff --git a/rootfs/standard/usr/bin/mynode_gen_dhparam.sh b/rootfs/standard/usr/bin/mynode_gen_dhparam.sh index 60f8763f..d1a6d4df 100755 --- a/rootfs/standard/usr/bin/mynode_gen_dhparam.sh +++ b/rootfs/standard/usr/bin/mynode_gen_dhparam.sh @@ -3,6 +3,9 @@ set -x set -e +# Only generate if external drive is available + + # Check for dhparam on SD Card if [ ! -f /etc/ssl/certs/dhparam.pem ]; then # Check for dhparam on HDD @@ -14,14 +17,19 @@ if [ ! -f /etc/ssl/certs/dhparam.pem ]; then echo "Generating dhparam.pem" time openssl dhparam -out /tmp/dhparam.pem 2048 cp -f /tmp/dhparam.pem /etc/ssl/certs/dhparam.pem - cp -f /tmp/dhparam.pem /mnt/hdd/mynode/settings/dhparam.pem + # If HDD is available, move copy there + if [ -d /mnt/hdd/mynode/settings ]; then + cp -f /tmp/dhparam.pem /mnt/hdd/mynode/settings/dhparam.pem + fi fi sync else echo "dharam.pem already created" fi -# If not on HDD, make backup copy -if [ ! -f /mnt/hdd/mynode/settings/dhparam.pem ]; then - cp -f /etc/ssl/certs/dhparam.pem /mnt/hdd/mynode/settings/dhparam.pem +# If HDD is available and not on HDD, make backup copy +if [ -d /mnt/hdd/mynode/settings ]; then + if [ ! -f /mnt/hdd/mynode/settings/dhparam.pem ]; then + cp -f /etc/ssl/certs/dhparam.pem /mnt/hdd/mynode/settings/dhparam.pem + fi fi \ No newline at end of file