Supporting new firmwares

Supporting new data-directories for new firmwares. Tested un UDM Pro 2.4.23
This commit is contained in:
Gerd Naschenweng 2022-12-18 11:37:41 +01:00 committed by GitHub
parent 4d331f9b2a
commit df41bff4fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,15 +1,33 @@
#!/bin/sh #!/bin/sh
user_authorized_keys_file="/mnt/data/ssh/authorized_keys" # 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"
curl -sO https://raw.githubusercontent.com/fire1ce/UDM-Persistent-SSH-Keys/main/99-ssh-keys.sh curl -sO https://raw.githubusercontent.com/fire1ce/UDM-Persistent-SSH-Keys/main/99-ssh-keys.sh
mv 99-ssh-keys.sh /mnt/data/on_boot.d/99-ssh-keys.sh mv 99-ssh-keys.sh $DATA_DIR/on_boot.d/99-ssh-keys.sh
chmod +x /mnt/data/on_boot.d/99-ssh-keys.sh chmod +x $DATA_DIR/on_boot.d/99-ssh-keys.sh
echo "99-ssh-keys.sh installed" echo "99-ssh-keys.sh installed"
if [ ! -f "$user_authorized_keys_file" ]; then if [ ! -f "$user_authorized_keys_file" ]; then
echo "Creating $user_authorized_keys_file" echo "Creating $user_authorized_keys_file"
mkdir -p /mnt/data/ssh mkdir -p $DATA_DIR/ssh
touch "$user_authorized_keys_file" touch "$user_authorized_keys_file"
chmod 0644 "$user_authorized_keys_file" chmod 0644 "$user_authorized_keys_file"
fi fi