pluveto/flydav

Compatibility issues (?) in installer script

Opened this issue · 4 comments

kemege commented

When I run

curl -sL https://raw.githubusercontent.com/pluveto/flydav/main/scripts/installer.sh | sudo bash

in Debian 11.6, I got the following error:

bash: line 129: ARCH: command not found

It turns out that bash identifies the ARCH in $(ARCH) in Line 129 as a command, and changing it to $ARCH seems to resolve the problem.

I'm not quite familiar with bash, but as this script has existed for a long time, perhaps this bug is specific to some new version of bash?

Try the new version

kemege commented

Thank you for your quick response!
The previous problem has been resolved. However, I found another problem when using the command in README.
When I use curl to download the script, and use "sudo bash" to run it, everything is fine.
However, if I use pipe to run the script, like curl -sL ... | sudo bash, all the places that require user input are skipped automatically, and the script will exit with error. The output will be like this:

$ curl -sL https://raw.githubusercontent.com/pluveto/flydav/main/scripts/installer.sh | sudo bash
Getting latest release from https://api.github.com/repos/pluveto/flydavDownloading flydav v0.2.46 from https://github.com/pluveto/flydav/releases/download/v0.2.46/flydav-app-linux-amd64.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:-  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:-  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  3 4518k    3  159k    0     0   135k      0  0:00:33  0:00:01  0:00:3100 4518k  100 4518k    0     0  2458k      0  0:00:01  0:00:01 --:--:-- 6594k
Downloaded flydav to /tmp/flydav_install/flydav.zip
Archive:  /tmp/flydav_install/flydav.zip
   creating: /tmp/flydav_install/dist/linux_amd64/
  inflating: /tmp/flydav_install/dist/linux_amd64/flydav
Configuration file /etc/flydav/flydav.toml already exists.
Do you want to keep it? (y/n)
Installing binary
Creating user flydav
Creating directory
mkdir: cannot create directory ‘’: No such file or directory
Failed to run mkdir -p

I think we can download the installer and execute it manually.

curl -sL "https://raw.githubusercontent.com/pluveto/flydav/main/scripts/installer.sh" -o /tmp/flydav-installer.sh
sudo chmod +x /tmp/flydav-installer.sh
sudo bash
sudo rm -f /tmp/flydav-installer.sh