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

shouldn't require admin permissions on macOS #373

Closed
coolaj86 opened this issue Dec 5, 2021 · 4 comments · Fixed by #496
Closed

shouldn't require admin permissions on macOS #373

coolaj86 opened this issue Dec 5, 2021 · 4 comments · Fixed by #496

Comments

@coolaj86
Copy link

coolaj86 commented Dec 5, 2021

The plugin has an unsigned pkg file that installs administrator privileges to install into a system location:

/Library/Application\ Support/obs-studio/plugins/advanced-scene-switcher/

However, it all that needs to happen is to copy into the user's home directory:

~/Library/Application\ Support/obs-studio/plugins/advanced-scene-switcher/

Related to: #21

Solution B (install.sh.zip)

The thing that would require the least work would be to include an install script that uses the existing pkg without requiring admin permissions:

~/Downloads/SceneSwitcher/MacOs/install.sh

(I've tested this to confirm that it'll work if double-clicked on from the same location as the current .pkg)

#!/bin/bash
set -e
set -u

echo "OBS Advanced Scene Switcher Installer"
my_dir="$(dirname "${0}")"
rm -rf "${my_dir}/install.log"

echo "Install location: ${my_dir}/" | tee -a "${my_dir}/install.log"
my_tmp="$(mktemp -d -t "advanced-scene-switcher.XXXXXXXXXX")"
rm -rf "${my_tmp}"

echo "Extracting to ${my_tmp}/" | tee -a "${my_dir}/install.log"
pkgutil --expand-full "${my_dir}/SceneSwitcher.pkg" "${my_tmp}"

echo "Copying to ~/Library/Application\ Support/obs-studio/plugins/advanced-scene-switcher/" |
    tee -a "${my_dir}/install.log"
rsync -avhP \
    "${my_tmp}"/Payload/Library/Application\ Support/obs-studio/plugins/advanced-scene-switcher/ \
    ~/Library/Application\ Support/obs-studio/plugins/advanced-scene-switcher/

echo 'Success' | tee -a "${my_dir}/install.log"
exit 0

Solution A

Ideally, the install should be this simple - no unsigned pkg, no unknown developer warnings, no admin permissions:

macOS/install.sh:

#!/bin/bash
set -e
set -u

my_dir="$(dirname "${0}")"
rsync -avhP "${my_dir}/" ~/Library/Application\ Support/obs-studio/plugins/advanced-scene-switcher/

And the file structure would look like this:

~/Downloads/SceneSwitcher/macOS/
├── install.sh
├── bin
│  ├── advanced-scene-switcher.so
│  ├── libopencv_calib3d.4.5.3.dylib
│  ├── libopencv_calib3d.4.5.dylib ⇒ libopencv_calib3d.4.5.3.dylib
│  ├── libopencv_calib3d.dylib ⇒ libopencv_calib3d.4.5.dylib
│  ├── libopencv_core.4.5.3.dylib
│  ├── libopencv_core.4.5.dylib ⇒ libopencv_core.4.5.3.dylib
│  ├── libopencv_core.dylib ⇒ libopencv_core.4.5.dylib
│  ├── libopencv_features2d.4.5.3.dylib
│  ├── libopencv_features2d.4.5.dylib ⇒ libopencv_features2d.4.5.3.dylib
│  ├── libopencv_features2d.dylib ⇒ libopencv_features2d.4.5.dylib
│  ├── libopencv_flann.4.5.3.dylib
│  ├── libopencv_flann.4.5.dylib ⇒ libopencv_flann.4.5.3.dylib
│  ├── libopencv_flann.dylib ⇒ libopencv_flann.4.5.dylib
│  ├── libopencv_imgproc.4.5.3.dylib
│  ├── libopencv_imgproc.4.5.dylib ⇒ libopencv_imgproc.4.5.3.dylib
│  ├── libopencv_imgproc.dylib ⇒ libopencv_imgproc.4.5.dylib
│  ├── libopencv_objdetect.4.5.3.dylib
│  ├── libopencv_objdetect.4.5.dylib ⇒ libopencv_objdetect.4.5.3.dylib
│  └── libopencv_objdetect.dylib ⇒ libopencv_objdetect.4.5.dylib
└── data
   ├── locale
   │  ├── de-DE.ini
   │  ├── en-US.ini
   │  ├── ru-RU.ini
   │  └── zh-CN.ini
   └── res
      ├── cascadeClassifiers
      │  ├── haarcascade_eye.xml
      │  ├── haarcascade_eye_tree_eyeglasses.xml
      │  ├── haarcascade_frontalface_alt.xml
      │  ├── haarcascade_frontalface_alt2.xml
      │  ├── haarcascade_frontalface_alt_tree.xml
      │  ├── haarcascade_frontalface_default.xml
      │  ├── haarcascade_fullbody.xml
      │  ├── haarcascade_lefteye_2splits.xml
      │  ├── haarcascade_lowerbody.xml
      │  ├── haarcascade_profileface.xml
      │  ├── haarcascade_righteye_2splits.xml
      │  └── haarcascade_upperbody.xml
      └── time.svg
@WarmUpTill
Copy link
Owner

Thanks for the hint!

Unfortunately I don't know of a good way of switching to this new path without risking having the plugin installed twice for users which used previous versions of the plugin.

Are you familiar with a way how this could be handled in the pkg file?

I think most users are not familiar with how to execute a shell script so I am not sure if would really be an alternative to the installer.
But in general I am not against additionally providing shell scripts for users who prefer this method of installing the plugin.
(The same point as above applies although one could easily work around this in the shell script)

@coolaj86
Copy link
Author

coolaj86 commented Dec 7, 2021

Unfortunately I don't know of a good way of switching to this new path without risking having the plugin installed twice for users which used previous versions of the plugin.

I could just add a few lines to the script to handle that case

mkdir -p /Library/Application\ Support/obs-studio/plugins/advanced-scene-switcher/
if [[ -d /Library/Application\ Support/obs-studio/plugins/advanced-scene-switcher/ ]]; then
    rsync -avhP --no-owner --no-group /Library/Application\ Support/obs-studio/plugins/advanced-scene-switcher/ ~/Library/Application\ Support/obs-studio/plugins/advanced-scene-switcher/
    rm -rf /Library/Application\ Support/obs-studio/plugins/advanced-scene-switcher/
fi

Are you familiar with a way how this could be handled in the pkg file?

I think .pkg files are intended for things that require system permissions - such as hardware drivers and emulated hardware drivers.

I don't know if there's a user-safe way to create a pkg, but I'll look into it.

I think most users are not familiar with how to execute a shell script

All you have to do is double click.

In fact, I think I could rename it to Install SceneSwitcher.app and add an alert to the script that says "Installed." when it's done.

I am not against additionally providing shell scripts for users who prefer this method of installing

I think adding the script as an additional method would be a great first step. And maybe a README.txt:

How to Install
==========

Double click `install.sh`.

`install.sh` will install to your user Library folder without requiring admin permissions or modifying you system volume.

If you'd prefer to install to the system Library folder, double-click the SceneSwitcher.pkg.

@WarmUpTill
Copy link
Owner

I think .pkg files are intended for things that require system permissions - such as hardware drivers and emulated hardware drivers.
I don't know if there's a user-safe way to create a pkg, but I'll look into it.

That would be much appreciated - thanks! :)

All you have to do is double click.
In fact, I think I could rename it to Install SceneSwitcher.app and add an alert to the script that says "Installed." when it's done.

I am not sure if it is just an issue with my VM but double clicking *.sh files only seems to open the "TextEdit" application and adjusting the extension to *.app followed by a double click does not seem to have any effect.
(Sorry if I am missing something obvious - I am not very familiar with MacOS)

@WarmUpTill WarmUpTill linked a pull request Aug 13, 2022 that will close this issue
Merged
@WarmUpTill
Copy link
Owner

WarmUpTill commented Aug 14, 2022

In preparation to support OBS 28 the build system was adjusted to create installers which no longer require admin permissions on MacOS.

A build should be available here in a few minutes:
https://github.com/WarmUpTill/SceneSwitcher/actions/runs/2853883417

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 a pull request may close this issue.

2 participants