| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 | #!/usr/bin/env bashfunction is_root {    if [ ${EUID:-$(id -u)} -eq 0 ]; then        return 0    fi    return 1}function lognecho {    for STR in "${@}"; do        logger "${STR}"        echo "${STR}"    done}function yn {    read -p "Procced? [y/n]: " CHOICE    case ${CHOICE} in        y)            return 0            ;;        n)            return 1            ;;        *)            yn            ;;    esac}is_rootif [ $? -ne 0 ]; then    lognecho "Root is required. Run with sudo:" "$ sudo ${SNAP_NAME}.install"    exit 1fiif snapctl is-connected components; then    if [ -n ${CONNECT-} ]; then         if [ -d "$SNAP_DATA/custom_components/hacs" ]; then            lognecho "${SNAP_NAME} is already installed. Re-installing it will overwrite current installation."            yn            if [ $? -ne 0 ]; then                exit 1            fi        fi    fi    lognecho "Installing ${SNAP_NAME} into your Home Assistant installation: ${SNAP_DATA}"    cd "${SNAP_DATA}"    export haPath="${SNAP_DATA}"    ${SNAP}/hacs    if [ $? -ne 0 ]; then        lognecho "Installation of ${SNAP_DATA} failed!"    else        lognecho "Installation of ${SNAP_DATA} successful."    fielse    lognecho "${SNAP_NAME}:components is not connected, connect with:" "$ snap connect ${SNAP_NAME}:components home-assistant-snap:components"    exit 1fi
 |