Problems with vmmodules install script

I have been using this script for awhile but recently I have run into an issue where it fails on Line 30 with the following:

usage: command not found

I am unfamiliar with the command “usage” nor can I find this command anywhere to install it so that the script will work properly.

Can someone please enlighten me?

#!/usr/bin/bash

export LANG=C

COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"

ret=0

case "$COMMAND" in
    add)
        VMWARE_VERSION=$(cat /etc/vmware/config | grep player.product.version | sed '/.*\"\(.*\)\".*/ s//\1/g')

        [ -z VMWARE_VERSION ] && exit 0

        mkdir -p /tmp/git; cd /tmp/git
        git clone -b workstation-${VMWARE_VERSION} https://github.com/mkubecek/vmware-host-modules.git
        cd vmware-host-modules
        make VM_UNAME=${KERNEL_VERSION}
        make install VM_UNAME=${KERNEL_VERSION}

        ((ret+=$?))
        ;;
    remove)
        exit 0
        ;;
    *)
        usage
        ret=1;;
esac

exit $ret

1 Like

I’m unfamiliar with usage as a command.

My guess is that this is incomplete… and that should read something like,
echo “usage script arguments”

I don’t have VMWARE to test but you can check:

#!/usr/bin/env bash

export LANG=C

COMMAND="$1"
KERNEL_VERSION="$2"
#The below arguements don't appear to be utilized. 
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"

ret=0

case "$COMMAND" in
    add)
        VMWARE_VERSION=$(cat /etc/vmware/config | grep player.product.version | sed '/.*\"\(.*\)\".*/ s//\1/g')
        #Exit if VMWARE version can not be found or if kernel version is not provided
        if [ -z ${VMWARE_VERSION} ] || [ -z ${KERNEL_VERSION} ]; then  
            echo "NO VMWARE VERSION OR KERNEL VERSION PROVIDED" 
            ret=1
        else
            #clone and update kernel modules
            mkdir -p /tmp/git; cd /tmp/git
            git clone -b workstation-${VMWARE_VERSION} https://github.com/mkubecek/vmware-host-modules.git
            cd vmware-host-modules
            make VM_UNAME=${KERNEL_VERSION}
            make install VM_UNAME=${KERNEL_VERSION}
            #exit with the status of the last command
            ((ret+=$?))
        fi
        ;; 
    remove)
        #Exit if the remove argument is sent to the script.
        exit 0
        ;;
    *)
        #Provide usage if script is run without arguments
        echo "Usage,99-vmmodules.install add kernel version" 
        ret=1
        ;;
esac

exit $ret
1 Like

The original script was published here:

How to Resolve Issues for WORKSTATION and PLAYER (ANY KERNEL + ANY VERSION)

1 Like

Please remember that often items posted like that are guides and not actual functional scripts or commands. They expect the user to be able to interpret what is valid syntax and what they need to modify for their own usage.