Skip to content
Snippets Groups Projects
Select Git revision
  • 1d69d654bb864f4341bb99a61d278f1052e4e62e
  • master default protected
  • 1.1.0
3 results

CHANGELOG.md

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    To find the state of this project's repository at the time of any of these versions, check out the tags.
    fofb-init.sh 1.45 KiB
    #!/bin/bash
    
    . /etc/init.d/functions
    
    PATH_CONF="/opt/fofb/cfg/configuration"
    
    logger -t "fofb-fpgainit" "Reading configuration file ${PATH_CONF}"
    
    
    start() {
        if [ ! -f ${PATH_CONF} ]; then
            echo "Configuration file not found: ${PATH_CONF}"
            exit 1
        fi
    
        source ${PATH_CONF}
    
        case $FOFB_APP in
            cellnode|centralnode)
                echo "Found configuration ${FOFB_APP}"
                ;;
            *)
                echo "Could not establish FOFB application"
                exit 1
                ;;
        esac
    
        # Taking the last binary file in the sorted list (higher tag)
        PATH_FPGABIN=$(ls -S /lib/firmware/base/${FOFB_APP}/*.bin | tail -n 1)
        echo "Loading FPGA image ${PATH_FPGABIN}"
        fpgautil -b ${PATH_FPGABIN}
    
        # Reset the FPGA
        /etc/init.d/fw_plreset.sh
    
        # Linking the correct MAP file
        PATH_MAP="/opt/fofb/map/app_${FOFB_APP}.mapt"
        echo "Linking map file ${PATH_MAP}"
        ln -sf ${PATH_MAP} /opt/fofb/map/app.mapt
    
        # Applying configuration
        fofb-configurator --config /opt/fofb/cfg/config_register --dmap /opt/fofb/opcua-server/devices.dmap
    
    }
    
    stop() {
        echo "Nothing to be done"
    }
    
    
    
    ### main logic ###
    case "$1" in
        start)
            start
            ;;
        stop)
            stop
            ;;
        status)
            echo "Cannot give any status"
            ;;
        restart|reload|condrestart)
            stop
            start
            ;;
        *)
            echo $"Usage: $0 {start|stop|restart|reload|status}"
            exit 1
    esac
    
    
    
    exit 0