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

Improve automation: avoid opening GUI dialogs #70

Open
edrozenberg opened this issue Nov 12, 2016 · 12 comments
Open

Improve automation: avoid opening GUI dialogs #70

edrozenberg opened this issue Nov 12, 2016 · 12 comments

Comments

@edrozenberg
Copy link

I'm running mas over ssh to several machines to automate install of mas apps. Different machines may be signed into different mas accounts, and the apps each one has purchased may be different.

Currently attempting to install an app that's not "purchased" blocks the mas tool. Also not being logged in blocks the tool. Blocks in the sense a dialog would normally pop up when running locally on the machine, but remotely over ssh there is no way to interact with dialog boxes popped up by the Apple MAS app.

The following, which may or may not be possible, would make proper automation possible:

  • A command to have mas list all purchased (available apps) for the logged in user account
  • mas should return an error and quit if an app is not available (not purchased)
  • mas should return an error and quit if user is not logged into the store yet
@rodionovd
Copy link
Contributor

Thanks for your suggestions Eduard! I'll take a look whether it's possible to avoid blocking in these situations.

@edrozenberg
Copy link
Author

@rodionovd Thanks!

Another block scenario I ran into - for some apps (maybe all apps?), when the app is open/running, the Mac App Store GUI pops up a dialog to ask whether it's ok to close to app to be able to update it.

@rodionovd
Copy link
Contributor

Oh nice one! Will look into this too

@allansan
Copy link

allansan commented Nov 29, 2016

Observation: Running mas signin as root (only done for testing purposes on a VM!) seems to enable mas to run over SSH connections.

I was doing some testing using a launchd item to call a script locally to make things run, however I'd forgotten for a second that I'd put the launchd item in /Library/LaunchDaemons and therefore it wouldn't run as root. Just for a laugh I signed in as root and now mas is running over SSH..

[EDIT]
I have now tested this again having signed out of mas as root and moved the launchd item to the users local homeDir (~/Library/LaunchDaemons/) and re-run the script and I can confirm that this is also working. I'll have to reset the VM to test it continues to work without signing in as root.

@rodionovd
Copy link
Contributor

@allansan great insight, thanks! Will take that into account

@geerlingguy
Copy link

Another thing—could you maybe add some sort of signin status command that would return 0/success if signed in, or 1/error if not signed in? That way it could be used as a flag to let the automating software know whether or not to pop a prompt for login...

I'm using mas to finish the last piece of install automation via Ansible with my mac-dev-playbook project—see geerlingguy/mac-dev-playbook#11. Thanks so much for building/maintaining this!

@rodionovd
Copy link
Contributor

rodionovd commented Dec 7, 2016

Another thing—could you maybe add some sort of signin status command that would return 0/success if signed in, or 1/error if not signed in? That way it could be used as a flag to let the automating software know whether or not to pop a prompt for login...

@geerlingguy such a great idea! Would be awesome if you create a PR for this ⭐️(else I'll implement it myself at the weekend anyway)

@rodionovd
Copy link
Contributor

@geerlingguy I just realized you can actually use mas account command to figure out whether you're signed in or not: it will exit with1 if you're not currently signed in and with 0 if you are.

@geerlingguy
Copy link

geerlingguy commented Jan 17, 2017

@rodionovd - You're quite correct!

 21:24:00 ~ $ mas account
[email protected]
 21:24:04 ~ $ echo $?
0

 21:24:14 ~ $ mas account
Not signed in
Error: Not signed in

 21:24:18 ~ $ echo $?
1

It's adequate for my needs. Thanks!

@yustein
Copy link

yustein commented Apr 11, 2017

screenshot 2017-04-11 20 57 04

What do you guys recommend to interact with the GUI errors the app store gives? They can easily be bypassed by clicking a button but how do we do that in a script so that the app updates continue?

use case:

If you have an app purchased from another app store, the app store app will give an error but the error can be bypassed by simply clicking OK and the updates do continue.

One possibility is to mute the errors and another one is to use some advanced scripting to interact with the GUI prompts.

@aquintiliano
Copy link

@allansan I am not sure on what you did, but I am unable to run mas over SSH even using sudo mas signin... does it really work?

@phatblat phatblat added this to the 2.0 milestone Dec 27, 2018
@rgoldberg rgoldberg changed the title Suggestion - changes to improve automation Improve automation Sep 14, 2024
@rgoldberg rgoldberg changed the title Improve automation Improve automation: avoid opening GUI dialogs / list purchased apps (with filter for not installed ones) Sep 17, 2024
@rgoldberg rgoldberg changed the title Improve automation: avoid opening GUI dialogs / list purchased apps (with filter for not installed ones) Improve automation: avoid opening GUI dialogs Oct 13, 2024
@rgoldberg
Copy link
Contributor

Listing purchased apps split off into #567.

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

No branches or pull requests

8 participants