Code Monkey home page Code Monkey logo

installapplications's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

installapplications's Issues

No module named 'Foundation' on M1

Hi,

I'm testing the latest universal commits on M1 and I'm getting

Traceback (most recent call last):
  File "/Library/installapplications/installapplications.py", line 29, in <module>
    from Foundation import NSLog
ModuleNotFoundError: No module named 'Foundation'

Am I doing something wrong? If I install rosetta the 2.0.2 intel version works.

edit: 2.1 Alpha 1 also works so this might be only on the latest code.

add "preflight" check

IAs should have some method to check the device for pre-installation requirements, and if these are met, we just safely exit and move on.

This is useful for "dep nag" upgrades where the device already has all of the other tools installed and have no need to re-run them.

Including rootscript in IA package will break if url is present, but empty

Stumbled upon this issue. It is only a problem if you bundle stuff into a package.

If you are downloading resources from an URL this does not apply!

if you bundle a rootscript in the package you have to do the following:

a: Remove the "url" parameter, even if it is empty

or

b: Include the "url" AND the "hash" parameter

This will not work

  "preflight": [
    {
      "file": "/Library/installapplications/scripts/root/05-preflight.py",
      "name": "Preflight",
      "type": "rootscript",
      "url": ""
    }
  ]

This will work

  "preflight": [
    {
      "file": "/Library/installapplications/scripts/root/05-preflight.py",
      "name": "Preflight",
      "type": "rootscript"
    }
  ]

This will also work

  "preflight": [
    {
      "file": "/Library/installapplications/scripts/root/05-preflight.py",
      "name": "Preflight",
      "type": "rootscript",
      "url": "",
      "hash": "a_generated_256_hash_value"
    }
  ]

The issue is easily solved by removing empty hashes from your json, which probably is a good habit anyway.

The confusion arrives since sometimes its allow with an empty hash, like this: which also will work:

"setupassistant": [`
    {
      "file": "/Library/installapplications/packages/DEPNotify-1.1.5.signed.pkg",
      "hash": "a_generated_256_hash_value",
      "name": "DEPNotify",
      "packageid": "menu.nomad.DEPNotify",
      "type": "package",
      "url": "",
      "version": "1.1.5"
    }
  ]

It might also be that the use of generatejson.py does avoid this issue, but if you handcraft your json you have to be careful.

I think this issue is best solved by archiving this issue as part of documentation of a cornercase. I will also try to make a general addition to the documentation (as a PR) about avoiding empty hashes in your jsonfile, in case of handcrafting or copy/paste from other sources.

K

Big Sur compatibility

Things to test:

  • initial provisioning ✅
  • cleanup: ❌
  • user scripts: ✅
  • packages: ✅
  • root scripts: ✅

generatejson.py number of parser arguments incorrect?

Hello! Sorry if I missed something, but on line 237 of generatejson.py it says

parser.add_argument('--item', default=None, action='append', nargs=6,

but then the code proceeds to require 7 arguments:

item-name='A name'
item-path='A path'
item-stage='A stage'
item-type='A type'
item-url='A url'
script-do-not-wait='A boolean'
pkg-skip-if='A string'

which for me leads to ValueError("length of metavar tuple does not match nargs").

If I updated nargs=7, the code works as expected and generates bootstrap.json in the output directory.

Should that be fixed or am I missing something here?

infinite loop when userscript fails

if a userscript fails, installapplications doesn't remove the touch file, so you get into an infinite loop.

    if opts.userscript:
        iaslog('Running in userscript mode')
        uscript = runuserscript(iauserscriptpath)
        if uscript:
            os.remove(userscripttouchpath)
            sys.exit(0)
        else:
            iaslog('Failed to run script!')
            sys.exit(1)

should be

    if opts.userscript:
        iaslog('Running in userscript mode')
        uscript = runuserscript(iauserscriptpath)
        if uscript:
            os.remove(userscripttouchpath)
            sys.exit(0)
        else:
            iaslog('Failed to run script!')
            os.remove(userscripttouchpath)
            sys.exit(1)

Feature request: ability to have a custom-named bootstrap.json

Hey Erik -

Would it be possible to support bootstrap files that aren't named bootstrap.json? I'm looking to introduce multiple bootstrap pkgs in my environment, but as they'd share scripts/pkgs, I'd like to have multiple bootstrap.json files in the root directory of my IAs file share.

At the moment, I see the name bootstrap.json is hardcoded in installapplications.py (line 432) and generatejson.py (line 230). Even if I change /Library/LaunchDaemons/com.erikng.installapplications.plist to point to bootstrap_foo.json, it looks like I'll need to hardcode the new name in the other two scripts.

No worries if it's not something you'd like to support - just figured I'd ask before making those changes myself.

Thanks!

Mike

crashes when attempting to log events of userscripts running in setupassistant stage

Traceback (most recent call last):
  File "/Library/installapplications/installapplications.py", line 733, in <module>
    main()
  File "/Library/installapplications/installapplications.py", line 700, in main
    iaslog('Detected setupassistant and user script. '
  File "/Library/installapplications/installapplications.py", line 57, in iaslog
    NSLog('[InstallApplications] ' + text)
ValueError: Too few arguments for format string [cur:1/len:1]

stuck at depnotify launch

2020-05-14 19:53:01.309 Python[95:1258] [InstallApplications] Creating DEPNotify Launcher
2020-05-14 19:53:01.309 Python[95:1258] [InstallApplications] Launching DEPNotify with: depnotifycmd = ['/usr/bin/open', '/Applications/Utilities/DEPNotify.app', '--args', '-munki']
2020-05-14 19:53:01.322 Python[95:1258] [InstallApplications] Waiting for DEPNotify script to complete
2020-05-14 19:53:01.825 Python[95:1258] [InstallApplications] Waiting for DEPNotify script to complete
2020-05-14 19:53:02.326 Python[95:1258] [InstallApplications] Waiting for DEPNotify script to complete
2020-05-14 19:53:02.827 Python[95:1258] [InstallApplications] Waiting for DEPNotify script to complete
2020-05-14 19:53:03.340 Python[95:1258] [InstallApplications] Waiting for DEPNotify script to complete
2020-05-14 19:53:03.855 Python[95:1258] [InstallApplications] Waiting for DEPNotify script to complete
2020-05-14 19:53:04.394 Python[95:1258] [InstallApplications] Waiting for DEPNotify script to complete
2020-05-14 19:53:04.973 Python[95:1258] [InstallApplications] Waiting for DEPNotify script to complete

Error output not handled correctly

I managed to crash installapplications.py on this line:
https://github.com/erikng/installapplications/blob/bf4c5c39b25e157522ee227b2ecdb23137b9096a/payload/Library/Application%20Support/installapplications/installapplications.py#L227

Traceback (most recent call last):
  File "/Library/Application Support/installapplications/installapplications.py", line 730, in <module>
    main()
  File "/Library/Application Support/installapplications/installapplications.py", line 688, in main
    runrootscript(path, donotwait)
  File "/Library/Application Support/installapplications/installapplications.py", line 227, in runrootscript
    (pathname, err))
  File "/Library/Application Support/installapplications/installapplications.py", line 57, in iaslog
    NSLog('[InstallApplications] ' + text)
ValueError: Too few arguments for format string [cur:1/len:1]

pathname contained string.
err contained curl status output.

userland rootscript does not wait for userland

Currently code for checking if we are not in setupassistant is only in package installation if/else branch.

When there is no package in userland section of installapplications.json (only rootscripts), installapplications.py does not wait for user to log in. Rootscripts in userland section are executed during setup assistant as if they were in setupassistant section.

Is there a reason for this or should we improve the code?

I created PR #49 with simple change to deal with this. (I did not study entire installapplications.py source code).

InstallApplications silently fails with packages that are not universal if Rosetta is not installed

When installing packages that do not contain <options customize="never" require-scripts="false" hostArchitectures="x86_64,arm64"/> in their Distribution file, IAs attempts to install the package and silently fails. It thinks the install is successful.

Your provisioning process may then fail in weird ways. A second IAs run will likely work, because Rosetta is now installed (by another script you have)

Invalid Syntax

I'm trying to use this to create a bootstrap package and am running into a road block. Can anyone point me in the right direction? Using macOS 10.14.2 and tried in both python2 and python3.

Error in python3:
File "/Users/troyhite/Desktop/macOSBootstrap/PackageBuilds/installapplications-master/generatejson.py", line 60
print "Error: %s while extracting BOM for %s" % (err, filename)
^
SyntaxError: invalid syntax

Error in python2:
Traceback (most recent call last):
File "/Users/troyhite/Desktop/macOSBootstrap/PackageBuilds/installapplications-master/generatejson.py", line 256, in
main()
File "/Users/troyhite/Desktop/macOSBootstrap/PackageBuilds/installapplications-master/generatejson.py", line 115, in main
Scripts default to rootscript and stage defaults to userland')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1306, in add_argument
raise ValueError("length of metavar tuple does not match nargs")
ValueError: length of metavar tuple does not match nargs

Cleanup removes embedded Python before reboot command is issued

context

  • IA is running a bash root script in userland
  • Using master and embedded python
  • reboot command is issued and present in IA log w/o errors
  • [InstallApplications] Triggering reboot

workaround

  • issuing the same command via bash in the subprocess call works as expected
  • /sbin/shutdown -r now
  • have IA check for a installed item/sha and then exit 0 after restart
  • not ideal, hence workaround

further investigation

  • moved installapplications to Library
  • ran test.py to simply test the python reboot call
#!/Library/installapplications/Python.framework/Versions/3.8/bin/python3
...
subprocess.call(['/sbin/shutdown', '-r', 'now'])
...
  • that worked as expected

hypothesis

  • cleanup(0) being triggered prior to a reboot breaks embedded python
    cleanup(0)

    if reboot:
        iaslog('Triggering reboot')
        subprocess.call(['/sbin/shutdown', '-r', 'now'])
  • so calling the embedded python at /Library/installapplications/Python.framework/Versions/3.8/bin/python3 would fail
  • it doesn't exist, since we just cleaned it up
  • but this script is still in memory so it works?

JamfSchool MDM (listed in README.md) not InstallApplications capable

In the README.md file JamfSchool is listed as a supported MDM. Allthough in JamfSchool it is possible to configure automated device enrollment profiles there is no way to install a package during the enrollment process. I checked with JamfSchool support and they confirmed that at the moment they (unfortunately) don't offer the installation of packages during ADE. I suggest the removal of JamfSchool from the list until they implement this feature.

Reboot issues with macOS Sonoma

Is anyone else using the reboot functionality with IAs?

We're running an older build, and with IAs set to reboot at the end of bootstrapping, we're finding Macs running macOS Sonoma beta 7 do not reboot. IAs writes to the logs that the Mac is rebooting, then IAs cleans up after itself.

Here's the relevant code:

https://github.com/macadmins/installapplications/blob/main/payload/Library/installapplications/installapplications.py#L415-L419

Running /usr/bin/osascript -e delay 5 -e tell application "System Events" to restart manually doesn't seem to do anything on macOS Sonoma beta 7, either, so I don't think this is an IAs-specific issue.

Any objection to changing this to something like /sbin/shutdown -r now instead?

Any interest in supporting HTTP redirects?

Hello,

First off, thanks for this tool!

I was curious if this project would be interested in adding a --follow-redirects argument to enable InstallApplications to follow HTTP redirects? In my environment, when a request comes in to download a file or package, we return a 301 code and issue a pre-signed URL for the S3 object.

The code change would be pretty easy and I am happy to submit a PR for it, but wanted to ask first!

Example of current behavior:

Hash:

item = {'file': '/Users/myuser/1Password-7.6.pkg', 'hash': '7a9de7f6ab12d2ba2856fb2ba3a456ae332107e4e3120186d6ad9d2a598ea527', 'name': 'Preflight', 'type': 'package', 'url': 'https://frontend.corp.com/pkgs/apps/agilebits/1password/1Password-7.6.pkg'}

Logs from downloadfile(item) the redirect is denied:

2020-09-18 15:01:04.524 Python[95558:3678364] URLSession_task_didReceiveChallenge_completionHandler_
2020-09-18 15:01:04.525 Python[95558:3678364] Authentication challenge for Host: frontend.corp.com Realm: None AuthMethod: NSURLAuthenticationMethodServerTrust
2020-09-18 15:01:04.525 Python[95558:3678364] Allowing OS to handle authentication request
2020-09-18 15:01:04.539 Python[95558:3678357] [InstallApplications] Downloading Preflight - Percent complete: 0
2020-09-18 15:01:04.545 Python[95558:3678364] URLSession_task_didReceiveChallenge_completionHandler_
2020-09-18 15:01:04.545 Python[95558:3678364] Authentication challenge for Host: frontend.corp.com Realm: None AuthMethod: NSURLAuthenticationMethodClientCertificate
2020-09-18 15:01:04.545 Python[95558:3678364] Allowing OS to handle authentication request
2020-09-18 15:01:04.764 Python[95558:3678911] URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_
2020-09-18 15:01:04.765 Python[95558:3678911] Denying redirect to: https://foobucket.s3-us-west-1.amazonaws.com/pkgs/apps/agilebits/1password/1Password-7.6.pkg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=FOOBAR%FOOBAR%2Fus-west-1%2Fs3%2Faws4_request&X-Amz-Date=20200918T220104Z&X-Amz-Expires=3600&X-Amz-Security-Token=LongTokenString-Amz-Signature=ea04e009fdaaa00b28b4baffd0d2165a354aad8f0d18ad931b871bea522842e7&X-Amz-SignedHeaders=Host
2020-09-18 15:01:04.849 Python[95558:3678357] [InstallApplications] Status: 301

Patch the original dictionary with {'follow_redirects': True} along with some changes in the downloadfile() method:

item = {'file': '/Users/myuser/1Password-7.6.pkg', 'hash': '7a9de7f6ab12d2ba2856fb2ba3a456ae332107e4e3120186d6ad9d2a598ea527', 'name': 'Preflight', 'type': 'package', 'url': 'https://frontend.corp.com/pkgs/apps/agilebits/1password/1Password-7.6.pkg', 'follow_redirects': True}

Logs from downloadfile(item) the redirect is successful:

2020-09-18 14:22:24.145 Python[88440:3637137] URLSession_task_didReceiveChallenge_completionHandler_
2020-09-18 14:22:24.145 Python[88440:3637137] Authentication challenge for Host: frontend.corp.com Realm: None AuthMethod: NSURLAuthenticationMethodServerTrust
2020-09-18 14:22:24.145 Python[88440:3637137] Allowing OS to handle authentication request
2020-09-18 14:22:24.153 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 0
2020-09-18 14:22:24.182 Python[88440:3638257] URLSession_task_didReceiveChallenge_completionHandler_
2020-09-18 14:22:24.182 Python[88440:3638257] Authentication challenge for Host: frontend.corp.com Realm: None AuthMethod: NSURLAuthenticationMethodClientCertificate
2020-09-18 14:22:24.182 Python[88440:3638257] Allowing OS to handle authentication request
2020-09-18 14:22:24.394 Python[88440:3638257] URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_
2020-09-18 14:22:24.395 Python[88440:3638257] Allowing redirect to: https://foobucket.s3-us-west-1.amazonaws.com/pkgs/apps/agilebits/1password/1Password-7.6.pkg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=FOOBAR%FOOBAR%2Fus-west-1%2Fs3%2Faws4_request&X-Amz-Date=20200918T220104Z&X-Amz-Expires=3600&X-Amz-Security-Token=LongTokenString-Amz-Signature=ea04e009fdaaa00b28b4baffd0d2165a354aad8f0d18ad931b871bea522842e7&X-Amz-SignedHeaders=Host
2020-09-18 14:22:24.475 Python[88440:3637137] URLSession_task_didReceiveChallenge_completionHandler_
2020-09-18 14:22:24.475 Python[88440:3637137] Authentication challenge for Host: foobucket.s3-us-west-1.amazonaws.com Realm: None AuthMethod: NSURLAuthenticationMethodServerTrust
2020-09-18 14:22:24.475 Python[88440:3637137] Allowing OS to handle authentication request
2020-09-18 14:22:24.770 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 1
2020-09-18 14:22:24.871 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 4
2020-09-18 14:22:24.972 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 8
2020-09-18 14:22:25.074 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 12
2020-09-18 14:22:25.175 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 15
2020-09-18 14:22:25.276 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 20
2020-09-18 14:22:25.377 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 24
2020-09-18 14:22:25.479 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 29
2020-09-18 14:22:25.580 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 33
2020-09-18 14:22:25.681 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 38
2020-09-18 14:22:25.782 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 41
2020-09-18 14:22:25.882 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 46
2020-09-18 14:22:25.984 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 52
2020-09-18 14:22:26.085 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 57
2020-09-18 14:22:26.185 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 63
2020-09-18 14:22:26.286 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 68
2020-09-18 14:22:26.386 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 73
2020-09-18 14:22:26.487 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 78
2020-09-18 14:22:26.587 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 82
2020-09-18 14:22:26.688 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 86
2020-09-18 14:22:26.788 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 91
2020-09-18 14:22:26.889 Python[88440:3634301] [InstallApplications] Downloading Preflight - Percent complete: 96
2020-09-18 14:22:26.992 Python[88440:3634301] [InstallApplications] Status: 200
2020-09-18 14:22:26.993 Python[88440:3634301] [InstallApplications] Headers: {'Server': 'AmazonS3', 'Content-Type': 'application/octet-stream', 'Last-Modified': 'Wed, 08 Jul 2020 16:09:21 GMT', 'x-amz-request-id': 'BBED53A3E09ED17D', 'Date': 'Fri, 18 Sep 2020 21:22:25 GMT', 'Accept-Ranges': 'bytes', 'x-amz-id-2': 'k7fmSnIULrqlIarY4nLSuV1KANJ/Z4t49Vom0IYR1ezVnqAd0rDRhDcGfC7arLAUTn7Rjy3JANE=', 'x-amz-server-side-encryption': 'AES256', 'Content-Length': '57662381', 'Etag': '"def7a37969860e734b57bdea8d7c39c4-7"'}

NSLog doesn't handle certain URLs

When passed a url like the following (https://chefitpublic.file.core.windows.net/chefdeploy/bootstrap.json?sv=2017-04-17&ss=f&srt=so&sp=rl&se=2018-11-28T23:56:02Z&st=2017-11-28T15:56:02Z&spr=https&sig=b8%2FgLAzKtyHGTes0fe5SyWlIqs5p2ucUtLOmwBgW2a4%3D) Lines 278 and 446 will break with the following error:

  File "/Library/Application Support/installapplications/installapplications.py", line 654, in <module>
    main()
  File "/Library/Application Support/installapplications/installapplications.py", line 446, in main
    iaslog('Starting download: %s' % (json_data['url']))
  File "/Library/Application Support/installapplications/installapplications.py", line 56, in iaslog
    NSLog('[InstallApplications] ' + text)
ValueError: Too few arguments for format string [cur:1/len:1]

Reported by John McCrae

Sunsetting DEPNotify integration

I'd like to sunset DEPNotify integration for a few reasons:

  1. There are a few edge cases
  2. Not every command is supported
  3. I had to make assumptions that an admin may disagree with
  4. There are now multiple flavors of "DEPNotify" that I have no intention of supporting.

If you object with this, please comment and we can discuss. I will leave this open for a week or two and then pull the integration, unless I am convinced otherwise.

In place will be some example scripts that an admin can use and recommended approaches for the JSON.

installapplications doesn't fail gracefully when the [preflight] tag is missing from the json

My json file was created using generatejson.py - which doesn't automatically include a [preflight] tag. When installapplications runs - it can pull down my json file, then crashes out...

Traceback (most recent call last):
File "/Library/Application Support/installapplications/installapplications.py", line 707, in
main()
File "/Library/Application Support/installapplications/installapplications.py", line 587, in main
for item in iajson[stage]:
KeyError: 'preflight'

If a user script fails, InstallApplications should stop running

if root scripts fail multiple times, the run will stop, however if a user script fails, the run will keep going.

This is could be problematic for environments that need the user section to complete successfully. With 5218c96 I fixed the infinite looping when not exiting 0, but introduced this issue.

This will be a difficult one to solve since the user side runs in a different process and we cannot capture the state of the run itself.

Help Troubleshooting M1 with embedded python

Hi *,

I am trying to run the 2.0.3 IA Version on an M1 MacBook Pro. Also embedded the Python.framework as it was in the release notes.

First error which occured:

2021-07-29 05:34:28.236 Python[859:8814] [InstallApplications] Running Script: /Library/installapplications/preflight.py 
2021-07-29 05:34:28.242 Python[859:8814] [InstallApplications] Failure running script:
Traceback (most recent call last):
  File "/Library/installapplications/installapplications.py", line 220, in runrootscript
    proc = subprocess.Popen(pathname, stdout=subprocess.PIPE,
  File "/Library/installapplications/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 947, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Library/installapplications/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1819, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/Library/installapplications/preflight.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/installapplications/installapplications.py", line 615, in <module>
    main()
  File "/Library/installapplications/installapplications.py", line 584, in main
    preflightrun = runrootscript(path, donotwait)
  File "/Library/installapplications/installapplications.py", line 234, in runrootscript
    iaslog(str(err.decode('utf-8')))
AttributeError: 'FileNotFoundError' object has no attribute 'decode'

After fixing this decode error, no root script is running anymore and more and more errors are occuring:

2021-07-29 05:36:39.266 Python[924:9910] [InstallApplications] Beginning preflight
2021-07-29 05:36:39.266 Python[924:9910] [InstallApplications] preflight processing rootscript Preflight at /Library/installapplications/preflight.py
2021-07-29 05:36:39.266 Python[924:9910] [InstallApplications] Starting root script: /Library/installapplications/preflight.py
2021-07-29 05:36:39.266 Python[924:9910] [InstallApplications] Running Script: /Library/installapplications/preflight.py 
2021-07-29 05:36:39.271 Python[924:9910] [InstallApplications] Failure running script:
2021-07-29 05:36:39.271 Python[924:9910] [InstallApplications] [Errno 2] No such file or directory: '/Library/installapplications/preflight.py'
2021-07-29 05:36:39.272 Python[924:9910] [InstallApplications] Preflight did not pass all checks. Continuing run.
2021-07-29 05:36:39.272 Python[924:9910] [InstallApplications] Beginning setupassistant
2021-07-29 05:36:39.272 Python[924:9910] [InstallApplications] setupassistant processing package DEPNotify at /Library/installapplications/DEPNotify-1.1.6.pkg
2021-07-29 05:36:39.298 Python[924:9910] [InstallApplications] Installing DEPNotify from /Library/installapplications/DEPNotify-1.1.6.pkg
2021-07-29 05:36:43.077 Python[924:9910] [InstallApplications] setupassistant processing rootscript DEPNotify Customization at /Library/installapplications/depnotify_customization.py
2021-07-29 05:36:43.078 Python[924:9910] [InstallApplications] Starting root script: /Library/installapplications/depnotify_customization.py
2021-07-29 05:36:43.078 Python[924:9910] [InstallApplications] Running Script: /Library/installapplications/depnotify_customization.py 
2021-07-29 05:36:43.080 Python[924:9910] [InstallApplications] Failure running script:
2021-07-29 05:36:43.080 Python[924:9910] [InstallApplications] [Errno 2] No such file or directory: '/Library/installapplications/depnotify_customization.py'
2021-07-29 05:36:43.080 Python[924:9910] [InstallApplications] Beginning userland
2021-07-29 05:36:43.080 Python[924:9910] [InstallApplications] userland processing userscript DEPNotify User Launcher at /Library/installapplications/userscripts/depnotify_user_launcher.py

Funny thing is: All files are in the place they are, don't know why it can not find them. Checked that with:

cat /Library/installapplications/preflight.py
cat /Library/installapplications/depnotify_customization.py 

Does anybody have a hint for me what I can do? Also the logs are not in the log files under /var/log/installapplications ... those files are all empty....

Delete bootstrap.json if it exists

Prior to downloading the bootstrap.json file, we should check if one already exists and delete it.

This is for cases where installapplications has failed (say network timeout) and then tries to restart later, but the admin has updated the packages/scripts.

When this happens, the hash validation fails, causing installapplications to repeatedly fail.

Microsoft Intune MDM Compatibility

I've successfully used installapplications with Microsoft Intune. I know there are some caveats, is it worth noting in the Wiki? Our school gets it free so we have to use it over one of the other MDMs.

Including userscript in IA package will not work

Hi,

Not sure if it should be a priority to do anything with this, or just add as a NB to the documentation.

This will not work, scenario 1:

    {
      "file": "/Library/installapplications/userscripts/depnotify_user_launcher.py",
      "hash": "sha256_hash_goes_here",
      "name": "DEPNotify User Launcher",
      "type": "userscript"
    }

This will work, scenario 2:

  {
      "file": "/Library/installapplications/userscripts/depnotify_user_launcher.py",
      "hash": "sha256_hash_goes_here",
      "name": "DEPNotify User Launcher",
      "type": "userscript",
      "url": "https://raw.githubusercontent.com/erikng/installapplicationsdemo/master/installapplications/scripts/user/depnotify_user_launcher.py"
    }

The difference is that in scenario 1, everything is included in the InstallApplication.pkg, in scenario 2, it is downloaded from the Internet.

In scenario 1, the userscripts folder does exist at the time installapplications.py is checking for existance of needed folders (lines: 474-479), which will bypass the creation of the folder /var/tmp/installapplications (which again is needed for /var/tmp/installapplications/.userscript).

K

Unable to install at setup assistant

This is my first attempt at using this installer, with an MDM that does support Custom DEP (Mosyle Manager). The package gets queued to install from the MDM server immediately after enrollment:

2018-08-14 06:37:39.165148-0700 0x1a2e     Default     0x0                  478    0    mdmclient: [com.apple.ManagedClient:MDMDaemon] Processing server request: InstallApplication  for: <Device>
2018-08-14 06:37:39.174197-0700 0x1a2e     Default     0x0                  478    0    mdmclient: [com.apple.ManagedClient:InstallApplication] Scheduled InstallApplication from: https://cdnmanager.mosyle.com/assets/sch_5134_4.plist

But then storedownloadd fails to install the package without any error message:

2018-08-14 06:37:40.248862-0700 0x1b6c     Default     0x0                  494    0    storedownloadd: (StoreFoundation) [com.apple.commerce:CKLegacy] DownloadManifest: removePurgeablePath: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/com.apple.appstore/0
2018-08-14 06:37:40.249055-0700 0x1b6c     Default     0x0                  494    0    storedownloadd: (StoreFoundation) [com.apple.commerce:CKLegacy] sending status (Install Applications): 0.000000% (0.000000)
2018-08-14 06:37:40.249440-0700 0x1b6c     Default     0x0                  494    0    storedownloadd: (StoreFoundation) [com.apple.commerce:CKLegacy] LegacyDownloadQueue: Could not add download

My package is signed with a Developer ID Installer certificate and installs just fine outside of this context. Am I missing something? Are there any further log messages I haven't found that would explain the failure? Hoping those with more experience here can help.

build-info.json:

{
    "distribution_style": true,
    "identifier": "com.erikng.installapplications",
    "install_location": "/",
    "name": "InstallApplications-${version}.pkg",
    "ownership": "recommended",
    "postinstall_action": "none",
    "signing_info": {
        "identity": "Developer ID Installer: Joseph Rafferty (T25F96MSWH)",
        "timestamp": true
    },
    "suppress_bundle_relocation": true,
    "version": "2018.08.13.1"
}

Add documentation around plutil

If user's are experiencing issues with the launchdaemon not loading, it could be due to improper tags in their plist.

We should add plutil -lint /path/to/LaunchDaemon.plist as part of the troubleshooting steps.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.