#!/usr/bin/sh
#----------------------------------------------------------------------------
# /tmp/install.sh - wpa_supplicant installation
#
# Creation   :  2025-11-16 holbru
# Last update:  $Id$
#
# Copyright (c) 2025-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmx(dot)net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#----------------------------------------------------------------------------

# set package name
package_name=wpa_supplicant

# ---------------------------------------------------------------------------
# add menu
# ---------------------------------------------------------------------------
/var/install/bin/add-menu \
        --menu \
        "setup.system.network.menu" \
        "setup.system.network.${package_name}.menu" \
        "WPA Supplicant Service"

# ---------------------------------------------------------------------------
# Create config
# ---------------------------------------------------------------------------
if [ -f /etc/config.d/${package_name} ]
then
    update=true
fi

/var/install/config.d/${package_name}-update.sh
/usr/bin/rm -f /var/install/config.d/${package_name}-update.sh

# ---------------------------------------------------------------------------
# start package with update
# ---------------------------------------------------------------------------
if ${update:-false}
then
    /var/install/config.d/${package_name}.sh

    . /etc/config.d/${package_name}

    if [ "${START_WPA_SUPPLICANT}" = "yes" ]
    then
        /usr/sbin/service restart ${package_name}.service
    fi
fi

exit 0
# ---------------------------------------------------------------------------
# end
# ---------------------------------------------------------------------------
