unifios-utilities
unifios-utilities copied to clipboard
Please update example boot scripts for 2.x
Describe the bug The example scripts for adding ssh keys and preserving history no longer work on UDM Pro version 2.x
- Variant [Dream Machine Pro]
- Firmware Version: [v2.4.27]
Indeed. Also several of the items are no longer relevant, for example the links to multicast-relay. UnifiOS supports that natively now.
Personally I returned here looking for how to install ntopng on v2.4+.
@harrisonj94 Please try now, there have been two merges that should help with the issue.
Can anyone confirm all configurations / podman will be retained when upgrading from the earlier 2.x version to 2.4.27?
Can anyone confirm all configurations / podman will be retained when upgrading from the earlier 2.x version to 2.4.27?
If you have the 00-podman.sh script installed in the /data/on_boot.d directory, yes, it will be maintained. I have been using EA and podman was retained from 2.4.x to 2.5.x
For persistent SSH keys script to work, you have to create ".ssh" directory in "root" directory and create "authorized_keys" file in earlier-created "root/.ssh/" sub-directory. Then you can apply the persistent SSH keys script.
#!/bin/sh
# Get DataDir location
DATA_DIR="/mnt/data"
case "$(ubnt-device-info firmware || true)" in
1*)
DATA_DIR="/mnt/data"
;;
2*)
DATA_DIR="/data"
;;
3*)
DATA_DIR="/data"
;;
*)
echo "ERROR: No persistent storage found." 1>&2
exit 1
;;
esac
user_authorized_keys_file="$DATA_DIR/ssh/authorized_keys"
udm_authorized_keys_file="/root/.ssh/authorized_keys"
# if $DATA_DIR/ssh/authorized_keys is missing print error message
if [ ! -f "$user_authorized_keys_file" ]; then
echo "ERROR: $user_authorized_keys_file is missing"
exit 1
fi
# Reads the user file line by line and adds the key to the authorized_keys file
file=$user_authorized_keys_file
while IFS= read -r line || [ -n "$line" ]; do
echo $line >>$udm_authorized_keys_file
done <"$file"
For persistent SSH keys script to work, you have to create ".ssh" directory in "root" directory and create "authorized_keys" file in earlier-created "root/.ssh/" sub-directory. Then you can apply the persistent SSH keys script.
#!/bin/sh # Get DataDir location DATA_DIR="/mnt/data" case "$(ubnt-device-info firmware || true)" in 1*) DATA_DIR="/mnt/data" ;; 2*) DATA_DIR="/data" ;; 3*) DATA_DIR="/data" ;; *) echo "ERROR: No persistent storage found." 1>&2 exit 1 ;; esac user_authorized_keys_file="$DATA_DIR/ssh/authorized_keys" udm_authorized_keys_file="/root/.ssh/authorized_keys" # if $DATA_DIR/ssh/authorized_keys is missing print error message if [ ! -f "$user_authorized_keys_file" ]; then echo "ERROR: $user_authorized_keys_file is missing" exit 1 fi # Reads the user file line by line and adds the key to the authorized_keys file file=$user_authorized_keys_file while IFS= read -r line || [ -n "$line" ]; do echo $line >>$udm_authorized_keys_file done <"$file"
Due to future updates to the UbiOS, adjust the first line to #!/bin/bash as all the current scripts here have been updated already. Ubiquiti has decided going forward to use Dash instead of Bash and that causes many script commands to fail.