Git Product home page Git Product logo

mac-libs's Introduction

mac-libs

A library of common reusable bash functions, with 0 non-native dependencies, to assist in the management of macOS computers.

While all the functionality can be replicated within macOS itself, there are two advantages to using the library:

  • Less code to touch if the method to do something in macOS changes.
  • Less remembering (or searching for) obscure macOS utilities, flags, and filters.

Usage

  • Source one of the stub files below, depending on how your script to be run.
  • Source each of the function files that contain the functions you want to use.
    • Internal dependencies are taken care of automatically.
    • See individual function files for arguments & additional notes.
  • If using jamf.sh or root.sh, initialize the user with one of the user::init functions.

Stub Files

File For Effects
core.sh Scripts run as shell user User functions automatically run on $USER
root.sh Scripts run as root, affecting a different user Must call user::init <username> or user::init::console to set user.
jamf.sh Scripts run via Jamf Pro * User functions automaticaly run on username supplied by Jamf as $3.
* $jamfUser automatically set to $3
* $jamfHost automatically set to $2<br>* $jamfRootautomatically set to$1`
* All arguments shifted, $4 becomes $1

User Functions

All functions based on user information in this library run on a specific reference user, based on the chosen sub file (see above) and the user::init function used.

Optional Installer Script

If your script is running as root, you can silently install the library using the 1-liner below:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/jonesiscoding/mac-libs/HEAD/bin/install.sh)" || exit 1

The installer will check this repo for the most recent release, then if needed, download & extract to /usr/local/sbin/lib/mac-libs/.

mac-libs's People

Contributors

jonesiscoding avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.