wmbusmeters/scripts/install_binaries.sh

27 wiersze
970 B
Bash
Czysty Zwykły widok Historia

# Copyright (C) 2021-2023 Fredrik Öhrström (gpl-3.0-or-later)
2021-06-26 15:22:07 +00:00
# Command binary /usr/bin/wmbusmeters
wmbusmeters_dir="${ROOT}/usr/bin"
wmbusmeters_path="${wmbusmeters_dir}/wmbusmeters"
2022-07-06 07:53:22 +00:00
# Daemon /usr/sbin/wmbusmetersd which is a symlink to the command binary.
wmbusmetersd_dir="${ROOT}/usr/sbin"
wmbusmetersd_path="${wmbusmetersd_dir}/wmbusmetersd"
2021-06-26 15:22:07 +00:00
# Remove any existing installed components.
rm -f "$wmbusmeters_path" "$wmbusmetersd_path" || exit $?
2023-06-05 09:44:28 +00:00
# Install the command binary and create the bin directory if necessary.
install -D -m 755 "$SRC" "$wmbusmeters_path" || exit $?
# Create the sbin directory if necessary.
2023-06-05 09:44:28 +00:00
mkdir -p "$wmbusmetersd_dir" || exit $?
# Calculate the relative symlink from sbin to bin.
wmbusmetersd_target="$(realpath -s --relative-to="${wmbusmetersd_dir}" "${wmbusmeters_path}")"
# Create the actual link.
2023-06-05 09:44:28 +00:00
ln -s "$wmbusmetersd_target" "$wmbusmetersd_path" || exit $?
echo "binaries: installed ${wmbusmeters_path} ${wmbusmetersd_path}"