#!/bin/bash

# Entry point for bringing the exported softswitch data into the system.
# This script preserves the interface with the other callers.

# Authors:
#    Gerasimos Kouris,
#    Nikolaos Chatiras,
#    Georgios Basis,
#    Antonios Chalas, for Atos (c), 2021

ARGS="$@"
PROC_NAME="$(basename $0)"
MAIN_LOGFILE="/log/prepare8k.log"
chmod o+r /etc/login.defs

source /usr/bin/common8k || exit 1

### Main ###

echo "Calling import8k ${ARGS}"

# If this is a recursive call, then do not re-initiate a logging session

if processCalledByImageUpgrade "$$"; then
   su - srx -c "/usr/bin/licensecontroller ${ARGS}"
   exit $?
fi

su - srx -c "/usr/bin/licensecontroller ${ARGS}" 2>&1 | tee -a ${MAIN_LOGFILE}
