Getting Started

Endpoints

Patch Management

Vulnerability Management

Software Deployment & IT Assets

Automation & Remote Desktop

Real-Time Reports & Alerts

Account Access & Management

SSO Authentication

Security Concerns

Need Help?

Action1 5 Documentation 5 Example: Preparing a Custom Package for PKG Setup

Example: Preparing a Custom Package for PKG Setup

Use the install.sh script from the Microsoft Teams app package (provided below) as a template.
You will need to provide the following parameter values for function main():

  • display_name – name of your deployment package that Action1 will use when displaying History messages.
  • proc_names – application processes for the app you need to install.
  • default_app_folder – default application folder.
NOTE: Application setup provided as a PKG file packed into a DMG file is not supported in the current version.

Important! It is strongly recommended that you edit the script on a macOS machine using the Mac tools. If you plan to use a Windows machine and an editing tool like Notepad++, consider that it may append the “CR” (‘\r’) character to each line when saving the file. In this case, make sure that you have removed these characters from the code; otherwise, the script will fail to run.

#!/bin/bash
export PATH=$PATH:/sbin:/usr/sbin
source "common.sh"
trap 'finally_pkg $?' EXIT SIGINT
result=''

# external named parameters
# -m "install"|"upgrade"
# -p "/Applications"|"custom_path"
# -f "App folder name.app", for upgrade only
# -s "error|kill|ignore". Default="kill" and continue deployment
# -v "ERR|WARN|INFO|DBG"
# -b "app.new.build.number"

agruments="$@"
inv_script="$(basename "$0")"
log_started "$inv_script" "$agruments"

validate_params "$@" || exit $?
deploy_mode="$m"
inst_root_folder="$p"
app_process_mode="$s"
upgrade_app_folder="$f"
new_app_ver="$b"
log_level="$v"
#log_level="DBG"

### Microsoft Teams install\update

function main() {
  # internal parameters
    display_name='Microsoft Teams' # for messages only
    log -m "$(printf 'start deploying "%s"' "$display_name")" -n "INFO"

    proc_names=("MSTeams$") # array, f.e. ("process1" "process2")
    default_app_folder="Microsoft Teams.app"  # for install mode

    if [[ "$deploy_mode" == 'install' ]]; then
        app_folder_name="$default_app_folder"
    else
        app_folder_name="$upgrade_app_folder"
    fi

  # test setup file
    get_setup_by_ext "pkg" && setup_file="$result" || exit $?

  # test application binary architecture
  # test_binary_arch "$binary_path" || exit $?

  # test running processes
    if [[ "$app_process_mode" == 'kill' ]]; then
        kill_process "${proc_names[@]}"
    fi

    if [[ "$app_process_mode" != 'ignore' ]]; then
        test_process "${proc_names[@]}" || exit $?
    fi

  # deploy software\update
    deploy_pkg "$setup_file" "$inst_root_folder" "$app_folder_name" "$deploy_mode" || exit $?
    exit 0
}


main

NOTE: MacOS is case-sensitive, so make sure you copy and paste all names correctly.

After you have edited the install.sh, save the file and include it in the ZIP archive together with common.sh and the application setup (PKG file).

IMPORTANT! Make sure these files are stored in the archive’s root and not included into any folder or subfolder – otherwise the Action1 agent will fail to locate and use them. The ZIP archive structure must look like shown below, including 2 scripts and application setup (DMG, PKG, or ZIP file).
Uploading a ZIP package

How the install.sh works for PKG files?

  1. It checks if there is an application process running. If found, it terminates the process.
  2. It installs the application in the specified app folder, using the macOS installer utility.