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 ZIP Setup

Example: Preparing a Custom Package for ZIP Setup

Use the install.sh script from the 1Password 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.
  • src_app_folder – the top-level folder in the unpacked ZIP software package you downloaded from the vendor.
  • binary_path – you can get it by browsing the src_app_folder (within the ZIP); typically, the setup binary is located under Contents / MacOS.

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_zip $?' 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"

### 1Password install\update

function main() {
  # internal parameters
    display_name='1Password' # Name of your deployment package that Action1 will use when displaying History messages.
    log -m "$(printf 'start deploying "%s"' "$display_name")" -n "INFO"

    proc_names=("1Password") # Application process name for the app you need to install. Multiple names should be separated by space, e.g., ("process1" "process2")

    dmg_mount_point='./local_mnt' # Do not modify. Files mount point.
    src_app_folder='1Password.app'  # Top-level folder in the unpacked ZIP software package you downloaded from the vendor.
    extract_path='./local_mnt'
    binary_path="${extract_path}/${src_app_folder}/Contents/MacOS/1Password" #You can get the binary path by browsing the src_app_folder (within the ZIP)

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

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

  # unzip setup_file
    unzip_archive "$setup_file" "$extract_path" || 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
    copy_app_folder "${extract_path}/${src_app_folder}" "$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 (DMG 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 ZIP files?

  1. It looks for the software setup file within the ZIP you obtained from the vendor.
    NOTE: Make sure that ZIP contains only one software setup file.
  2. It unpacks this ZIP file.
  3. Then it checks the application target architecture.
  4. It checks if there is an application process running. If found, it terminates the process.
  5. It copies the content of the unpacked ZIP into the application folder, replacing the existing files.