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

Update Windows installation script #503

Merged
merged 3 commits into from
Jan 7, 2023
Merged

Update Windows installation script #503

merged 3 commits into from
Jan 7, 2023

Conversation

longzheng
Copy link
Contributor

@longzheng longzheng commented Jan 7, 2023

After merging, can simplify the installation instructions at https://github.com/koush/scrypted/wiki/Installation:-Windows to remove the dependency on winget

We can also simplify the uninstallation instructions at https://github.com/koush/scrypted/wiki/Uninstallation#windows to use sc.exe directly which avoids the dependency on node-windows

sc.exe stop scrypted.exe
sc.exe delete scrypted.exe

Comment on lines 47 to 64

svc.on('alreadyuninstalled', () => {
svc.install();
});

svc.on('uninstall', () => {
svc.install();
});

svc.on('error', () => {
svc.install();
});

svc.on('install', () => {
svc.start();
console.log("Service installed");
});

svc.uninstall();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this quite redundant so simplified, not sure if there was a reason for all the other event listeners.

Copy link
Owner

@koush koush Jan 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code would trigger an install after uninstalling it, or attempting, first. The intention is to make sure the service script can update itself. I think this portion should be reverted as it allows service changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok. There seems to be a bug or something with node-windows uninstall at the moment that causes an exception coreybutler/node-windows#324 even though the service is successfully uninstalled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah figured out a workaround.

@koush
Copy link
Owner

koush commented Jan 7, 2023

I’m not familiar with chocolates, but seems fine as long as that dependency is soft installed.

@longzheng
Copy link
Contributor Author

I’m not familiar with chocolates, but seems fine as long as that dependency is soft installed.

Yeah chocolatey and winget are very similar, chocolatey has a bit more mature.

@koush
Copy link
Owner

koush commented Jan 7, 2023

Change ready to go then?

@longzheng
Copy link
Contributor Author

Yep I've tested the latest script using a new Windows Sandbox and it's one click to get the server running now 😇

@koush koush merged commit 828698e into koush:main Jan 7, 2023
@koush
Copy link
Owner

koush commented Jan 7, 2023

I updated the uninstallation instructions. It doesn't need a full path to the scrypted.exe?

@longzheng
Copy link
Contributor Author

longzheng commented Jan 7, 2023

I updated the uninstallation instructions. It doesn't need a full path to the scrypted.exe?

No because scrypted.exe is actually the ID name of the generated service by node-windows.

Even though we specify the name parameter, that's actually the display name which is not used by sc.exe to stop or delete.


SERVICE_NAME: scrypted.exe
DISPLAY_NAME: Scrypted
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 4  RUNNING
                                (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

@longzheng longzheng deleted the patch-1 branch January 7, 2023 21:17
nberardi pushed a commit to nberardi/scrypted that referenced this pull request Feb 24, 2023
* Update Windows installation script

* Fix sc.exe

* Workaround node-windows quirks with uninstall and start
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.

Windows installation script windows-build-tools no longer required?
2 participants