Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional versioned server file checker #5172

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

yangfl
Copy link
Contributor

@yangfl yangfl commented Aug 6, 2024

If users have downloaded prebuilt server file, they may forget to update the server file simply because they are all named "scrcpy-server". It is already known to cause issues when server and client versions mismatch. Let it check for "scrcpy-server-v" first (just as how it is named in Github release page), then fall back to "scrcpy-server".

This mechanism is fully optional: users may still use the old unversioned name "scrcpy-server"; or they can directly download server file from release page without renaming it, and they will be notified to update their server file because client cannot find either files (with the correct version).

If users have downloaded prebuilt server file, they may forget to update
the server file simply because they are all named "scrcpy-server". It is
already known to cause issues when server and client versions mismatch.
Let it check for "scrcpy-server-v<VERSION>" first (just as how it is
named in Github release page), then fall back to "scrcpy-server".

This mechanism is fully optional: users may still use the old unversioned
name "scrcpy-server"; or they can directly download server file from
release page without renaming it, and they will be notified to update
their server file because client cannot find either files (with the
correct version).
@rom1v
Copy link
Collaborator

rom1v commented Aug 6, 2024

I am not keen on checking several filenames for the server.

I'm not sure to understand why you need this: this code is for the case #ifdef PORTABLE (i.e. in practice only for Windows, where there is no problem anyway), which should not be the case for your Debian package, isn't it?

For downloading a separate server binary (#5171 (comment)), could you include a script in your package, similar to install_release.sh, but which would only download the server for the expected version and save it to /usr/share/scrcpy-server?

For example, something like this (to be installed to /usr/bin/scrcpy-update-server, to be exected after a package upgrade):

#!/usr/bin/env bash
set -e

VERSION=2.6.1
PREBUILT_SERVER_URL="https://github.com/Genymobile/scrcpy/releases/download/v$VERSION/scrcpy-server-v$VERSION"
PREBUILT_SERVER_SHA256=ca7ab50b2e25a0e5af7599c30383e365983fa5b808e65ce2e1c1bba5bfe8dc3b

if echo "$PREBUILT_SERVER_SHA256  /usr/bin/scrcpy-server" | sha256sum --check
then
    echo "[scrcpy] Server $VERSION already up to date"
    exit 0
fi

echo "[scrcpy] Downloading prebuilt server..."
wget "$PREBUILT_SERVER_URL" -O scrcpy-server  # adapt to use some temporary directory
echo "[scrcpy] Verifying prebuilt server..."
echo "$PREBUILT_SERVER_SHA256  scrcpy-server" | sha256sum --check

sudo cp scrcpy-server /usr/share/
echo "[scrcpy] Server $VERSION installed"

@yangfl
Copy link
Contributor Author

yangfl commented Aug 6, 2024

My proposed Debian update does use PORTABLE build.

However, I'd like to make generalized feature proposals for all potential users, and in this case, non-Windows users may accidentally use mismatched server if they copy self-built client everywhere. This version checker helps to prevent this event. For Windows build I'd keep current behavior intact.

@rom1v
Copy link
Collaborator

rom1v commented Aug 6, 2024

My proposed Debian update does use PORTABLE build.

Why? The purpose of portable is basically to put scrcpy-server in the same directory as scrcpy (whichever it is). But your package will still install scrcpy it to /usr/bin/, right?

@acbits
Copy link

acbits commented Aug 6, 2024

If users have downloaded prebuilt server file, they may forget to update the server file simply because they are all named "scrcpy-server". It is already known to cause issues when server and client versions mismatch. Let it check for "scrcpy-server-v" first (just as how it is named in Github release page), then fall back to "scrcpy-server".

This mechanism is fully optional: users may still use the old unversioned name "scrcpy-server"; or they can directly download server file from release page without renaming it, and they will be notified to update their server file because client cannot find either files (with the correct version).

I just hit this bug. I tried to build 2.6.1, but the version is still pointing to 2.6, so scrcpy refused to start.

Looks like it needs to be retagged?

git diff v2.6.1 -- install_relase.sh shows the required update.

I built it by running git checkout v2.6.1; ./install_relase.sh. I hope that is the correct way?

@rom1v
Copy link
Collaborator

rom1v commented Aug 6, 2024

The correct way currently is to always execute ./install_release.sh from the master branch.

The other valid way is to checkout the tag v2.6.1-install-release.

Also see #4098 (comment).

@acbits
Copy link

acbits commented Aug 6, 2024

The correct way currently is to always execute ./install_release.sh from the master branch.

The other valid way is to checkout the tag v2.6.1-install-release.

Also see #4098 (comment).

Thanks. I was not familiar with tag naming conventions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants