#!/bin/sh
# SPDX-FileCopyrightText: © 2008-2022 Oprea Dan
# SPDX-FileCopyrightText: © 2008-2022 Bart de Koning
# SPDX-FileCopyrightText: © 2008-2022 Richard Bailey
# SPDX-FileCopyrightText: © 2008-2022 Germar Reitze
# SPDX-FileCopyrightText: © 2017 Matthias Gerstner
# SPDX-FileCopyrightText: © 2024 Jürgen Altfeld
# SPDX-FileCopyrightText: © 2024 Christian Buhtz <c.buhtz@posteo.jp>
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# This file is part of the program "Back In Time" which is released under GNU
# General Public License v2 (GPLv2). See LICENSES directory or go to
# <https://spdx.org/licenses/GPL-2.0-or-later.html>.

# Location of this script
CUR_PATH="$(dirname $(readlink -m $0))"

# Was this script started in the source code folder (normally during development)?
if [ -f "${CUR_PATH}/backintime.py" ]; then
	APP_PATH=$CUR_PATH
else
  # CUR_PATH must be /usr/bin (the default installation path of this script)
  # or another sibling folder of "share" (in case of an alternative installation
  # folder like "/var/bin" where BiT must be installed into /var/share/backintime then)
	APP_PATH=$(readlink -m "${CUR_PATH}/../share/backintime/common")
fi

# -E ignores env vars like PYTHONPATH and PYTHONHOME that may modify
#    the behavior of the interpreter
# -s Don't add user site directory to sys.path
# TODO Should we use "$APP_PATH" (quoted) to prevent globbing and word splitting?
/usr/bin/python -Es $APP_PATH/backintime.py "$@"
