File: copy-launchd-plist.sh

package info (click to toggle)
wpewebkit 2.38.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 311,508 kB
  • sloc: cpp: 2,653,313; javascript: 289,013; ansic: 121,268; xml: 64,149; python: 35,534; ruby: 17,287; perl: 15,877; asm: 11,072; yacc: 2,326; sh: 1,863; lex: 1,319; java: 937; makefile: 146; pascal: 60
file content (42 lines) | stat: -rwxr-xr-x 1,719 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh

if [[ "${SKIP_INSTALL}" == "YES" || -z "${LAUNCHD_PLIST_OUTPUT_FILE}" ]]; then
    exit 0;
fi

if [[ -z "${LAUNCHD_PLIST_FILE_NAME}" ]]; then
    echo "Missing definition for LAUNCHD_PLIST_FILE_NAME. e.g. 'com.apple.webkit.thedaemon.plist'"
    exit 1
fi

if [[ -z "${LAUNCHD_PLIST_INPUT_FILE}" ]]; then
    echo "Missing definition for LAUNCHD_PLIST_INPUT_FILE. e.g. 'TheDaemon/Resources/com.apple.webkit.thedaemon.plist'"
    exit 1
fi

# Update the launchd plist to point to the install location of the binary in its actual
# location.  When using the system content path, we need to install there and create a
# symlink if required.  Since the location can change based on the build configuration,
# the launchd plists should contain placeholders for build settings INSTALL_PATH and
# PRODUCT_NAME which we replace with the actual values from the current build configuration.

GENERATED_LAUNCHD_PLIST_DIR="${TEMP_DIR}"
mkdir -p "${GENERATED_LAUNCHD_PLIST_DIR}"

GENERATED_LAUNCHD_PLIST_PATH="${GENERATED_LAUNCHD_PLIST_DIR}/${LAUNCHD_PLIST_FILE_NAME}"

echo "Replacing placeholders in ${SRCROOT}/${LAUNCHD_PLIST_INPUT_FILE} and saving to ${GENERATED_LAUNCHD_PLIST_PATH}"

sed \
    -e "s|\${INSTALL_PATH}|${INSTALL_PATH}|" \
    -e "s|\${PRODUCT_NAME}|${PRODUCT_NAME}|" \
    "${SRCROOT}/${LAUNCHD_PLIST_INPUT_FILE}" > "${GENERATED_LAUNCHD_PLIST_PATH}"

# Install the plist.

LAUNCHD_PLIST_INSTALL_FILE="${LAUNCHD_PLIST_INSTALL_PATH}/${LAUNCHD_PLIST_FILE_NAME}"

mkdir -p "${DSTROOT}${LAUNCHD_PLIST_INSTALL_PATH}"

echo "Converting ${GENERATED_LAUNCHD_PLIST_PATH} to binary plist at ${LAUNCHD_PLIST_OUTPUT_FILE}"
plutil -convert binary1 -o "${LAUNCHD_PLIST_OUTPUT_FILE}" "${GENERATED_LAUNCHD_PLIST_PATH}"