Giter Site home page Giter Site logo

scripts's Introduction

Clayton's scripts

These are scripts that I have collected from the internet or put together myself.

What do these files do

Most of these files are pretty self explanatory based off file name or the comments within the script. Most scripts will have header information giving credit/source of the file if not created by me.

All files provided as is. You run it. You break it. You fix it. I hold no responsibility.

Makefile

Some directories will have a Makefile for creating packages. I currently am using two types of Makefiles, 'native' and luggage. To verify which Makefile I am using open the file and look for include /usr/local/share/luggage/luggage.make if that line is present you will need to install luggage. Other Makefiles would be considered 'native' and use Apple's built in command line tools to create packages.

Command line tools

Command line tools will need to be installed for some of the items in this repo to work.

xcode-select --install

Shortcuts:

Run Power.sh

curl -fsSL https://raw.githubusercontent.com/clburlison/scripts/master/clburlison_scripts/power_info/power.sh | sh

scripts's People

Contributors

clburlison avatar

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

scripts's Issues

AttributeError with Munki 3.3.0.3515

Script was perviously working under Munki 2. Now I receive the following error when trying to run against my latest Munki instance:

Traceback (most recent call last):
File "munkiimport_logic_audio.py", line 205, in
main()
File "munkiimport_logic_audio.py", line 147, in main
munkiimport.repoAvailable = munkiimport.repo_available
AttributeError: 'module' object has no attribute 'repo_available'

Is there any plan to resolve this issue? Can you recommend a work-a-around?

Thank you for your time,
DC

New LS Enable method

Use the following

sudo -u _locationd /usr/bin/defaults -currentHost write com.apple.locationd LocationServicesEnabled -bool TRUE

in place of

def sysprefs_boxchk():
"""Enables location services in sysprefs globally."""
uuid = get_hardware_uuid()
prefdir = "/private/var/db/locationd/Library/Preferences/ByHost/"
if not os.path.exists(prefdir):
os.makedirs(prefdir)
das_plist = ("/private/var/db/locationd/Library/Preferences"
"/ByHost/com.apple.locationd.{0}.plist".format(uuid.strip()))
bkup_plist = ("/private/var/db/locationd/Library/Preferences"
"/ByHost/com.apple.locationd.notbackedup.{0}.plist".format(
uuid.strip()))
# Use the offical Apple API for determining location services status
ls_status = CLLocationManager.locationServicesEnabled()
if ls_status is not True:
service_handler('unload')
cmd = ['/usr/bin/defaults', 'write', das_plist,
'LocationServicesEnabled', '-int', '1']
subprocess.check_output(cmd)
os.chown(das_plist, 205, 205)
# 10.12 created a new 'notbackedup' file and although changing it
# is not necessary, we are making the change so it matches Apple's
# implementation.
if int(os_vers()) >= 12:
cmd = ['/usr/bin/defaults', 'write', bkup_plist,
'LocationServicesEnabled', '-int', '1']
subprocess.check_output(cmd)
os.chown(bkup_plist, 205, 205)
service_handler('load')

This removes the need to kill the locationd daemon. It might make other things place nicer as well.

Indentation Change

For clburlison_scripts/LogicProX/munkiimport_logic_audio.py.

Please update incorrect indentation on lines 139 and 141 which result in
the following error. “IndentationError: unindent does not match any outer indentation
level”. Should match indentation on lines 128 and 134 respectively.

LSAutoTimeZone.py Not triggering TimeZone lookup in 10.13.4b

As is, the script errors on line 140 result = pref._startAutoTimeZoneDaemon_(0x1). The error is AttributeError: 'TimeZonePref' object has no attribute '_startAutoTimeZoneDaemon_'.

Changing that to result = pref.startService() allows the script to complete, but it then exits with Automatic Time Zone was not enabled or your machine doesn't support properly this functionality.

Location Services is enabled and Setting Time Zone is enabled in the Privacy panel, but the checkbox in Date & Time -> Time Zone is not checked the look up doesn't happen. Also due to exiting on the not enabled message means that NTP is not configured if un-commented.
This was tested in 17E160g and 17E182a.

LSAutoTimeZone.py might not be 10.12 friendly

Have a report that LSAutoTimeZone.py isn't working to nicely on 10.12 (Sierra).

I'll try and verify/fix if I can come up with something. Evidently it's the timezone_lookup() function.

def timezone_lookup():
"""Force a timezone lookup right now"""
TZPP = NSBundle.bundleWithPath_("/System/Library/PreferencePanes/"
"DateAndTime.prefPane/Contents/"
"Resources/TimeZone.prefPane")
TimeZonePref = TZPP.classNamed_('TimeZonePref')
ATZAdminPrefererences = TZPP.classNamed_('ATZAdminPrefererences')
atzap = ATZAdminPrefererences.defaultPreferences()
pref = TimeZonePref.alloc().init()
atzap.addObserver_forKeyPath_options_context_(pref, "enabled", 0, 0)
result = pref._startAutoTimeZoneDaemon_(0x1)

LS 10.12.4 daemon load warning

I need to silence the warning message on 10.12.4>. Basically, don't run the launchctl load or unload since it is now SIP'ed. The killall on the _locationd daemon is forcing the refresh which is why this is still working.

Additional checks for LSAutoTimeZone

More checks for LSAutoTimeZone.py

def timezone_lookup():
"""Force a timezone lookup right now"""
TZPP = NSBundle.bundleWithPath_("/System/Library/PreferencePanes/"
"DateAndTime.prefPane/Contents/"
"Resources/TimeZone.prefPane")
TimeZonePref = TZPP.classNamed_('TimeZonePref')
ATZAdminPrefererences = TZPP.classNamed_('ATZAdminPrefererences')
atzap = ATZAdminPrefererences.defaultPreferences()
pref = TimeZonePref.alloc().init()
atzap.addObserver_forKeyPath_options_context_(pref, "enabled", 0, 0)
result = pref._startAutoTimeZoneDaemon_(0x1)

if pref.hardwareSupportsAutomaticTimeZone() not 1:
   return False
   # then exit out of function

# At the end of the function verify
if pref.isTimeZoneAutomatic() is not 1:
    return False

# If all is well
return True

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.