unifi-utilities / unifios-utilities

A collection of enhancements for UnifiOS based devices
GNU General Public License v3.0
3.86k stars 415 forks source link

Unable to use either SSH scripts on 2.5x due to `let` missing #497

Closed johntdyer closed 1 year ago

johntdyer commented 1 year ago

Describe the bug Any script w/ Less is no longer working and in the other one dropbear does not working

To Reproduce Steps to reproduce the behavior:

  1. goto /boot/on.boot.d
  2. wget https://raw.githubusercontent.com/unifi-utilities/unifios-utilities/30d5f7b21bab9117d78ff6ed5dc50d3e443b7213/on-boot-script-2.x/examples/udm-files/on_boot.d/15-add-github-ssh-keys.sh
  3. chmod +x 15-add-github-ssh-keys.sh
  4. fail
    root@UDMPRO:/data/on_boot.d# ./15-add-github-ssh-keys.sh
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
    100  1106  100  1106    0     0   9993      0 --:--:-- --:--:-- --:--:-- 10054
    Downloaded keys from Github
    ./15-add-github-ssh-keys.sh: 65: ./15-add-github-ssh-keys.sh: let: not found
    ./15-add-github-ssh-keys.sh: 65: ./15-add-github-ssh-keys.sh: let: not found
    0 number of entries read from
    0 number of entries read from
    root@UDMPRO:/data/on_boot.d#

or

root@UDMPRO:/data# ./on_boot.d/99-add-ssh-keys.sh
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
./on_boot.d/99-add-ssh-keys.sh: 32: ./on_boot.d/99-add-ssh-keys.sh: let: not found
0 keys added to /root/.ssh/authorized_keys
Converting SSH private key to dropbear format
./on_boot.d/99-add-ssh-keys.sh: 43: ./on_boot.d/99-add-ssh-keys.sh: dropbearconvert: not found
root@UDMPRO:/data#

Expected behavior Either script to work

Screenshots n/a

UDM Information

Additional context Add any other context about the problem here.

kb9gxk commented 1 year ago

The script needs to be modified by replacing #!/bin/sh with #!/bin/bash

boostchicken commented 1 year ago

https://github.com/unifi-utilities/unifios-utilities/pull/499

boostchicken commented 1 year ago

close since my pr will fix this